Course contentsShow
← System Design
Lesson 822 of 1,91921. Microservices ArchitectureFree lesson

The Strangler Fig Pattern for Migration

Gradually extracting services from a monolith by routing new features to microservices incrementally.

The Strangler Fig Pattern for Migration

What You'll Learn

You'll learn how to safely migrate from a monolith to microservices by gradually routing functionality to new services without a risky "big bang" rewrite.

The Core Idea

The Strangler Fig Pattern is named after a tropical plant that grows around a host tree, eventually replacing it. In software migration, you incrementally extract functionality from your monolith by building new microservices alongside it, then routing traffic through a facade or proxy layer that decides which system handles each request.

Instead of rewriting everything at once (high risk, long timelines), you:

  1. Identify a slice of functionality to migrate first (often starting small)
  2. Build a new microservice that implements that feature
  3. Route requests for that feature to the new service via a proxy/gateway
  4. Leave remaining functionality in the monolith temporarily
  5. Repeat until the monolith shrinks to nothing (or a small, manageable core)

Why It Works

This pattern respects domain boundaries (from Domain-Driven Design) and maintains independent deployability throughout the migration. You can test each extracted service in production while the monolith continues serving other features. If something goes wrong, you simply redirect traffic back to the monolith.

The routing layer becomes your control point—you can even do gradual rollouts (10% of traffic to new service, then 50%, then 100%).

Real-World Analogy

Think of renovating a house while living in it: you remodel one room at a time, moving furniture around a functional home, rather than demolishing everything and camping in the yard during a full rebuild.

Key Takeaway: The Strangler Fig Pattern enables low-risk, incremental migration from monolith to microservices by routing new features to independent services while the old system continues running, avoiding dangerous rewrites.