How to replace a legacy system without a rewrite, a freeze, or a big-bang cutover that ruins someone's quarter

By The Coding Gopher

Published: 2026-11-24

URL: https://thecodinggopher.substack.com/p/the-strangler-fig-pattern


Every engineer eventually inherits a system nobody wants to touch. It’s ten years old, the original authors left, the tests are aspirational, and it processes something the business genuinely cannot lose — payments, orders, patient records. It also blocks every roadmap item, because adding a feature to it takes three weeks and breaks something unrelated.

So somebody proposes the rewrite. Eighteen months, a parallel team, a clean architecture, a hard cutover at the end.

It’s the most reliably catastrophic plan in software, and it keeps getting approved because the alternative feels like doing nothing.

The Strangler Fig pattern is that alternative. It replaces the system incrementally, in production, with old and new running side by side and traffic shifting between them one slice at a time.What is the Strangler Fig Pattern? | by Denny Lesmana | MediumThe Strangler Fig pattern is a software development strategy used to gradually replace a legacy (old) system with a new one by incrementally rewriting specific pieces of functionality. Coined by Martin Fowler, it is named after the strangler fig plant, a vine that grows around a host tree, slowly taking over its resources until the original tree is gone.

The name comes from Martin Fowler, who took it from the strangler figs he saw in Australia. The plant germinates in a host tree’s branches, grows roots down around the trunk, and eventually the host rots away — leaving a self-supporting structure in its shape.

That’s the whole idea: grow the replacement around the legacy system rather than building it elsewhere and swapping at the end.

Join a community of senior engineers. Subscribe and get FREE access to System Design deep dives.

Why big-bang rewrites failSTOP hurting yourself by doing big bang modernizations!A big-bang rewrite is a high-risk software modernization strategy where an entire legacy system is rebuilt from scratch and swapped out all at once.

Worth being specific here, because “rewrites are bad” is folklore until you can name the mechanism.

1. The old system is a specification you can’t read. Ten years of bug fixes, edge cases, and regulatory patches are encoded in that code, and almost none of it is written down. The rewrite reimplements what the team believes the system does. It ships, and then you discover the 3% of behavior nobody knew about — usually via customers.

2. You’re aiming at a moving target. The business doesn’t stop for eighteen months. Either the legacy system keeps changing and the rewrite is permanently behind, or you freeze it and the business quietly routes around you.

3. Value arrives only at the end, if it arrives. Every month of a rewrite is pure cost. No partial credit, no way to validate with real traffic, no way to stop halfway and keep what you built. So the moment it’s late — and it will be late — the pressure is to cut testing rather than scope.

4. The cutover is one enormous bet. All the risk lands in a single weekend. If it goes wrong, the rollback is “restore the old system and lose whatever happened since,” which nobody has practiced.

Strangler Fig attacks all four. Each slice is small enough to understand, ships in weeks not quarters, delivers value on its own, and rolls back by flipping traffic.

Learn System Design, Visually (Module 1 Free)System Design, Visually Explained: animated video course by The Coding Gopher

Want to understand systems like this well enough to design them yourself?

My animated course System Design, Visually Explained builds every concept as a clean, step-by-step diagram, from the fundamentals to real interview designs. It grew out of my YouTube explainers, which have millions of views.

Module 1 is free. No card needed.

Want everything? All-Access Lifetime includes all 6 live courses (System Design, AI Engineering, Backend Development, Cloud Development, System Design: Case Studies and Data Structures & Algorithms), the 10 on the way (Distributed Systems, How Computers Really Work, Database Internals and more), the full System Design Visual Guide and every course after that, for one payment.

💡 Many engineers expense this through their team's learning budget.

Watch Module 1 free →

Building a product for developers? Put it in front of thousands of engineers who read this newsletter and watch The Coding Gopher on YouTube. Newsletter and video sponsorships are open.

Work with me →

Build Redis, Git, Docker & Claude Code From Scratch

Want to become a better software engineer?

Trusted by engineers at Google, NVIDIA, and Anthropic, CodeCrafters helps you rebuild technologies like Redis, Git, Docker, and Claude Code from scratch so you can deeply understand how real systems work.

We’ve partnered with CodeCrafters to give all readers an exclusive 40% lifetime discount.

💡 Engineers may expense platforms like this through their team’s learning budget.

Start Building & Unlock 40% Off

How it actually worksThe Strangler Fig pattern is an incremental software migration strategy that replaces a legacy monolithic system by gradually building new functionality around or alongside it, rather than performing a high-risk, all-at-once rewrite.

The core move: put something in front of the legacy system that can route requests to either implementation. Then migrate one piece at a time, changing only where the router points.

PHASE 1 - Interception (nothing has changed yet)

Clients
|
v
Facade / Router
|
v
Legacy System          <- 100% of traffic

PHASE 2 - First slice migrated

Clients
|
v
Facade / Router
|
|--> New Service     <- reporting only
|
'--> Legacy System   <- everything else

PHASE 3 - Most traffic moved

