You can move from a monolith to microservices without downtime by extracting one capability at a time behind a routing layer (the strangler fig pattern), moving its data with change data capture or the outbox pattern rather than ad hoc dual writes, and shipping each step behind feature flags with a rehearsed rollback. Before any of that, check that you should split at all: many problems blamed on the monolith are fixed more cheaply by modularising it.

This guide walks through the decision, the techniques and a phased plan, written for teams that cannot freeze product work while the migration happens.

When should you not move from a monolith to microservices?

A microservices architecture buys independent deployment and scaling at the cost of network calls, distributed data, more infrastructure and harder debugging. That trade is worth it only if the benefits are real for your situation.

Reasons to hold off:

  • One or two teams work on the codebase. Coordination costs are low, and services add operational overhead without removing much friction.
  • Domain boundaries are still moving. Early products reshape their domain often; service boundaries drawn now will be wrong later and are expensive to redraw.
  • The pain is somewhere else. Slow tests, a fragile deployment pipeline or one expensive query will follow you into services.
  • Observability and CI/CD are immature. Distributed systems magnify both gaps.

A modular monolith, a single deployable with enforced boundaries between internal modules, is often the better next step. It gives you clean ownership and testability, and its modules become natural candidates for extraction later.

Signals that a split is justified: parts of the system need to scale very differently, teams block each other on releases, a component needs isolation for fault tolerance or compliance, or a capability needs a different runtime or data store.

How do you find the seams in a monolith?

A seam is a place where you can separate one part of the system from the rest without rewriting its surroundings. The best seams follow domain boundaries: areas of the business with their own language, rules and data, often called bounded contexts.

Ways to find them:

  • Map the domain with the people who run it. Walk through key business flows and note where responsibility and vocabulary change.
  • Read the version-control history. Files that always change together belong together; files that rarely co-change are candidates for separation.
  • Map data access. For each module, list the tables it reads and writes. Shared tables are where extraction will hurt.
  • Look at the dependency graph of modules and packages for clusters with few inbound dependencies.

Choose the first extraction for learning, not glory. Good first candidates are capabilities with clear ownership, few dependencies and contained data, such as notifications, document generation, search indexing or reporting. Leave the most entangled core flows until the team, tooling and patterns are proven.

How does the strangler fig pattern work?

The strangler fig pattern replaces a legacy system gradually by routing specific requests to new services until the old code handles nothing and can be removed. It is the standard way to migrate a monolith without downtime, because every step is small and reversible.

  1. Introduce a routing layer (a reverse proxy, API gateway or edge router) in front of the monolith, with no change in behaviour. Prove it adds no errors and acceptable latency.
  2. Build the new service for one capability, behind an anti-corruption layer, a translation layer that stops the monolith’s data model leaking into the new service.
  3. Dark-launch it. Mirror real traffic to the new service and compare its responses with the monolith’s, without returning them to users.
  4. Route a small slice of real traffic, by internal users, by tenant or by percentage, controlled by a flag.
  5. Ramp up while watching error rates, latency and business metrics.
  6. Remove the old code path once the new service has carried full traffic through a stable period.

Calls from inside the monolith to the extracted capability need the same treatment: replace the in-process call with a client behind an interface, so you can switch implementations with a flag.

How do you split the database without downtime?

Database decomposition is where most migrations stall. The goal is for each service to own its data, but you cannot stop writes while you move it. These are the main techniques, often used in combination.

Technique What it does Pitfalls Use when
Shared database (temporary) New service reads and writes the monolith’s tables Keeps tight coupling; schema changes break both sides As a short stepping stone only
Change data capture (CDC) Streams row-level changes from the database log to consumers Schema changes must be handled; consumers see low-level events Populating a new store while the monolith is still the source of truth
Dual writes Application writes to both old and new stores No shared transaction; partial failures and ordering cause drift Rarely, with reconciliation and a single source of truth
Outbox pattern Writes the change and an event to an outbox table in one transaction; a relay publishes it At-least-once delivery requires idempotent consumers; outbox needs cleanup Publishing reliable domain events from a service or the monolith
Backfill and verify Copies historical data, then compares counts and checksums Long-running jobs; must not starve production Before any change of ownership

Change data capture is the process of reading a database’s change log and publishing each insert, update and delete as an event. It lets you build and continuously update the new service’s store from the monolith without touching the monolith’s write path.

Dual writes deserve particular caution. If the process crashes between the two writes, or one times out and is retried, the stores diverge, and concurrent requests can apply changes in a different order in each. Teams that rely on dual writes without reconciliation usually discover the drift months later.

