A monolith built from modules with clear boundaries: one process, usually one database, but each module is a separate piece of code with a public interface and its own area of data. In 2015 Martin Fowler described the “monolith first” strategy: start a new product as a modular monolith and extract services only when a real reason for them appears.
Boundary rules
- each module has one purpose — one domain, such as orders, billing, notifications;
- only the public interface is visible from outside: other modules do not touch its internal classes and functions;
- each module owns its own tables or data collections — it reads anyone else’s through the owner’s interface;
- shared code is minimal and does not tie modules together through global models and utilities;
- each module has its own tests, run separately from the rest — this is how you verify that the boundaries are real.
Monolith, modular monolith, microservices
| Aspect | Monolith | Modular monolith | Microservices |
|---|---|---|---|
| Deployment | one process | one process | one service per process |
| Boundaries | no explicit rules | modules with a public interface | each service is a separate unit |
| Data | one schema with no owners | tables split by module | one database per service |
| Module interactions | any, most often direct calls | calls and events through interfaces | network: HTTP, queues |
| What the team needs | minimal infrastructure | boundary discipline | mature DevOps practices |
Keeping boundaries in code
Technically, modules are separated at project or package level with default visibility, import rules enforced in CI and architecture checks. The structure follows the boundaries: each module has its own public interface, its own models and its own tests.
src/ orders/ # public API: services.py, the rest — _internal billing/ notifications/ shared/ # only what every module needs: events, base typesWhen to choose it
A modular monolith suits most new products: a small team, domain boundaries that have not settled yet, and a load a single node can handle. Splitting into services early often produces a distributed monolith: the same hidden coupling between parts, but now over the network and with shared releases. When a module starts to need a different scale, a different stack or a different team, it is extracted into a service — and the boundaries drawn in the modular monolith move with the code.
Sources
the term is written from these pagesVerified 8 Nov