Skip to main content
Architecture
DevOps
Step-by-step guide
Updated Nov 2026

Monolith to Microservices Migration: A Step-by-Step Guide

When to split a monolith, where to draw service boundaries, and how to move code and data out one slice at a time, with a rollback path at every step.

Published November 23, 2026 · HostingX Solutions LLC

Short answer

  • Migrate for a named reason: teams blocked on a shared release, a component that must scale on its own, or ownership that no longer maps to the code. For tangled code, a modular monolith costs less.

  • Draw boundaries from the domain. Start from bounded contexts, and keep the first services coarse.

  • Strangle, don't rewrite. Put a routing facade in front of the monolith, move one capability at a time, and add an anti-corruption layer where old and new code still talk.

  • Move the data with each service. A shared database is a transitional state. Use sagas and a transactional outbox instead of distributed transactions.

  • A slice is done when the old code path is deleted, not when the new service is deployed.

This guide is for engineering leaders and architects at B2B companies whose monolith still earns money and has to keep shipping while it is taken apart. It follows the patterns as their authors describe them: Martin Fowler, Eric Evans, Chris Richardson, and the AWS and Microsoft architecture guidance built on their work. For the approach applied to legacy .NET and Java monoliths, see our monolith to microservices case study.

Should You Migrate to Microservices at All?

Microservices trade one kind of complexity for another. Fowler lists the costs: remote calls are slow and always at risk of failure, data spread across services becomes eventually consistent, and you need a mature operations team to run many services that are redeployed often. Richardson, who maintains microservices.io, states plainly that the monolithic architecture is not an anti-pattern.

Good reasons to migrate: several teams share one release train and one team's defect blocks the rest; one component needs to scale differently from everything else; a capability needs its own runtime, data store or compliance boundary. Weak reasons: "everyone is doing it" (Richardson lists "microservices as the goal" as an adoption anti-pattern), and messy code, which a network split turns into messy code with network failures.

The modular monolith alternative

Fowler notes that "it's perfectly possible to have firm module boundaries with a monolith, but it requires discipline." A modular monolith keeps one deployable unit but splits the code into domain modules, each with a public interface and its own tables, and uses build rules or architecture tests to block calls that bypass them. You get most of the design benefit without network calls or distributed data, and every clean module is a strangler fig candidate that is already half extracted. Our recommendation: if you can't name the delivery or scaling problem microservices will fix, modularize first.

Step 1: Find Service Boundaries with Domain-Driven Design

A bounded context, the central pattern of Evans's Domain-Driven Design, is a part of the domain with its own consistent model and vocabulary. Microsoft's Azure Architecture Center derives services from it:

  1. Start with a bounded context. A service generally shouldn't span more than one.

  2. Look at its aggregates. They come from business requirements, are cohesive, mark a boundary of persistence and are loosely coupled, which is what you want in a service.

  3. Adjust for team size, scaling, availability and security needs, which can split a service further or merge two.

Then validate: each service has a single responsibility, there are no chatty calls between services, no two services must be deployed together, and a small team can own each one. When in doubt, Microsoft advises starting coarse-grained, because splitting one service later is easier than refactoring functionality across several.

In an existing system, add evidence. AWS's prescriptive guidance names event storming as a technique for finding domain boundaries. Zhamak Dehghani, writing on Fowler's site, recommends using code history and the product roadmap to find capabilities that matter to the business and change often. Those are worth extracting; a module nobody has touched in years can stay where it is.

Step 2: Build the Platform Prerequisites First

In 2014 Fowler named three prerequisites: rapid provisioning, basic monitoring of both technical and business problems, and rapid deployment through a pipeline. Every extracted service adds something to deploy, watch and secure, so have these in place before the first slice:

  • CI/CD per service that deploys one service without redeploying anything else. See our CI/CD pipeline automation guide.

  • A runtime that schedules and heals services. Kubernetes is the common choice, but not a requirement: AWS's own strangler fig walkthrough moves services into AWS Lambda. See serverless modernization on AWS if that path fits.

  • Distributed tracing alongside centralized logs and metrics, which Microsoft recommends doing with OpenTelemetry. Without traces, a request that crosses several services fails somewhere you can't see. Our OpenTelemetry rollout guide sequences the work.

  • Service-to-service authentication. Microsoft recommends mutual TLS between services, role-based access control, and an API gateway that enforces policy at the edge.

  • A service template with the pipeline, health checks, tracing and deployment manifests already wired, so the second service costs less to stand up than the first.

Don't overbuild. Richardson also lists "focusing on technology", building deployment infrastructure while neglecting decomposition, as an anti-pattern. Build enough to ship the first slice well, then grow the platform with the migration.

Step 3: Put a Strangler Fig Facade in Front of the Monolith

