Modernization
12 min read
November 22, 2026
Modernizing a legacy system without a rewrite freeze
A step-by-step strangler-fig playbook: mapping seams, routing traffic gradually, running old and new in parallel, migrating data safely, and actually retiring the old code.
By Parth Patel
Every long-lived system eventually reaches the point where changes take too long, deployments feel dangerous and the framework is out of support. The tempting answer is a rewrite: freeze the old system, build a clean new one, switch over. The track record of that approach is poor. Rewrites take longer than estimated, the old system keeps changing underneath them, and the cutover concentrates all the risk into a single weekend.
The alternative is incremental replacement, often called the strangler fig pattern after the vine that grows around a tree until it can stand on its own. New functionality grows around the old system, one slice at a time, until the old system can be removed. This playbook describes how to run it in practice.
Step 0: decide what "modern" means for you
"Modernize the platform" is not a goal you can finish. Before touching code, write down the outcomes you want, in terms you can measure:
- Change cost: lead time from a request to production, or the number of modules touched by a typical change.
- Release safety: deployment frequency, change failure rate, time to restore service.
- Supportability: runtime and framework versions inside vendor support, known security issues.
- Running cost: infrastructure spend, or the hours spent each month on manual operations.
These numbers decide what to migrate first and tell you when you're done. Without them, modernization turns into an open-ended refactoring program that nobody can declare finished.
Step 1: map the system and find the seams
The architecture in the wiki is rarely the architecture in production. Build a real map:
- Entry points: every HTTP route, scheduled job, queue consumer and file drop the system responds to.
- Data ownership: which tables each part of the code writes to. Shared writes are where migrations get hard.
- Dependencies: which modules call which, including the database used as an integration layer.
- Change hotspots: version control history shows which files change most often and together. Those are where modernization pays off first.
A quick way to find hotspots is to count how often each file changed in the last year:
git log --since="12 months ago" --name-only --pretty=format: \
| grep -v '^$' | sort | uniq -c | sort -rn | head -30You are looking for seams: places where a capability can be separated with a clear interface. Good first candidates change often, have a well-defined boundary, and are valuable enough that improving them is visible to the business.
Step 2: put a façade in front
Incremental replacement needs a single point that decides, per request, whether the old or new implementation handles it. Usually that is a reverse proxy or API gateway in front of the legacy application:
# Requests for migrated capabilities go to the new service; everything else is unchanged.
location /api/invoices/ {
proxy_pass http://invoicing-service;
}
location / {
proxy_pass http://legacy-app;
}For finer control, route inside the application with feature flags, so traffic can move per customer, per region or by percentage:
export async function getInvoice(req: Request, res: Response) {
const useNew = await flags.isEnabled("invoices.new-read-path", { tenantId: req.tenantId });
return useNew ? invoicingClient.get(req.params.id) : legacyInvoices.get(req.params.id);
}The façade is what makes every later step reversible. If the new path misbehaves, you move traffic back in seconds instead of rolling back a deployment.
Step 3: capture current behavior before changing it
Legacy systems are full of behavior nobody documented, and some of it is relied on. Before replacing a slice, record what it actually does:
- Characterization checks: feed recorded real inputs through the old code and save the outputs as the expected results. They describe what the system does, not what it should do.
- Traffic recording: capture a sample of production requests and responses (with personal data removed) to replay against the new implementation.
- Edge-case interviews: the people who operate the system know which quirks matter. Ask before you discover them in production.
Step 4: extract one slice, end to end
Pick a single capability and migrate all of it: API, business logic, data and operations. A vertical slice teaches you more than a horizontal layer, because it exercises deployment, monitoring and data migration for real.
Data is the hard part. The new service should own its data, but during the transition both implementations need consistent information. The usual options:
| Approach | How it works | Risk |
|---|---|---|
| Shared database (temporary) | New code reads and writes the legacy tables | Couples the new service to the old schema; plan its end date |
| Change data capture | Stream changes from the legacy database into the new store | Operational complexity; lag must be monitored |
| Dual writes | Application writes to both stores | Partial failures leave them inconsistent unless reconciled |
Change data capture is usually the safest default for moving data out, because it doesn't require changing every legacy write path. Whatever you choose, run a reconciliation job that compares old and new data and reports differences. It is the only way to know the stores agree.
Step 5: run old and new in parallel
Before the new path serves real users, let it run in the shadows:
- Shadow reads: send copies of read requests to the new service, discard its responses, and compare them with the legacy responses offline.
- Diff reports: track the percentage of matching responses and investigate every class of difference.
- Dark launches: enable the new path for internal users or a single friendly customer first.
When the diff rate is near zero, and every remaining difference is understood and accepted, the slice is ready.
Step 6: shift traffic, then retire the old path
Move traffic gradually: 1%, 10%, 50%, 100%, watching error rates, latency and business metrics at each step. Keep the rollback switch ready until the new path has handled a full business cycle, such as a month-end close, a peak day or a billing run.
Then do the step most migrations skip: delete the old code. Remove the routes, the tables (after archiving), the jobs and the infrastructure, and update the runbooks. Retired code that's left running still needs patching, still confuses new engineers and still costs money.
Keeping the program healthy
- Timebox each slice. If a slice drags past its estimate, stop and find out why before starting the next.
- Keep shipping features. Modernization that blocks product work loses its sponsorship. Migrated slices should make feature work faster, and that's the evidence to share.
- Report progress in outcomes. "Invoicing deploys daily instead of monthly" is a better status update than "we extracted the invoicing service."
- Write decisions down. Each slice involves trade-offs. Short decision records keep the reasoning available for whoever does the next slice.
Checklist
- Modernization goals written as measurable outcomes
- A system map with entry points, data ownership and change hotspots
- A routing façade that can move traffic in both directions
- Characterization checks and recorded traffic for the slice being replaced
- An explicit decision for each legacy quirk: preserve or fix
- A data synchronization approach with reconciliation reports
- Shadow traffic and diff reports before any user sees the new path
- Gradual traffic shifting with a tested rollback
- The old code, data and infrastructure actually removed
Incremental modernization is slower to start than a rewrite and much faster to finish. Each slice delivers value on its own, every step can be reversed, and the business never has to stop while the system changes underneath it.