Back to blog

Monolith to Microservices: Migration Architecture Diagrams (2026)

How to document a monolith-to-microservices migration with architecture diagrams. Covers the strangler fig pattern, domain decomposition, data decoupling, and prompt templates.

R
Ryan·Senior AI Engineer
·

Documenting a monolith-to-microservices migration with architecture diagrams is one of the highest-stakes diagramming exercises an engineering team will undertake. The migration is never a single cutover — it's a series of incremental extractions, each with its own diagram showing the before state, the interim strangler state, and the target microservice state.

This guide explains how to diagram each phase of a migration, covers the most important patterns (strangler fig, anti-corruption layer, database decomposition), and provides prompt templates for generating accurate migration diagrams in seconds.

Why monolith-to-microservices needs three diagrams

Every service extraction goes through three states that each need a diagram:

  • Current state (monolith): The starting point. One deployable unit, one database, one codebase. Show the monolith as a single box with internal modules (User, Orders, Inventory, Payments) visible inside it. Show the shared database and any direct database access from other systems.
  • Interim state (strangler): The transitional architecture during extraction. The new microservice exists alongside the monolith. A proxy/API gateway routes some traffic to the new service and the rest to the monolith. The new service may still share the monolith's database or have its own.
  • Target state (microservice): The extracted service is fully independent — its own deployable, its own database, its own team. The monolith no longer owns that domain. The proxy routes 100% of relevant traffic to the new service.

Prompt templates for migration diagrams

Current state: modular monolith

"Modular monolith architecture: a single Rails application deployed as one process on Heroku. Internal modules: Auth, Users, Orders, Products, Inventory, Notifications, and Billing. All modules share a single PostgreSQL database with one schema. A background job worker (Sidekiq) runs as a separate dyno but shares the same codebase. An Elasticsearch index is updated by the Products module via direct write. A Stripe integration is called by the Billing module. An admin panel (ActiveAdmin) accesses the same database directly. Show the monolith boundary with internal modules, shared PostgreSQL, Sidekiq worker, Elasticsearch, Stripe, and the admin panel."

Strangler fig: extracting the Orders service

"Strangler fig migration: extracting the Orders service from the Rails monolith. An Nginx proxy sits in front of both systems. Requests to /api/orders are routed to the new Orders Service (Node.js/Express). All other requests go to the monolith. The Orders Service has its own PostgreSQL database (orders schema, migrated from the monolith). The monolith still calls Order data via an internal HTTP client to the Orders Service (not direct DB access) — anti-corruption layer. The Orders Service publishes order events to an SQS queue; the Notifications module in the monolith subscribes to fulfillment events. Show both systems, the Nginx proxy, the routing split, the Orders DB, the internal HTTP call from monolith to Orders Service, and the SQS event bus."

Database decomposition: shared database to separate databases

"Database decomposition migration for the Inventory domain. Phase 1: Inventory tables are moved to a separate PostgreSQL schema in the same database instance (logical separation). The monolith accesses the inventory schema via a dedicated InventoryRepository class. Phase 2: The Inventory Service is extracted as a separate service pointing to the same database but a different schema (schema-per-service). Phase 3: The Inventory schema is migrated to a dedicated PostgreSQL instance. A dual-write period (6 weeks) writes to both the old monolith table and the new Inventory Service table, with a dark-read comparison job to verify consistency. Show all three phases as separate architecture states, with the dual-write and consistency check highlighted in phase 3."

Event-driven decoupling with the Saga pattern

"Post-migration microservice architecture using a choreography-based Saga for order fulfillment. Services: Order Service, Inventory Service, Payment Service, and Notification Service. Each service has its own database (PostgreSQL for Orders and Inventory, Stripe as the payment source of truth, SendGrid for Notifications). Services communicate via Kafka topics. Order placed event triggers inventory reservation. Inventory reserved event triggers payment charge. Payment charged event triggers order confirmation email. Any failure triggers a compensating transaction (e.g., inventory release on payment failure). A Saga orchestrator (Temporal workflow) coordinates the happy path and compensating transactions. Show all four services, their databases, Kafka topics, and the Temporal orchestrator with the happy path and one compensating transaction."

Migration pattern reference

PatternWhat it solvesDiagram element to show
Strangler FigIncremental extraction alongside monolithProxy routing split between old and new
Anti-Corruption LayerInsulating new service from monolith domain modelAdapter/translator between service and monolith API
Database-per-ServiceDecoupling data ownershipSeparate DB box per service, no shared schema
Event SourcingAudit trail and state reconstructionEvent store as primary DB, projections as read models
CQRSSeparate read and write modelsCommand path and query path as separate flows
SagaDistributed transactions without 2PCEvent chain with compensating transaction arrows

Frequently asked questions about monolith migration diagrams

What is the strangler fig pattern?

The strangler fig pattern (named after a vine that grows around a tree until it replaces it) incrementally routes functionality from a legacy system to a new system by placing a proxy in front of both. Traffic is gradually shifted from the old system to the new one, one domain at a time, until the monolith handles no traffic and can be decommissioned. In your architecture diagram, show the proxy as a central node with percentage annotations on each route indicating how much traffic goes to each system.

How do I diagram the database decomposition phase?

Use three side-by-side diagrams labeled Phase 1, 2, and 3. Phase 1: a single database with schema boundaries drawn inside it. Phase 2: same database instance but separate schemas accessed by separate services. Phase 3: fully separate database instances. Include a timeline or migration arrow between diagrams. The dual-write comparison job (dark reading) should appear during the Phase 2 to Phase 3 transition.

Should I migrate to microservices or modular monolith first?

A modular monolith — a single deployable with clear internal module boundaries — is often the right intermediate step before full microservice extraction. If your monolith already has clean module boundaries, the extraction to separate services is much lower risk. Diagram your internal module boundaries first; if they're unclear, spend time clarifying them before splitting services. An unclear modular diagram usually means an unclear domain model, which produces poorly designed microservices.

Related guides: microservice architecture patterns, event-driven architecture, software architecture patterns, and microservice architecture use case.

Ready to try it yourself?

Start Creating - Free