Fowler named the pattern after strangler figs he saw in the Queensland rain forest in 2001, which grow around a host tree until they can stand on their own. The 2024 version of his article argues that the temporary code that lets old and new run side by side, which he calls transitional architecture, is worth its cost because it lowers risk. AWS and Microsoft describe the mechanics:

  1. Put a facade (a proxy) in front of the monolith. At first, it routes all traffic to the monolith.

  2. Build new features as services instead of in the monolith, but keep fixing the monolith's bugs.

  3. Extract one capability and route its requests, usually by URL path, to the new service.

  4. Repeat until the monolith serves nothing, then decommission it. Microsoft notes that you can then remove the facade or keep it as an adapter for legacy clients.

# Strangler fig facade: migrated paths go to new services,
# everything else still goes to the monolith.
upstream monolith        { server monolith.internal:8080; }
upstream billing_service { server billing.internal:8080; }

server {
  listen 80;

  # Slice 1: billing has moved. Rollback = delete this block and reload.
  location /api/billing/ {
    proxy_pass http://billing_service;
  }

  # Not migrated yet
  location / {
    proxy_pass http://monolith;
  }
}

The facade can be an API gateway, a reverse proxy such as NGINX or Envoy, or a Kubernetes ingress. AWS and Microsoft both warn that it can become a single point of failure or a performance bottleneck, so run it with redundancy. AWS's guidance used Migration Hub Refactor Spaces for this layer; AWS says Refactor Spaces closed to new customers on November 7, 2025, and points to AWS Transform instead.

Choose the first slice

Dehghani suggests warming up with a simple, fairly decoupled capability at the edge, such as end-user authentication, then favoring capabilities with few dependencies back into the monolith, and then those that matter to the business and change often. For a component the monolith calls in-process, Fowler's branch by abstraction works: put an abstraction in front of it, move callers onto the abstraction, swap in a client for the new service, and delete the old implementation.

Add an anti-corruption layer where old and new code still talk

Unmigrated monolith code will keep calling migrated features. The anti-corruption layer (ACL), first described by Evans, translates between the two models so the new service doesn't inherit legacy semantics. AWS's example is a class inside the monolith for each migrated service, such as a UserServiceAdapter, so existing callers don't know the implementation moved. It adds latency and operating overhead. Microsoft advises keeping business rules and orchestration out of it, and AWS says to decommission it once all dependent callers have been migrated.

Step 4: Decompose the Database

Dehghani's advice is to decouple vertically and release the data early. A service that still reads and writes the monolith's tables can't change or release independently, because the schema is a shared contract.

Treat a shared database as a transitional state

Richardson lists the costs of a shared database: schema changes need coordination across teams, and a long-running transaction in one service can lock data another service needs. That is tolerable while a slice stabilizes, not as the end state. The target is database per service: data private to the service and reachable only through its API. It can start as private tables or a schema per service, enforced with separate database users and grants so nobody bypasses the API.

Copy, sync, validate, cut over

Microsoft applies the strangler fig pattern to the database, one domain at a time. First, the new service still uses the monolith's tables for its domain. Next, an extract, transform and load (ETL) job copies history into the service's own database, and change data capture (CDC) keeps it in sync while you validate that the two agree. At cutover, the new database becomes the system of record, and the domain's tables and stored procedures are removed from the monolith.

Rollback stays cheap until that removal; afterward, it means restoring legacy objects and replaying changes. Make the removal a deliberate final step, taken after validation. If unmigrated code still needs the data, AWS describes the reverse flow: the service publishes an event on each update, and a synchronizing agent writes it to the monolith's database. AWS treats that as a tactical fix, because the copies are only eventually consistent.

Use sagas and an outbox instead of distributed transactions

Once two capabilities live in different databases, one ACID transaction can't span them, and Richardson's position is that two-phase commit is not an option. Two patterns replace it:

  • Saga: a sequence of local transactions, each committed inside one service, with compensating transactions that undo earlier steps when one fails. Microsoft's guidance is that choreography, where services react to each other's events, suits simple flows, while orchestration, where a central coordinator directs the steps, suits complex flows and avoids cyclic dependencies. Sagas lack isolation, so plan countermeasures such as semantic locks.

  • Transactional outbox: the service writes its event to an outbox table in the same local transaction as the data change, and a message relay publishes it to the broker. The relay can publish a message more than once, so consumers must be idempotent.

If almost every request needs a saga, the boundary is probably wrong. Microsoft notes that keeping data consistent sometimes means grouping related functionality into one service.

Step 5: Roll Out and Roll Back One Slice at a Time

  1. Deploy dark. The service runs in production behind the facade with no user traffic.

  2. Canary. Route a small subset of users, such as internal staff or a random sample. In Danilo Sato's description of canary release, rollback is simply rerouting users to the old version.

  3. Compare errors, latency and business signals, such as orders placed, on both paths.

  4. Ramp the remaining traffic in steps, keeping the monolith path deployable.

  5. Retire the old code path, the ACL routes and, after the data cutover, the legacy tables.

