Key takeaways
- Legacy system modernization rarely means rewriting everything. The safer route for most companies is to replace the old system piece by piece while it keeps running.
- Start with the reason. An unsupported runtime, a missing integration and a system only one person understands each call for a different fix.
- Full rewrites fail most often because they try to copy every existing feature before delivering anything new.
- Data is the hardest part. Plan the migration, the clean-up and a cut-off date before writing new code.
- Leave a stable, supported system alone if it does its job and nothing new is asked of it.
Legacy system modernization is the work of moving an old business system, one the company depends on and can’t easily change, onto a footing it can keep running and extending. Typical examples are an order system written in PHP 5 a decade ago, an internal tool built on Microsoft Access, or a customer database that only one developer still understands.
The instinct is to rewrite it from scratch. That’s usually the riskiest option. This guide explains the alternatives, how to choose between them, what each costs, and the data work that decides whether the project succeeds. We build and maintain custom systems for companies that have outgrown their tools, and this is the pattern we’d follow with our own money.
Signs your system needs attention
Old isn’t the same as legacy. A ten-year-old system on supported software that does its job is an asset. A system becomes a problem when one of these is true:
- It runs on software that no longer gets security fixes. PHP 5.6 reached its end of life on 31 December 2018 and PHP 7.4 on 28 November 2022. Even PHP 8.2 gets security support only until 31 December 2026. Python 2 was sunset on 1 January 2020, and Windows 10 support ended on 14 October 2025.
- Other software is leaving it behind. WordPress 7.0, for example, dropped support for PHP 7.2 and 7.3, so a site stuck on those versions can no longer receive core updates.
- Every change takes weeks, because nobody dares touch the code and there are no tests.
- It can’t talk to the rest of the business. Orders are re-entered into accounting by hand because the old system has no API.
- One person holds the knowledge, and that person is busy, expensive or leaving.
The cost of living with these problems is real, if hard to see. In Stripe’s Developer Coefficient survey, developers estimated they spend 13.5 hours of a 41-hour week on technical debt and another 3.8 hours on bad code. That’s around 42% of their time. Governments face the same: the US GAO reported that about 80% of $90 billion in federal IT spending went to operating and maintaining existing systems, and that the ten most critical legacy systems it reviewed were between 8 and 51 years old.
Five ways to modernize a legacy system
Cloud providers describe migration options as the “7 Rs”. AWS lists them as retire, retain, rehost, relocate, repurchase, replatform and refactor. For a business system that isn’t moving to a hyperscaler, five choices cover almost every case.
Keep it and make it safe
Upgrade the runtime, patch dependencies, add backups and monitoring, write down how it works. This is the cheapest option and often the right first step, even if something bigger follows. Moving a PHP application from 7.4 to 8.3 is usually weeks of work, not months, provided the code has some structure.
Wrap it with an API
Leave the old system in place and put a small, modern service in front of it. New tools, the shop, the accounting system or a mobile app talk to the service, and only the service talks to the old system. Microsoft’s architecture guidance calls the protective part an anti-corruption layer: a translation layer that keeps the legacy system’s convoluted data and obsolete interfaces from leaking into new code. This buys time and solves the integration problem without touching the core. Our guide to API integration services covers how that layer is built.
Replace it piece by piece
This is the approach Martin Fowler named the Strangler Fig Application, after a vine that slowly grows around a tree. New functionality is built next to the old system, and traffic is moved over one part at a time until the old system has nothing left to do. Microsoft describes the same pattern with a façade that “initially routes most requests to the legacy system” and gradually shifts them to the new one.
Fowler’s point is that investment and returns arrive “gradually and visibly”. After three months you have one part running on the new system, and the business can see whether it works. If priorities change, you stop with something useful instead of a half-finished rewrite.
A related technique, branch by abstraction, applies the same idea inside the code: put an interface in front of the old component, build the new implementation behind it, and switch over when it’s ready.
Replace it with a product
Sometimes the old system was custom only because nothing suitable existed when it was built. If today a standard CRM, ERP or booking product covers 90% of what you need, buying it and migrating the data can beat any custom work. Our post on build vs buy walks through that decision, and the guide on when a custom CRM is worth it shows the numbers for one common case.
Rewrite it
Build a new system from scratch and switch over on a chosen day. This is the option most people picture, and the one experienced teams avoid unless the old system is small or truly beyond rescue.
Why full rewrites go wrong
Joel Spolsky called rewriting code from scratch “the single worst strategic mistake that any software company can make” in his essay on Netscape. His argument still holds. Old code looks messy partly because it contains years of bug fixes and edge cases that nobody documented. A rewrite throws those away and rediscovers them one support ticket at a time.
Thoughtworks consultants describe the same pattern in their Patterns of Legacy Displacement. One key factor in the failures they saw was the desire for “Feature Parity” with the existing systems: the programme promised to deliver exactly what the business had today, just on new technology. Agreeing what the old system actually did turned out to be a huge effort, and it led to a single “big bang” cut-over. Their observation is that technology is at most half of the legacy problem; ways of working, organisation and leadership matter as much.
In practice, a rewrite also means running two systems at once. The old one still needs fixes and new requirements while the new one is being built, so the team either splits or the business waits.
A rewrite is reasonable when the old system is small enough to rebuild in a few months, when its data model is so wrong that every new feature fights it, or when the platform it runs on is going away entirely. Even then, we’d replace it in slices where we can.
Data is the real project
Code can be rewritten. Data has to be carried over, and it’s always messier than expected.
Before any migration, profile the data. Count the records, find the duplicates, list the fields that are free text but should be values, and check which records are still in use. One example from our own work: when we connected an online shop to an accounting system, we found more than 4,000 orders from previous years still marked as “processing” and around 700 “on hold”, although they had been invoiced long ago. Sending them to accounting would have created thousands of false invoices. We set a cut-off date, so that only orders after it were ever exported, and closed the old ones in bulk without triggering customer emails or integrations.
That’s typical. The decisions that matter are business decisions, made before the technical work:
- Which history moves over, and which stays readable in an archive.
- Which system is the source of truth for each record during the transition.
- What the cut-off date is, and what happens to work in progress on that date.
- How you check the result: record counts, totals, and a sample of real records compared by a person who knows them.
During a piece-by-piece migration, data may live in both systems for a while. Keep one owner per record. If customers move to the new system first, the old one should read customer data from the new one, not keep its own copy. Our guide to ecommerce ERP integration goes through the same ownership question for shops.
Choosing what to replace first
In a gradual replacement, the order matters more than the technology. Three questions help.
Where does it hurt most? Pick the part that costs the business the most today: the manual re-entry, the report that takes a day to produce, the module that breaks every month. Replacing it first earns trust for the rest of the project.
What is loosely connected? Reporting, exports, customer-facing forms and integrations usually touch the core only through data. They’re easier to move than the order logic in the middle, and they teach the team how the old data really looks. The Thoughtworks catalogue calls one version of this Event Interception: intercepting updates to the old system’s state and routing some of them to a new component, so new parts can be built without rewiring the old code.
What would you need temporarily? Some steps need scaffolding that will be thrown away later, such as a sync job that keeps two databases in step for six months. Thoughtworks calls this Transitional Architecture, compares it to scaffolding, and treats it as a normal cost, not a mistake. Budget for it, and write down when each piece will be removed.
Leave the most central and riskiest part until the team knows the system well. By the time you replace the core, most of the surprises have already happened elsewhere.
Keeping the old system safe in the meantime
A gradual replacement can take a year, and the old system has to stay secure during that time, even if it runs on software without security fixes.
Reduce who can reach it. An internal tool doesn’t need to be on the public internet: put it behind a VPN or an identity-aware proxy, and allow only the offices and people who use it. Put public parts behind a web application firewall.
Back it up and test the restore. A backup nobody has restored is a hope, not a plan. Run a restore to a separate server once a quarter and check that the system starts.
Watch it. Basic uptime checks, error logs collected in one place and an alert when the nightly export fails cost little and catch most problems before users do.
Upgrade what you can without big changes. Moving to a newer minor version of the language, the database or the server often removes known vulnerabilities with little risk. The keep-and-make-safe option above is usually worth doing even when a replacement is planned.
What modernization costs
Here’s a worked example with the assumptions in the open. Take an internal order and customer system written in PHP 7 about ten years ago. It has around 60 screens, connects to accounting by a nightly file export, and runs the company’s daily work. Assume a blended rate of $60 an hour, which sits inside the $40 to $90 range we quoted for Central European teams in our build vs buy guide. The hours below are assumptions for a system of this size, not quotes.
| Option | Assumed effort | Cost | First value |
|---|---|---|---|
| Keep and make safe: PHP 8 upgrade, tests for key flows, monitoring | 250 hours | $15,000 | 1 to 2 months |
| Wrap with an API for accounting and the shop | 350 hours | $21,000 | 2 to 3 months |
| Replace piece by piece, starting with orders | 2,200 hours over 12 to 18 months | $132,000 | 3 months, then every quarter |
| Full rewrite with a big-bang switch | 2,600 hours plus running the old system | $156,000 or more | 12 to 18 months |
The gradual replacement isn’t cheaper in total than a rewrite. What it changes is when you get value and how much you lose if you stop. After the first quarter the business already uses part of the new system. With a rewrite, the first eighteen months produce nothing anyone uses, and the old system keeps costing money the whole time.
Often the best plan combines the first rows. Make the old system safe now, wrap it so new tools can connect, and then replace the parts that block the business, in order of pain. Our guide to custom software development cost explains how we estimate each slice.
How to run it without stopping the business
A few practices make the difference between a migration nobody notices and one that halts operations.
Put a routing layer in front of the old system early. Whether it’s a reverse proxy, an API gateway or a few lines in the application, it’s the switch that lets you move one screen or one endpoint at a time.
Release in small slices, and keep the old path available for a while. If the new order screen misbehaves, switching back should take minutes.
Run old and new side by side where results matter. For calculations such as prices, taxes or commissions, compute the result in both systems for a few weeks and compare. Differences show you the undocumented rules before customers do.
Write tests around the old system before you change it. They describe what it does today, which is the specification nobody wrote.
Retire what you replace. Every module that moves to the new system should be switched off in the old one. Thoughtworks lists the failure to decommission as a common outcome: organisations add newer technology on top of an already complex set of systems and end up with two to run.
And give the project an owner on the business side. Someone has to decide, every few weeks, which part moves next and whether the last part works. Without that person, modernization becomes an IT project with no end.
When to leave a legacy system alone
Don’t modernize a system because it’s old or because the code is unfashionable. If it runs on supported software, does its job, is backed up and has someone who understands it, the money is better spent elsewhere. The same applies when the process it supports is about to change or disappear: modernizing a tool you’ll retire next year is waste.
And if the real problem is that one person holds all the knowledge, start by documenting the system and writing tests with that person. That’s cheap, and it turns every later option from risky into manageable. Once written down, that knowledge can also feed an internal assistant, as in our guide to the RAG chatbot.
Where to start
Write one page about the system before talking to anyone. Note what it does, who uses it, what runs it (language, framework, versions, hosting), what it connects to, and what the business needs from it in the next two years that it can’t do today. Add the three changes you’ve postponed because they were too risky.
That page shows which of the five options fits. If it’s an upgrade, do it now. If it’s an API layer or a gradual replacement, the page is the start of the plan. We modernize and build custom software for companies in this position, you own the code we write, and we’re happy to read the page and say which parts are worth touching first.




