Skip to content

ERPNext Case Study

ModernizeSpec did not start as a specification. It started as an internal need: PearlThoughts was migrating ERPNext from Python/Frappe to Go, and the teams needed a structured way to describe the legacy system to AI agents.

This case study documents the journey from internal tooling to open standard.

DimensionValue
First commit2005-2006 (GitHub 2011)
Python lines of code316,679
JavaScript lines of code73,932
Unique doctypes (entities)521
API endpoints768
Standard reports~177
Modules21
GitHub stars31,400+
COCOMO estimate~216 person-years

ERPNext is one of the longest-running open-source ERP systems. Its 20 years of development produced a monolithic codebase deeply coupled to the Frappe framework, with implicit execution paths driven by a hooks system and a controller inheritance chain where a single file (accounts_controller.py, 4,412 lines, 168 functions) affects every financial transaction.

The core question: Can 3-5 interns migrate ERPNext from Python to Go in 3 months with unlimited AI credits?

Full Replacement

521 doctypes, all modules, framework replacement. Not feasible in 3 months — estimated 26-43 months of work.

Core Accounting

~75 doctypes covering GL, Tax, Invoicing, Payments. Achievable in 3 months with a focused team.

Core + Stock + Selling

~150 doctypes covering 60% of business value. Achievable in 6-9 months.

Production-Ready (80% Parity)

~400 doctypes + framework + frontend. Requires 8-12 engineers over 12-18 months.

PearlThoughts ran two parallel tracks:

Three iterations extracting core accounting modules into idiomatic Go using hexagonal architecture:

IterationPython SourceGo OutputTests
Mode of Payment66 lines518 lines19
Tax Calculator1,334 lines1,240 lines24
GL Entry Engine878 lines2,608 lines32

68 passing parity tests, zero external dependencies.

TeamFocusKey Achievement
AlphaAccounts ModernizationRAG system with Streamlit UI
BetaAI-Driven ModernizationVS Code extension (1,700 LOC), 600x Redis caching
GammaGraph-Augmented RAG+2.5 accuracy over flat RAG on golden dataset
DeltaCode Analyzer and TranspilerPython-to-Go AST transpiler
EpsilonParity TestingCI-ready parity tests, best engineering discipline
ZetaTax Calculation100% tax calculation parity (independently replicated)
EtaRAG EvaluationEvaluation pipeline (infrastructure issues limited output)
  1. Hexagonal extraction works. Business logic separates cleanly from Frappe framework dependencies using ports and adapters.
  2. Parity testing is achievable. Table-driven Go tests verify functional equivalence against Python behavior.
  3. The pattern is reproducible. Team Zeta independently replicated tax calculation parity from the reference repo without direct mentorship.
  4. AI accelerates understanding. Graph-augmented RAG outperforms naive retrieval by +2.5 accuracy for hook-driven architectures.
  5. Team quality matters more than team size. A solo contributor (Zeta) matched 4-person teams in output.
  • Production database adapters (only interfaces exist)
  • Framework replacement (Frappe’s ORM, permissions, workflow, multi-tenancy)
  • Scale beyond Accounts module (no team attempted Stock, Manufacturing, or CRM)
  • Frontend migration (73,932 lines of JavaScript untouched)
  • Cross-module integration testing

The .agents/modernization/ directory structure, the DDD mapping format, the extraction sequencing schema, and the parity verification approach were all built for this specific migration. But none of them contained anything ERPNext-specific at the schema level.

The feasibility analysis confirmed: every concept generalizes. What was internal tooling could become an open specification.

That specification became ModernizeSpec.

Platform Analysis

Deep dive into ERPNext’s architecture, DocType system, controller inheritance chain, and what makes it hard to migrate.

Read the analysis

Migration Experiments

Three Go extraction iterations with hexagonal architecture, parity testing methodology, and results.

Read the experiments