The outbox pattern solves the same problem properly: the business change and the event describing it commit in one local transaction, and a relay (often driven by CDC on the outbox table) publishes events afterwards. Consumers must be idempotent, because delivery is at least once.

A typical sequence for one capability: backfill the new store, keep it in sync with CDC, run continuous reconciliation, switch reads to the new service, then flip write ownership. After the flip, the monolith reads through the service’s API or a replicated read model. Use expand and contract schema changes throughout: add new structures first, migrate callers, and remove old structures only when nothing uses them.

How do feature flags and dark launches reduce risk?

A feature flag is a runtime switch that changes behaviour or routing without a deployment. In a microservices migration, flags are your steering wheel and your brake.

  • Kill switch: send all traffic back to the monolith instantly.
  • Targeted rollout: route internal users, one tenant or a percentage of requests.
  • Read and write separation: move reads to the new service before writes.

A dark launch sends production traffic to the new path without exposing the result. For reads, compare responses and log differences. For writes, be careful: shadow writes can trigger real side effects such as emails, payments or webhooks. Run the new service in a dry-run mode or point side effects at isolated sinks. Remove flags once a step is complete, or they become a second source of complexity.

Why should observability come first?

If you cannot measure the monolith’s behaviour today, you cannot show the new service is no worse. Before the first extraction:

  • Record baselines for the capability: request rates, latency percentiles, error rates and the business metrics it drives.
  • Add distributed tracing with context propagated through the routing layer, the monolith and every new service.
  • Standardise structured logs with correlation IDs.
  • Define service level objectives (SLOs), explicit targets for reliability and latency, and use them as ramp-up and rollback criteria.
  • Build comparison dashboards that show old and new paths side by side during rollout.

What does a rollback plan look like?

Every step should be reversible until you deliberately decide it is not. Write the plan before you start, not during an incident.

  • Routing rollback: a flag flip back to the monolith, rehearsed in production on a small slice.
  • Code rollback: keep the old path deployable until the new service has been stable at full traffic.
  • Data rollback: once the new service owns writes, rolling back means syncing its changes back to the monolith, for example with reverse CDC. If you will not build that, name the point of no return explicitly and raise the bar for crossing it.
  • Rollback criteria agreed in advance: SLO breaches, reconciliation mismatches above zero for money or orders, or a rise in support tickets.

How should teams be organised around the new services?

Conway’s law observes that systems tend to mirror the communication structure of the organisation that builds them. Plan team ownership alongside service boundaries, or the architecture will drift back towards the organisation chart.

  • Product-aligned teams own services end to end: code, data, deployment and on-call.
  • A platform team provides the paved road: service templates, CI/CD, observability and the routing layer.
  • Avoid two teams changing the same capability at once. Whether the extraction is done by an internal team or an outside partner, agree a change freeze or a single owner for each capability while it is being extracted.
  • Avoid tiny services owned by one engineer each. A team should own a coherent set of capabilities.

What does a phased microservices migration plan look like?

The plan below delivers value at every phase and lets you stop after any of them with a better system than you started with.

Phase Goal Exit criteria
0. Decide Confirm the business case; consider a modular monolith first Agreed goals, metrics and first candidate
1. Foundations Routing layer, CI/CD for services, tracing, flags, event infrastructure Routing layer in production with no behaviour change
2. First extraction Strangle one low-risk capability end to end Full traffic on the new service; old code removed
3. Data ownership Move the capability’s data with backfill, CDC and reconciliation New service owns writes; reconciliation clean
4. Repeat Extract higher-value capabilities using proven patterns Each extraction meets its own exit criteria
5. Decommission Remove dead code, tables, flags and sync jobs Nothing reads or writes the retired paths

Hold a short retrospective after phase 2. The first extraction will expose gaps in tooling, testing and ownership that are far cheaper to fix before the second.

Where does NexaPrism fit in a migration?

A monolith migration breaks into phases with clear exit criteria, which makes each phase a sensible unit of work to hand to an outside team. NexaPrism takes on a defined phase, such as the foundations, a single extraction or moving a capability’s data, and delivers it end to end with senior engineers in backend and distributed systems and cloud and platform engineering. A senior engineer reviews the problem; we agree scope, deliverables, timeline and price with you before work starts; then a lead engineer and senior engineers build it in your repositories and on your infrastructure, show working software every week and hand it over documented. The next phase is scoped separately if you want it.

Patterns such as idempotent consumers and reconciliation matter most where money moves; our fintech engineering guide covers them in depth. To scope a migration phase, get in touch.