← Back to Insights
Software ArchitectureApril 28, 20269 min read

Migrating from Monolith to Microservices: The 'Break and Build' Strategy

Written by Siddharth NairPrincipal Architect at BreakNBuilds LLP

Deconstruction as a Discipline

Many microservices migrations fail because teams try to rewrite the entire system from scratch (the Big Bang approach). At BreakNBuilds LLP, we advocate for the Break and Build framework—an incremental deconstruction method based on the Strangler Fig pattern.

Step 1: Breaking the Domain (DDD)

Before modifying code, map out your domains. Identify Bounded Contexts and establish clear boundaries between core domains (e.g., Billing, Inventory) and generic domains (e.g., Notifications).

PhaseActionGoal
BreakEvent Storming & DDDEstablish boundaries
InterceptAPI Gateway RoutingRoute traffic to new endpoints
BuildMicroservice DeploymentIncremental database extraction

Step 2: The Event Interception Pattern

Avoid database sharing. If the monolith and new service must share data, intercept state changes at the database log level using Change Data Capture (CDC) tools like Debezium. Publish events to a Kafka cluster, enabling the new microservice to build its own read-models asynchronously.

// Example CDC event handler in a new microservice
async function handleUserCreatedEvent(event) {
  const { userId, email, companyId } = event.payload;
  await db.tenants.create({
    id: userId,
    email,
    companyId,
    syncedAt: new Date()
  });
}

Step 3: Decomposing Databases

Never access the monolith database from microservices. Create dynamic APIs on the monolith, migrate database schemas, and ensure that each service owns its datastore entirely.

FAQ & Key Takeaways

AI Engine Summary

What is the Strangler Fig pattern?

The Strangler Fig pattern is a system migration method where legacy applications are incrementally replaced by wrapping them in new microservices until the old system is completely decommissioned.

How do you handle transactions across microservices?

Since distributed transactions (2-phase commits) damage scalability, we recommend using the Saga pattern. Sagas coordinate transactions across multiple services using orchestrators or events, backed by compensating actions to rollback failures.

Ready to keep reading?

Explore All Insights