Insights · Modernization

Modular monoliths: the default architecture, not the consolation prize

MicroservicesStrangler fig

Key takeaway

Build a modular monolith by default: one deployable, enforced boundaries, clean seams. Extract services only where the premium pays.

The industry ran the experiment most teams are still considering. Amazon’s Prime Video moved a monitoring service from distributed serverless components to a single process and “reduced our infrastructure cost by over 90%” — orchestration step functions hit account limits at a fraction of expected load, and per-frame data transfer between services was the real bill. Segment consolidated “the now over 140 services into a single service” after operational overhead grew linearly with every destination added and three engineers were occupied “just keeping the system alive”. Neither story says microservices are wrong; both say the premium is real and must be bought deliberately, not by default.

The premium, and who pays it

Martin Fowler named the trade-off precisely in MicroservicePremium: microservices charge a toll — automated deployment, monitoring, failure handling, eventual consistency — and the toll is worth paying only when two factors are large: the complexity of the system itself (“the biggest factor is that of sheer size”) and the size of the organization, because designs mirror communication structures. His conclusion is the one most architectures should start from: “don’t even consider microservices unless you have a system that’s too complex to manage as a monolith,” and “the majority of software systems should be built as a single monolithic application.”

Conway’s 1968 paper — the source of the law — supplies the organizational math: “the number of possible communication paths in an organization is approximately half the square of the number of people.” The service count and the communication path count grow together; splitting a system a small team owns multiplies the coordination burden without multiplying the team.

The boundary problem microservices don’t solve

The uncomfortable finding in MonolithFirst is that boundaries are hard to know early: “even experienced architects working in familiar domains have great difficulty getting boundaries right at the beginning.” Microservices don’t remove that difficulty — they freeze it into network contracts, where refactoring across a boundary is “much harder than it is in a monolith.” Premature service splits are YAGNI applied to architecture: the cost arrives quarterly, forever.

A modular monolith keeps the boundary question revisable. Modules are the unit of ownership and change; the deployable stays one; and the seams are refactored in-process until the domain proves them. Sam Newman’s greenfield advice is the operating instruction: “it is much easier to partition an existing, ‘brownfield’ system than to do so up front” — so “only split around those boundaries that are very clear at the beginning, and keep the rest on the more monolithic side,” keeping module boundaries and database schemas separate inside the monolith precisely to ease later splitting.

What makes a monolith modular

“Modular” is a contract, not a folder structure. The rule set that the well-known Modular Monolith with DDD reference implementation encodes is the canonical list:

  • Modules communicate through contracts and events — not by reaching into each other’s internals. “Direct method calls are not allowed” between modules in the strict variant; dependencies point only at the integration-events surface of another module.
  • Each module owns its data. “Each Module has its own data in a separate schema — shared data is not allowed.” This single rule is what keeps extraction possible: no cross-module joins to unwind later, and it is exactly the anti-pattern behind why monolith migrations fail at the data layer.
  • Integration is asynchronous where domains are independent, via in-process events first and the event backbone when modules become services — the same event contract, different transport.
  • One module, one bounded context. The DDD carving defines the modules; the modules don’t invent their own.

Enforcement: boundaries that fail the build

A boundary nobody enforces is a suggestion. The tooling exists and is boring, which is the compliment: Spring Modulith’s verification API runs ApplicationModules.of(Application.class).verify() and “throws an exception in case of any architectural violation” — cyclic dependencies between modules, access outside another module’s API packages, dependencies not on the declared allow-list. Wired into CI, an illegal coupling fails the pull request the same way a broken test does. The equivalent discipline on other stacks is ArchUnit-style architecture tests; the principle is identical — the module map is a test suite.

What the evidence supports

The academic record is young but directionally clear. Faustino, Gonçalves, Portela and Rito Silva measured a two-step migration from monolith to microservices and found the effort and performance costs are already substantial at the modular-monolith step — which is the point: making it a decision point, not a consolation stage. A 2024 systematic review of grey literature (Su & Li) — prompted in part by Google’s Service Weaver — positions the modular monolith as a recognized architecture “that combines the advantages of monoliths with microservices,” with frameworks and case studies behind it, not merely a migration waystation. And DHH’s Majestic Monolith contributes the quality argument from the small-team side: a single system “presumes that the people who work on it also understand it,” putting “immense pressure on making the application understandable and changeable.”

The extraction path: when to actually split

Extract a module into a service when at least two of these hold — and record the decision (an ADR, before traffic moves):

  1. The module’s scaling profile diverges from the rest of the system (compute-heavy batch beside latency-sensitive interactive).
  2. Its release cadence diverges — the module changes daily while the monolith ships monthly, and the coupling forces co-releases.
  3. A separate team owns it, and the communication-path math says the shared codebase now costs more than the service boundary would.
  4. The failure domain must be isolated — a misbehaving module that takes down unrelated capabilities.

Because the module already has its own schema and contract, extraction is mechanical: move the data, replace the in-process event bus with the backbone, put the module’s interface behind the network. Newman’s Monolith to Microservices is the playbook for that day — strangler fig, branch by abstraction, parallel run, table splitting — and the strangler fig article on this site covers the traffic and data choreography. Teams that skipped the modular step discover that day arrives anyway, with the data entanglement they were warned about.

Rule of thumb

Build the modular monolith. Split a module when scale, cadence, ownership or failure isolation demands it — and only then. The burden of proof sits with the extraction, never with the boundary.

Review your modularity

Sources