Dehghani calls this migrating in atomic evolutionary steps: a step is complete only when consumers are redirected and the old code is retired. Stopping at "both paths live" leaves two implementations of the same capability to maintain.

A Phased Migration Plan

PhaseWhat you doDone when
0. DecideName the delivery, scaling or ownership problem to fix. Check whether a modular monolith fixes it.A written problem statement and a go or no-go decision
1. Map the domainIdentify bounded contexts and aggregates, assign owning teams, rank candidate slices.A context map and an owner for slice one
2. Build the platformPer-service CI/CD, runtime, tracing, service-to-service auth, and a facade routing all traffic to the monolith.A trivial service in production through the pipeline, visible in traces
3. Extract a sliceBuild the service, add an ACL where the monolith still calls it, canary and ramp through the facade.All traffic on the new service; old code path deleted
4. Move its dataETL load, CDC sync, validation, cutover, then removal of the legacy tables.The service is the system of record; nothing else reads its tables
5. RepeatTake the next slice by business value and change frequency. Grow the platform as you go.Each slice meets the phase 3 and 4 exit criteria
6. DecommissionRemove the remaining ACLs and sync jobs, shut down the monolith, keep or remove the facade.The monolith and its database are off

Phases 3 and 4 repeat for every slice. Data work starts with each slice, not after all the code has moved.

Common Failure Modes

  • The distributed monolith. Richardson warns that getting decomposition wrong risks "a distributed monolith, which will slow down software delivery." If two services must be deployed together, the boundary is wrong. Shared tables and shared libraries, which Microsoft lists as an antipattern, are the usual causes.

  • Chatty calls. Every in-process call that becomes a network call is slower and can fail, and Microsoft reads chatty traffic between two services as a sign of tight coupling. Merge the services, make the calls coarser, or keep a local copy of the data the caller needs.

  • Splitting too early or too fine. In Monolith First, Fowler points out that moving functionality between services is much harder than moving it within a monolith, and that boundaries are hard to get right at the start. Dehghani's rule: go macro first, then micro.

  • Transitional architecture that never goes away. Facades, ACLs and sync jobs are meant to be temporary. Give each one an owner and a removal condition when you create it.

  • A new architecture on an old organization. Richardson's "Red Flag Law" anti-pattern is keeping the monolith's development process and team structure. Every service needs a team that owns it end to end.

How to Measure Migration Progress

Count outcomes, not services. The number of services written is the metric Richardson warns against. Track these instead:

  • Traffic share at the facade: routes and requests served by new services instead of the monolith.

  • Retired slices: capabilities whose old code path, ACL routes and legacy tables are deleted. This is the only count that shrinks the monolith.

  • Lockstep deployments: releases that needed two or more components to deploy together. The target is zero.

  • Shared tables that more than one component still reads or writes directly.

  • Cross-service calls per request, taken from traces for the main user journeys.

  • DORA metrics per service: change lead time, deployment frequency, change fail rate, failed deployment recovery time and deployment rework rate. Baseline them on the monolith before you start.

If traffic share and retired slices aren't moving, the migration has stalled, whatever the service count says.

Frequently Asked Questions

What is the strangler fig pattern?

A gradual way to replace a legacy system, named by Martin Fowler. A facade routes each request to the monolith or to a new service, capabilities move one at a time, and the monolith is decommissioned once nothing depends on it.

Should microservices share a database?

Not as an end state. Sharing the monolith's database is acceptable while a slice is migrated, but each service should end up owning its data, reachable only through its API.

Do you need Kubernetes to run microservices?

No. You need independent deployment, something that schedules services and recovers from failures, and observability across services. Kubernetes is the common choice; managed container services and AWS Lambda also work.

What is the difference between a modular monolith and microservices?

Both split code along domain lines. A modular monolith deploys as one unit and its modules call each other in-process. Microservices deploy independently, call each other over the network, and each owns its data.

Planning a monolith to microservices migration?

We help US businesses map service boundaries, build the CI/CD, Kubernetes and observability platform, and run the strangler fig migration one slice at a time. The first 30-minute consultation is free.

Sources

Related Articles

See also: DevOps & cloud services · Development services · Zero-downtime Kubernetes upgrades

HostingX Solutions LLC logo

HostingX Solutions LLC

FinOps, DevOps, and automation for US businesses.

info@hostingx.solutions

Subscribe to our newsletter

Get monthly email updates about improvements.


© 2026 HostingX Solutions LLC. All Rights Reserved.

LLC No. 0008072296 | Est. 2026 | New Mexico, USA

Legal

Terms of Service

Privacy Policy

Acceptable Use Policy

Security & Compliance

Security Policy

Service Level Agreement

Compliance & Certifications

Accessibility Statement

Privacy & Preferences

Cookie Policy

Manage Cookie Preferences

Data Subject Rights (DSAR)

Unsubscribe from Emails