Architecturemodulithmajestic monolith

Modular monolith

Definition

A modular monolith is a single deployment unit whose code is divided into modules that own their schemas, hide their internals and interact only through public contracts and integration events.

In practice

It keeps the runtime simplicity of a monolith (in-process calls, one deploy) while giving teams clear ownership and boundaries. Boundaries need enforcement: internal types, a database login per module, and architecture tests that fail the build when one module reaches into another.

Modules still share one process and its fate: a memory leak or exhausted thread pool in one module takes down all of them, and they cannot be scaled or released separately. Its biggest advantage is that extracting a well-bounded module into a service later is a contained change rather than a rewrite.

Example

The Orders module owns the orders schema and exposes IOrdersApi plus an OrderPlaced event; Shipping subscribes to the event and never queries orders.* tables directly.