ArchitectureIntermediate

Modular Monolith vs Microservices: The ADR That Matters

DeveloperHat Team
15 min read

TL;DR

Modular monolith or microservices? A decision-first guide: module boundaries, deployment, team size, and the extraction path — with the ADR most teams get wrong.

Most teams do not choose microservices. They drift into them — one service here for a new feature, another there because a team wanted its own deploy, and two years later a system that could have been one deployable is twenty services, a platform team, and a distributed debugging problem nobody budgeted for. The reverse drift happens too: a monolith that grew without internal boundaries becomes the "big ball of mud" everyone is afraid to touch, and the proposed cure is always the same — split it up.

Both drifts share one root cause: the architecture decision was never written down with its reasoning. This article is the decision record most teams skip. It covers the modular monolith, microservices, and the staged path between them — who each option is for, what each one costs, and how to reverse the choice when it stops fitting.

The short version: if one team ships the system on one release cadence, build a modular monolith with enforced internal boundaries. If several teams need to deploy independently and can pay for the platform that makes that safe, microservices earn their keep. If you are unsure, build the modular monolith and draw the extraction lines now — a clean module extracts in a sprint; a premature split does not un-split.

Same modules, different deployment — the boundary is the difference ONE DEPLOYABLE — MODULAR MONOLITH Orders module own code · own tests Billing module own code · own tests Catalog module own code · own tests MANY DEPLOYABLES — MICROSERVICES Orders service own repo · own deploy Billing service own repo · own deploy Catalog service own repo · own deploy Left: in-process calls, one transaction, one deploy. Right: the same calls over the network, with retries and versioning.

Context: why this decision keeps getting made badly

The microservices style, as Martin Fowler and James Lewis defined it in 2014, is a set of properties — independently deployable services, organized around business capability, smart endpoints and dumb pipes, decentralized governance and data — not a checklist you complete by having more than one service. A system with twelve services sharing one database and deploying together has the costs of microservices and none of the benefits. That is the most common failure mode, and it comes from choosing the style before understanding what problem it solves.

The problem microservices solve is organizational, not technical. They let independent teams move at their own speed: deploy without coordinating, scale one capability without scaling everything, choose different stacks where it matters, and contain a failure to one service. Conway's law runs in both directions — your architecture will mirror your communication structure whether you plan it or not — so when the org has many teams, the architecture eventually follows. The reverse is equally true: when the org is one team, a distributed architecture fights the org instead of serving it.

The modular monolith exists precisely for that second case. Simon Brown's formulation is simple: a single deployable, internally composed of modules with explicit boundaries, each owning its own code, tests, and data model, communicating through public interfaces rather than reaching into each other's internals. The boundaries are the architecture. A monolith without them is just a big ball of mud with a nicer name — and the difference between the two is enforced, not intended.

The decision also has a time dimension that most teams ignore. Architectures are not permanent, and the cheapest time to change your mind is before you pay the distributed-systems bill. Sam Newman made this point in 2015 in "Monolith First": start with a monolith, find the real seams in your domain by building the system, and split only the parts that have proven they need independence. The advice has aged well — the teams that regret microservices almost always adopted them before they knew where their seams were.

The options

Option 1: Modular monolith — one deployable, strict internal boundaries

One codebase, one deployable, one database. Inside, the system is divided into modules — Orders, Billing, Catalog, Inventory — each with a public interface and private internals. Modules call each other through interfaces or domain events, never by importing each other's internal classes. Each module has its own test suite, its own schema within the shared database, and an owner who can explain what it does and what it does not.

The honest strengths are mundane and large: a single transaction across modules, so a checkout that touches Orders and Billing either commits or rolls back as one; stack traces instead of distributed traces for most debugging; one deployment pipeline; no network latency, retries, or version skew between modules; and tests that run in seconds because they do not need a network. For a single team, this is usually the fastest way to ship a correct system.

The cost is discipline. The boundaries only exist if someone enforces them, and the person who enforces them is you — at code review time, and ideally in the build. Two tools do the enforcement well in the Java world: ArchUnit, which turns "module A may not depend on module B's internals" into a test that fails the build, and Spring Modulith, which verifies module structure, documents it, and can even split modules into separate deployables later. A test like this is the whole enforcement mechanism:

// This test fails the build the moment a module reaches into
// another module's internals. The boundary is now code, not a wiki page.
@AnalyzeClasses(packages = "com.shop")
class ModuleBoundariesTest {

    @Test
    void modulesOnlyDependOnPublicInterfaces() {
        ArchRule rule = ArchRuleDefinition.noClasses()
            .that().resideInAPackage("..orders.internal..")
            .should().dependOnClassesThat()
            .resideInAPackage("..billing.internal..");
        rule.check(importedClasses);
    }
}

The anti-pattern to avoid is the monolith with a diagram that shows modules and a codebase that ignores it. If a developer can import another module's internals and the build stays green, the boundary does not exist — and the day you try to extract a module, you will discover the coupling all at once, in production, instead of gradually, in tests.

