cloudpatterns.appClassroomKatasWhiteboardBlog
Design Method & StylesChapter 14 · Split decisions

Modular monolith

Modular monolith

A modular monolith is still deployed as one app, but its code is split into modules by business area — orders, payments, inventory — and each module keeps its internals private behind a public interface and owns its own tables. Other modules call that interface; they never reach into its code or its data. Tools check the rules on every change. You keep the simple single deploy and still get boundaries you could later turn into services.

Use when
A monolith whose teams keep stepping on each other's code but can still share one release · Domain boundaries that are still being discovered and need to stay cheap to move · Preparing a later split — a module with its own interface and data is easy to lift out
Avoid when
Parts that truly need their own release schedule, scaling or failure isolation — that's what a separate service is for · Without tooling or reviews that enforce the boundaries — the modules erode back into one tangle
Trade-offs
Keeps one deploy and in-process calls, but every team still ships on the shared release · Boundaries need tooling and discipline to stay real; an unchecked boundary decays · Calls through public interfaces are more work than reaching straight into another module's internals, and that friction is the point
Requires
Monolith
3 objectives · 4 misconceptions
  • explain Explain the rules that make a monolith modular — modules by business area, a public interface with private internals, each module owning its tables — and why each one matters.
  • predict Predict which changes to Checkout break a module boundary — a query joining another module's table, a call into another module's internals — and what that costs when the module is later moved out.
  • choose Choose between modularizing Checkout inside one deploy and splitting it into services, from team count, release pain and how settled the boundaries are.
  • Not true: Putting code in separate folders or namespaces makes a monolith modular.
  • Not true: Modules can share tables freely as long as their code is separate.
  • Not true: A modular monolith is just a half-done migration to microservices.
  • Not true: Splitting the code into UI, business-logic and data layers gives the same benefits as splitting by business area.

Builds on

Contrast with

No close look-alikes.

Progress is saved on this device