Web apps & software

What is a modular monolith?

A modular monolith is a single application, deployed as one unit, whose code is divided into independent modules, such as billing, bookings and users, that talk to each other only through defined interfaces. It aims for microservice-style boundaries without microservice-style operations.

How it differs from a plain monolith

In a typical monolith, any part of the code can reach into any table or class, and over time everything depends on everything. A modular monolith enforces rules: each module owns its data, exposes a small public API, and other modules may not read its tables directly. Tools such as architecture tests, package visibility rules or separate folders with lint checks keep those boundaries honest.

  • One deployment, one database server, one log stream: far simpler to run than a fleet of services.
  • Calls between modules are function calls, so there is no network latency or partial failure to handle.
  • Refactoring across modules is easy while the design is still changing.
  • If one module later needs to scale or be owned by a separate team, its clean boundary makes extracting it into a service straightforward.

Limits

All modules share one runtime, so a memory leak or crash in one affects all. They also release together. For most small and mid-size products, though, those limits arrive much later than teams expect, which is why many architects now recommend starting here and splitting only when a specific module demands it.

Questions, answered

Yes, usually with separate schemas or table prefixes per module and no cross-module joins.

Shopify has written publicly about modularizing its large Rails monolith rather than splitting into microservices.

By the Stegnor team · Updated