The monolith, layer by layer — boundaries enforced in code, not by the network API edge — HTTP handlers · auth · rate limits Modules — Orders · Billing · Catalog · Inventory, each with own tests Module boundaries — public interfaces only, no cross-module imports Ports & adapters — repositories · domain events · external clients Persistence — one database, one transaction, a schema per module Enforce the middle layer with tests (ArchUnit / Spring Modulith) — a boundary nobody checks is not a boundary.

Option 2: Microservices — independent deployables per capability

Each business capability becomes its own service, its own repository, its own deployment, and — in the strict version — its own database. Services communicate over the network, usually HTTP or messaging, and each team can deploy, scale, and change its service without coordinating with the others. This is the architecture for organizations where independent movement is the bottleneck: many teams, many release trains, and a shared deploy that has become a negotiation.

The benefits are real when the precondition holds: a team can ship on Tuesday without waiting for another team's Friday; one hot service scales without scaling the whole system; a failure in the recommendations service degrades recommendations instead of taking down checkout; and different capabilities can use different stores or runtimes where that genuinely matters. Our event-driven microservices guide covers the messaging patterns that make services stay decoupled instead of turning into a distributed monolith, and our service mesh guide covers what the networking layer looks like once you have more than a handful of services.

The costs are equally real, and they are the reason this option should be chosen deliberately rather than by default. Every cross-service call is a network call: latency, timeouts, retries, partial failure, and eventual consistency where a monolith had a transaction. Debugging moves from stack traces to distributed traces. Data that was one JOIN becomes an API call or a replicated read model. Deployments become a version matrix — service A v3 talks to service B v2 — and the platform to run all of this (service discovery, observability, deployment automation, failure handling) is a product in itself, usually a team of its own. Durable execution becomes a real concern: a multi-step business process that was one function is now a workflow that can fail halfway, and someone has to own that.

The anti-pattern is the distributed monolith: services that deploy together, share a database, and call each other synchronously in chains — all the operational cost of microservices with the coupling of a monolith, and the worst debugging of both. If your services cannot deploy independently, you do not have microservices; you have a monolith that is harder to run.

Option 3: Monolith first, extract later — the staged path

This is not a compromise so much as the honest default for most teams. Build the modular monolith, but draw the module boundaries as if they were service boundaries: public interfaces, no shared tables across modules, domain events for cross-module communication where a synchronous call would create coupling. Then, when — and only when — a module proves it needs independence, extract it.

Extraction is a known sequence, not a rewrite. Give the module its own repository and deployment, put an API in front of it, move its schema to its own database, replace in-process calls with network calls, and handle the consistency gap the extraction creates (usually with events and an outbox, or by accepting eventual consistency where the business allows it). Because the boundary already existed in code, the work is mechanical. Teams that skip the boundary step and extract a tangled module instead discover the difference the expensive way.

The most cited real-world example is also the most misread one. Prime Video's audio-video monitoring service reported cutting its costs by about 90% after consolidating a distributed microservices design into a monolith — the overhead of passing state between services through S3 was the dominant cost, and removing the network hops removed it. That does not prove monoliths always win; it proves the architecture has to match the workload. A monitoring pipeline with heavy cross-component data flow is a bad fit for fine-grained services, and the team measured it rather than assuming it.

The comparison

Modular monolithMicroservices
DeployablesOneOne per service
Cross-module callIn-process, microsecondsNetwork, milliseconds + failure modes
TransactionsOne ACID transaction across modulesSagas / outbox / eventual consistency
DebuggingStack traces, one log streamDistributed traces, correlated logs
Independent deployNo — one release trainYes — per service, per team
Independent scalingNo — scale the whole thingYes — per service
Team shape it servesOne team, or a few teams sharing a trainMany teams needing independent movement
Platform costOne pipeline, one database to runService discovery, mesh, observability, deployment automation
Failure blast radiusThe whole deployableOne service (if bulkheads hold)
Extraction cost laterLow, if boundaries were enforcedN/A — already split
Risk of getting it wrongA tangled monolith — fixable in codeA distributed monolith — fixable only with a platform

Trade-offs

The monolith's risk is invisible until it is not. Coupling accumulates quietly: a shortcut import here, a shared table there, a cross-module query that seemed harmless. By the time the monolith feels painful, the boundaries are gone and the extraction everyone talks about is a rewrite. This is why the enforcement step is not optional decoration — without a test that fails the build, a modular monolith decays into a big ball of mud on a predictable schedule. Budget the discipline, or do not claim the architecture.

Microservices' risk is visible immediately, in the bill. The platform, the observability, the deployment automation, the on-call load for N services instead of one — these costs arrive in the first quarter, while the benefits (independent movement) only pay off once teams actually move independently. A five-person team running fifteen services is paying the distributed-systems tax without collecting the organizational benefit. And the failure modes are new kinds of failure: a service that is up but unreachable, a version skew between two services that passed their own tests, a saga stuck halfway through a checkout.