Clients
|
v
Facade / Router
|
|--> New Services    <- reporting, orders, billing
|
'--> Legacy System   <- one stubborn batch job

PHASE 4 - Host removed

Clients
|
v
Facade / Router
|
v
New Services           <- 100% of traffic

The facade is the whole trick. API gateway, reverse proxy, in-app routing layer, event router — the mechanism matters less than the property it buys you:

Clients don’t know or care which implementation serves them. That’s what lets you move them one at a time without coordinating a release with every consumer.

The six steps

Step 1 — Put the facade in and change nothing else. Deploy the router in front of the legacy system with every route pointing at the old code. This ships no features, which makes it a hard sell, but it’s what makes everything after it possible. Verify it’s transparent: same latency budget, same error semantics, same auth behavior.

Step 2 — Pick the first slice deliberately. Not the hardest. Not the most valuable. Pick clean boundaries, low write volume, small blast radius. Reporting and read-only endpoints are the classic first choice, because getting them wrong shows up as a wrong number on a dashboard rather than a lost order.

Step 3 — Build the replacement and run it in shadow. Send real production traffic to both, serve the legacy response to the user, and compare the new system’s output against it. This is where you discover the undocumented behavior — without any customer being affected. GitHub’s scientist library was built for exactly this, and there are ports in most languages.

Step 4 — Shift traffic gradually. 1% → 10% → 50% → 100%, watching error rates and latency at each step. Route by whatever dimension fits: percentage, user cohort, tenant, geography, internal-users-first.

Step 5 — Delete the old path. The step teams skip, and skipping it is how you end up permanently maintaining both systems. Once traffic has held at 100% through a full business cycle — including month-end, or whatever your worst day is — remove the legacy code and the routing branch.

Step 6 — Repeat until the host is gone.

Pattern: Strangler application


The hard part: data

Routing requests is the easy half. Most failed strangler migrations fail on data, because both systems need the same records and only one can own them.

Three approaches, in rough order of preference:

① Single owner, read through the API. The new service calls the legacy system (or vice versa) for data it doesn’t own. Pro: simple, no consistency problem. Con: the two are coupled, and the legacy system stays on the critical path.

② Change data capture. Stream changes out of the legacy database — CDC tools like Debezium reading the transaction log, or the outbox pattern if you can modify the legacy code — and project them into the new store. Pro: real decoupling. Con: eventual consistency you now have to reason about explicitly.

③ Dual-write. Write to both systems on every change. Pro: conceptually obvious. Con: usually a mistake. Without a distributed transaction you get partial failures, and reconciling divergent stores is a permanent tax. If you must, do it briefly and add a reconciliation job that alerts on drift.

Whatever you pick, decide who owns each entity before writing any code, and write it down. Ambiguous ownership is what turns a six-month migration into a two-year one.


When it works, and when it doesn’t

Good fit

-

The system is big enough that a rewrite would take more than a couple of months

-

It has identifiable seams — modules, endpoints, or workflows with reasonably clean boundaries

-

It’s business-critical, so downtime and behavioral regressions are expensive

-

You need to keep shipping features during the migration

Poor fit

-

Small systems. If it’s genuinely a two-week rewrite, the facade and dual-running machinery cost more than they save.

-

No seams. A true big ball of mud where everything touches global state may need refactoring inside the legacy system first, to create boundaries you can cut along.

-

The platform itself is the problem. Moving off a mainframe or a dead runtime where nothing can sit in front of it may need a different approach — though an anti-corruption layer can often provide the seam.

-

No organizational patience. The pattern trades total speed for reduced risk and continuous value. If leadership loses interest in four months, you get the worst available outcome.

That last one deserves emphasis, because it’s the common failure:

A half-finished strangler migration is worse than either endpoint. You’re maintaining the legacy system, and its replacement, and the routing layer between them — and every new feature gets built twice or awkwardly assigned to one side. The pattern only pays off if you finish.

Strangler fig pattern


Related patterns you’ll need

Anti-corruption layer — a translation boundary between new code and the legacy model, so the old system’s bad abstractions don’t leak into your new design. Without it, the replacement inherits the shape of the thing it’s replacing, and you’ve spent a year to arrive somewhere very similar.

Branch by abstraction — the in-process cousin. Instead of routing HTTP traffic, introduce an interface inside the codebase, put both implementations behind it, and switch with a feature flag. Use this when the seam is a module boundary rather than a network boundary.

Parallel run / shadow traffic — covered above, but worth naming separately. It’s what converts “we think the new service is correct” into evidence.


The one-sentence versionStrangler fig pattern - AWS Prescriptive Guidance

Put a router in front of the legacy system, move one well-chosen slice at a time behind it, verify each slice against real traffic before it serves anyone, and delete the old path as you go — so that at every point in the migration you have a working system, a way back, and something to show for the last two weeks.

Join a community of senior engineers. Subscribe and get FREE access to System Design deep dives.

Thanks for reading! This post is public so feel free to share it.

Share