The short answer
Rewrite only when the platform itself blocks you: the framework or language is unsupported, the data model cannot represent your business, or changes that should take days always take months. Messy code, an unfashionable stack or a developer who dislikes it are not enough. Most apps are better served by fixing the worst parts one at a time.
On this page
Every developer who inherits a codebase wants to rewrite it. Every owner who has been told “it would be faster to start again” has to decide whether to believe it. The honest answer is that a rewrite is sometimes right, and it is more expensive and riskier than it looks.
Why are rewrites risky?
An old app contains years of small decisions: edge cases, fixes for odd customers, rules nobody wrote down. A rewrite throws away the code and keeps none of that knowledge unless someone reads it out first. The usual results: the new version is late, it misses behavior customers depend on, and for months you maintain two systems.
What are real reasons to rewrite?
- The platform is unsupported. The language version, framework or hosting runtime no longer gets security fixes, and the upgrade path is blocked.
- The data model cannot express your business. For example, the app assumes one user per account and you now sell to teams. If every new feature fights the schema, that is structural.
- Changes cost far more than they should, everywhere. Not in one ugly module, but across the app: a small change breaks distant parts, and nobody can predict which.
- It cannot be tested or run. No one can start it locally, and you cannot add tests without rewriting the thing under test.
- The architecture rules out what you need. Real-time, offline, multi-tenancy or scale requirements that the design cannot meet.
What are not good reasons?
- The code is ugly. Ugly code that works and rarely changes costs nothing.
- The stack is not fashionable. A boring, supported stack is an advantage.
- A new developer would prefer a different framework.
- The app is slow in one place. That is a performance fix.
- “We could do it better this time.” You could, and so could the old team’s second attempt, with the same gaps.
What should you try first?
Ordered from cheapest:
- Add a safety net. Backups you have restored, error tracking, a deploy that can roll back, and tests around the most valuable and most fragile flows.
- Fix the worst part. Measure where bugs and delays cluster; usually it is a few modules.
- Upgrade in steps. Update the framework one major version at a time, with the tests running after each.
- Tighten the checks. Adding a type-aware linter to a grown codebase found 2,319 issues on one of our products, and each was sorted into fixed, kept with a reason or rule off; read how we got that to zero. That kind of clean-up is boring and works.
- Replace one piece at a time. Pull a module behind an interface, rebuild it, switch, and delete the old one. This is the “strangler” approach.
How do you rewrite safely if you must?
If the signs point to a rewrite, do it as a series of small replacements, not a blank page:
- Define done by behavior. List what the old app does, in pages, API calls and reports.
- Compare old and new on the same inputs. When we moved a live CRM from SQLite to PostgreSQL, we ran both versions side by side on a copy of production and compared every page. The first comparison found a difference nobody had predicted (a sort order the old database had returned by accident). The second found none. See the full story.
- Keep a way back for a fixed period after the switch.
- Migrate data with checksums, table by table.
- Ship in slices so users see progress and you find problems early.
How can you decide?
Ask your developers to answer these in writing, with examples:
- What specifically can we not do today that we need?
- Which parts cause most of the bugs, and how do we know?
- What would the repair cost versus the rewrite, as a range with assumptions?
- What do we lose in a rewrite, and how will we find out before customers do?
- What is the smallest first step that proves the plan?
A rewrite proposal that cannot answer these is a preference, not a plan. A repair proposal that cannot answer them is the same.
What does a rewrite decision look like in practice?
Suppose an app has a data model that assumes one user per account, a framework two major versions behind and no tests. That sounds like a rewrite, but the steps are smaller: add tests to the money and permission flows, upgrade the framework a version at a time, and add an organization layer to the data model with an expand-and-contract migration. Each step ships on its own and each is reversible. If after those steps the app still resists every change, you now have evidence, tests that describe what the app does, and a safer rewrite.
Working with us
If someone has told you to start over and you want a second opinion, describe the app and what hurts. We would look at the evidence with you and tell you plainly whether we would repair, replace in parts or rebuild. Reach us through contact, or see our web application work.