Consistency is the trade-off that decides most cases. If your core flows need atomicity — money moving, inventory decrementing with an order, a booking that must not double-book — a monolith gives it to you for free and microservices make you build it. Sagas, outboxes, and idempotency keys are real engineering, and they are the part of a microservices migration that teams underestimate most. If your flows are naturally independent — recommendations, search indexing, notifications — the consistency cost is small and the independence benefit is large.

Team size is the strongest signal, and it is not a magic number. There is no threshold where a monolith stops working, but the pattern is consistent: below roughly a dozen engineers shipping one product, a modular monolith is almost always faster; above several teams with genuinely different release needs, microservices start paying for themselves; in between, the staged path is the right answer. Treat any specific number as a rule of thumb, not a law — the real question is how many independent release trains you need, not how many people you have.

Recommendation

For most teams starting a new system in late 2026: build a modular monolith, enforce the boundaries in the build, and extract only when a module proves it needs independence.

Decide by team shape and deploy independence, not by fashion How many teams ship? count independent releases One team, one train single release cadence 2–3 teams, shared dates some friction, some scale Many teams, own deploys deploys must not block Modular monolith extract later if needed Modular monolith draw extraction lines now Microservices pay the platform cost If the answer changes in a year, a modular monolith extracts cleanly. A premature split does not un-split.

If one team owns the system and ships on one cadence, the modular monolith is the answer — the fastest path to a correct system, the cheapest to operate, and the easiest to change. Spend the effort you saved on boundary enforcement and tests, not on a platform.

If two or three teams share the system, still start modular — but draw the extraction lines now. Pick the modules most likely to split (usually the ones with different scaling needs or different data), keep their tables separate, and communicate across the likely seam with events. The day a team needs its own deploy, the extraction is a project, not a rewrite.

If many teams need independent deploys and you can staff the platform, go microservices — and go all the way. Separate databases, asynchronous communication where you can, and the observability and deployment automation budgeted as a first-class product. Halfway microservices are the worst of both worlds.

Architecture Decision

>

Decision: Build the system as a modular monolith with build-enforced module boundaries; extract services only when a module demonstrates a need for independent deployment or scaling.

>

Context: One product team owns the system today, with a second team joining within a year. Core flows (checkout, billing, inventory) require atomicity. There is no platform team, and no appetite to staff one.

>

Options considered: (a) Modular monolith with ArchUnit/Spring Modulith boundary tests. (b) Microservices from day one, one service per bounded context. (c) Big ball of mud — no enforced boundaries, split later "when it hurts."

>

Why this one: Option (a) gives the team the fastest path to a correct system and preserves every future option — a module with enforced boundaries extracts cleanly. Option (b) pays the distributed-systems cost before any team needs independent movement. Option (c) is how extraction becomes a rewrite.

>

What it costs you: One release train — the whole system deploys together, so a change to one module ships with all of them. A single database to scale, and no independent scaling of hot modules. Cross-module transactions are easy, which can hide coupling if the boundary tests are ever relaxed.

>

When to reverse it: When a module needs to deploy on its own cadence (its team is blocked by the shared train more than once a sprint), when one module's scaling or compliance needs diverge sharply from the rest, or when a module's failure must be isolated from the system. The reversal trigger is measured — deploy friction, not fashion.

When not to use each option

Do not use a modular monolith when teams genuinely cannot coordinate releases — if three teams are blocked by each other's deploys every sprint, the shared train is the bottleneck, and no amount of module discipline fixes an organizational problem with a code solution.

Do not use microservices when one team owns the whole system. The platform cost, the debugging cost, and the consistency engineering buy you independence nobody is using. This is the single most common architecture mistake in small teams, and it is made with the best intentions.

Do not use either when the domain is still unknown. If you cannot name the bounded contexts yet, you cannot draw module boundaries or service boundaries correctly — build the simplest thing that works, find the seams by shipping, and let the architecture follow the domain. That is the actual content of "monolith first": not a preference for monoliths, but a refusal to carve boundaries before the domain has shown you where they are.

And do not split a monolith to fix a team problem, or merge services to fix a platform problem. Architecture decisions are organizational decisions wearing a technical costume. If the real problem is that two teams cannot agree on a release process, services will not fix it. If the real problem is that your platform cannot run fifteen services reliably, a monolith will not fix it either — it will hide it until the monolith is the thing that cannot be deployed.

What to do next

This week, write the decision down before you write the code:

  • [ ] Count the independent release trains your org actually needs — not the ones you might need, the ones you have
  • [ ] If the answer is one, scaffold a modular monolith and add a boundary test on day one, before the first shortcut is tempting
  • [ ] Name the modules and their public interfaces; give each one an owner, a test suite, and its own schema
  • [ ] List the modules most likely to extract later and mark the seam — events across it, no shared tables
  • [ ] Revisit the decision every six months with one question: is the shared release train still the constraint, or is it now the bottleneck?
  • Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.