Strangler Fig Pattern — Monolith to Microservices Migration
Fast recall
Quick revision
Core answer
Whether you know safer migration strategies vs big-bang rewrites
Recommending a full rewrite — the 'second system effect' is a well-documented failure mode
Mention the anti-corruption layer and the Branch by Abstraction pattern as companion techniques
Interview-ready guide
Interview answer
The Strangler Fig pattern is the opposite of a big-bang rewrite. You place an API gateway in front of the existing monolith, extract one module at a time into a new service, and route traffic to it at the gateway — the monolith keeps running throughout with no feature freeze, no launch day, and no all-or-nothing risk.
The migration sequence:
- Start with a low-risk, well-bounded module — user profiles or notifications, not payments; build the new service with its own database and API, then update the gateway to route the relevant path to the new service
- If something breaks, one routing change sends traffic back to the monolith — rollback is seconds, not a deployment cycle
- The monolith's code stays intact for at least one release cycle after cutover, so regression is always available
Database migration — the underestimated part:
- Redirecting HTTP routes to a new service that still reads from the monolith's database creates a distributed monolith — the service is independent in name only
- Replicate data via CDC (Debezium), shadow-test reads for at least a week, then switch writes; the new service becomes the authoritative data owner
- The anti-corruption layer translates between the monolith's legacy data model and the new service's clean domain model — without it, you inherit 15-year-old column names and business rules baked into database schema
The test of real independence:
- If you can't deploy the extracted service without coordinating with another team or service, you have a distributed monolith, not microservices
I recommend Strangler Fig as the only safe migration approach — big-bang rewrites fail more than 70% of the time because the second system must achieve full feature parity before delivering any value.
Strangler Fig Pattern — Monolith to Microservices Migration
Direct Answer
The strangler fig pattern incrementally replaces monolith functionality by routing requests to new microservices at the edge, while the monolith handles everything else. New code is written as services; old code is strangled service by service.
Common Mistakes & Pitfalls
Recommending a full rewrite — the 'second system effect' is a well-documented failure mode
Check your understanding
Answer these without looking back at the article.
- How do you migrate the database when extracting a service from a monolith?
- What is the Anti-Corruption Layer pattern?
- How do you decide which bounded context to extract first?
Related interview prep categories
2Want a guided curriculum order?
These modules are also sequenced in our flagship backend interview track — open it when you prefer an ordered path instead of browsing by topic.