Skip to main content

Architecture and scale

What is a Monolith?

Definition

A monolith is an application built, deployed and run as a single unit, where all its features share one codebase, one process and usually one database.

Also known as: Monolithic architecture

Monolith in more detail

Everything happens in one place. A function call crosses no network, a transaction can span any tables it likes, and there is one thing to deploy, one log stream to read and one stack trace when something breaks. For a small team this is not a compromise — it is a genuine advantage, because the hardest problems in distributed systems simply do not exist yet.

The strain appears with scale of people more than scale of traffic. When dozens of engineers share one deployable, releases queue behind each other, a slow test suite blocks everyone, one bad code path can exhaust a shared resource, and scaling the reporting feature means running another copy of the entire application. Boundaries also erode over time: without enforcement, a module reaches directly into another's tables and the codebase quietly becomes impossible to split.

The modern position is that 'monolith' is not an insult. A modular monolith keeps the single deployment while enforcing internal boundaries — separate modules with explicit interfaces, no cross-module table access — which delivers most of the organisational benefit of services with none of the network. Starting with a monolith and extracting services only where a boundary has proved itself is well-trodden advice, because a boundary drawn on day one is usually drawn in the wrong place.

Monolith example

Monolith — one deployable, one database

  ┌──────────────────────────────┐
  │  shop.jar                    │
  │   users  orders  payments    │   in-process calls
  │   catalog  search  emails    │   one transaction
  └──────────────┬───────────────┘
                 ▼
            one database

  deploy:  one artifact
  debug:   one stack trace
  scale:   run N copies of everything

Modular monolith — same deployment, enforced seams

  orders/  may call  payments.api.charge()
  orders/  may NOT   read payments.transactions table

  If a seam later needs its own deployment, the extraction
  is a refactor rather than an excavation.

Monolith — common questions

Is a monolith bad architecture?
No. It is the right default for most teams and products, and it stays right for longer than industry fashion suggests. It becomes a problem when many teams contend for one deployment or when parts of the system have genuinely different scaling needs.
Can a monolith scale?
Yes — horizontally, by running many instances behind a load balancer. What does not scale is scaling one feature independently of the others, since every instance carries the whole application.
What is a modular monolith?
A single deployable whose internals are divided into modules with explicit interfaces and enforced boundaries, including no direct access to another module's tables. It keeps operational simplicity while preserving the option of extracting a service later.

Keep reading

Every definition in the set is indexed A-Z in the developer glossary, and the cheat sheets cover the syntax once you know what you are looking for.

Browse the A-Z glossary