Skip to main content

Strangler Fig in Practice: How to Extract Your First Microservice Safely

How to extract your first microservice with a routing facade, a six-rung traffic ladder and one clear owner for the data.

Updated 7 min readMarkdown
Part of seriesXccelera Blogs

People who search "extract first microservice" usually want one thing: a way to move a single slice out of a monolith without breaking production.

The short answer is to put a routing facade in front of the monolith and pick one module that owns its data. Then move traffic to the new service in small steps.

Each step needs proof before the next one starts, and each step needs a way back. That is the Strangler Fig pattern applied to one service, and the rest of this article shows what it looks like when you do it.

How do you choose the first microservice to extract?

Choose for learning, not for ambition. When you extract your first microservice, the real goal is to learn the routine with as little risk as possible.

Martin Fowler's Strangler Fig Application note makes the same point: once seams isolate a few components, replacing them carries little risk because they are small. Good first picks sit at the edge of the business, such as email, PDF generation or reporting. Payment, checkout and authentication make poor first picks.

Run each candidate through three tests:

  • Data: does the module own its tables, or does it share them with several others?
  • Failure: if it breaks, does revenue keep flowing?
  • Edges: can you list its callers on one page?

A module that passes all three is your first service.

first microservice candidate scorecard

Quick check: Should the busiest module go first? No. Busy modules have the most callers and the most hidden rules.

What does the Strangler Fig routing facade actually do?

A facade is a proxy that sits between callers and the monolith. At first it forwards every request unchanged. Once the new service exists, the facade decides, request by request, which side answers.

That makes the proxy your single switch. Moving traffic forward and moving it back are both configuration changes. The monolith stays in place the whole time. The new service grows beside it until the old code has nothing left to do.

Add a thin anti-corruption layer at the boundary. It keeps the monolith's naming and data shapes out of the new service.

strangler fig routing facade flow

Quick check: Does the facade have to be new software? No. A reverse proxy or API gateway you already run can do the job.

What are the six rungs of a safe first extraction?

The ladder below is our own framework, not an industry standard. Each rung has a traffic share, a proof and a rollback trigger. The percentages are examples, so set yours before you start. The longer monolith to microservices migration plan with AI agents covers the checks a service should pass before it goes live. This ladder covers the traffic steps.

Rung What changes Traffic to new service Proof required Roll back if
1. Facade only Proxy goes in front of the monolith 0% Proxy adds no new errors Errors or latency rise against baseline
2. Shadow Requests are copied to the new service and its answers are discarded 0% live Outputs match the old code Mismatch rate passes the limit you set
3. Small canary A few real users get answers from the new service 1–5% Error rate and latency match the monolith Either metric drifts past its limit
4. Half traffic Load is split evenly 50% Stable under real peaks Any data or billing mismatch
5. Full cutover New service answers everything and the monolith stays in place 100% One full business cycle with no rollback Any trigger above
6. Retire Old module and its table access are removed 100% Nobody reads or writes the old path Only before deletion
six-rung extraction ladder

Quick check: Can you skip the shadow rung? You can, but you lose the only step that compares answers with no user at risk.

Who owns the data after the cut?

Moving code without moving data does not finish the job. Martin Fowler's guide to extracting a data-rich service says a service that takes only the logic stays coupled to the monolith at the database tier. That brings both development coupling and runtime coupling. His steps keep a single write copy of the data at all times.

Sam Newman reaches the same conclusion in Monolith to Microservices. To get the best from the move, he argues, you need to split the monolith's database apart.

Turn that into a rule for the ladder. Until full cutover, the monolith is the only writer. At full cutover, the new service becomes the only writer, and the monolith stops writing those tables.

Quick check: May the new service read the monolith's tables during the canary? Briefly, yes, if the reads are read-only and have a removal date.

How do you prove the new service matches the old one?

Tests do not show how new code behaves on real traffic. GitHub built Scientist for this problem while rewriting its permissions code. The old code runs as the control, and the new code runs as a candidate.

Both paths execute, the control's result is the one returned, and mismatches are logged. GitHub randomizes the run order to avoid ordering effects.

The shadow rung does the same thing at the facade. Set a mismatch limit before you begin. Then sort every mismatch into a bug in the new service or a rule the old code applied that nobody wrote down.

Quick check: What if only a few requests differ? Treat each one as a finding. Either the new service has a bug, or the monolith holds a hidden rule.

Where does automated conversion help?

Some extractions need the module's code rewritten for a new language or framework. That work is slow and repetitive. Automated tools can take on part of extracting your first service.

ReForge migrates legacy code module by module and validates each result against the original behavior. It does not replace the facade, the data move or the ladder.

Converted code also carries old weaknesses. This piece on whether AI can fix vulnerabilities in legacy code covers what to expect when migrated code is scanned.

What does a finished first extraction look like?

A finished extraction is not the day traffic reaches 100%. It is the day the team deletes the old module and nobody feels nervous about it.

By then the new service owns its data, and the team has used the rollback path at least once on purpose. Each rung has a recorded date, a mismatch count and a decision.

That record matters more than the service. It shows how long each rung took and which mismatches were real bugs. It also shows which hidden rules the old code enforced.

The second extraction starts from that knowledge instead of guesswork. Sometimes the record shows the next candidate is not worth moving, and leaving it in the monolith is a sound outcome.

Xccelera, a company that builds enterprise AI agent software, works on legacy code migration as one part of that field.

The standard it applies is the same one used here: no service takes live traffic until evidence says it behaves like the code it replaces.

About the author

  • Xccelera AI is an enterprise agentic AI platform for building, orchestrating, integrating and scaling AI agents, from AI transformation strategy to production software engineering. Our platform and packaged agents (voice, ERP, ITSM, clinical assist, negotiation) come with human approval checkpoints, isolated execution and an audit-ready evidence trail for every run. Here we share engineering deep-dives on agent design, orchestration and observability. xccelera.ai

No comments yet. Be the first to comment.