Strangler Fig Pattern
ELI5 — The Vibe Check
Replacing a legacy system piece by piece instead of doing a risky big-bang rewrite. Named after the strangler fig tree that grows around another tree until it completely replaces it. Route traffic to the old system, build the new system alongside it, gradually redirect until the old one can be removed.
Real Talk
The Strangler Fig Pattern is an incremental migration strategy where a new system is gradually built alongside a legacy system. An intermediary (usually a reverse proxy or router) directs traffic to either system based on which features have been migrated. It reduces risk compared to full rewrites.
Show Me The Code
# Migration plan:
# Phase 1: Proxy routes all traffic to legacy
# Phase 2: /api/users → new service
# /api/* → legacy
# Phase 3: /api/users, /api/orders → new
# /api/* → legacy
# Phase 4: All traffic → new system
# Phase 5: Decommission legacy 🎉
When You'll Hear This
"Use the strangler fig pattern — we can't afford a full rewrite." / "We're strangling the monolith one service at a time."
Related Terms
Brownfield
The opposite of greenfield — a project with existing code you have to work with (and work around). Most real-world development is brownfield.
Legacy Code
Old code that nobody wants to touch but everyone depends on.
Microservice
Microservices is an architecture where instead of one big app, you have many tiny apps that each do one thing.
Refactoring
Refactoring is improving the internal structure of code WITHOUT changing what it does from the outside.