Open the editor

Monolithic architecture

One codebase, one deployable, one database. The default for new products.

Monolithic architecture diagram: Web layer, Feature code (orders, billing, accounts), Shared database, One deployable

A monolith is an application built, tested and deployed as a single unit. All of its features run in one process and usually share one database, so a call from orders to billing is an ordinary function call, not a network request.

Monoliths have a bad reputation they mostly do not deserve. Many large products ran as monoliths for years, and starting as one is usually the fastest way to learn what the product needs. The trouble starts when nothing keeps the features apart and every change touches everything.

The parts of the pattern

Web layer
Receives every request, renders pages or JSON, and calls into the features.
Feature code (orders, billing, accounts)
Lives in the same codebase and the same process. Features call each other directly.
Shared database
One schema for the whole application, which makes joins and transactions across features easy.
One deployable
A single build artefact, such as a container image or a JAR, deployed as a whole.

How it works

  1. A request reaches the web layer of one of the application's instances.
  2. The web layer calls the orders code, which calls billing in the same process.
  3. Both write to the shared database, inside one transaction if needed.
  4. To release a change, the whole application is built and deployed again.

When to use it, and when not to

Good fit

  • A new product, where the domain is still changing and boundaries are not known yet.
  • One team, or a few teams working closely together.
  • You want simple deployment, simple debugging and real transactions.
  • Load fits on a few identical instances behind a load balancer.

Think twice

  • Many teams ship independently and keep blocking each other's releases.
  • One feature needs very different scaling or runtime from the rest.
  • The code has no internal boundaries left and every change breaks something unrelated: consider a modular monolith first.

Edit this diagram

Click Open the diagram in the editor to get your own copy, saved in your browser. Rename the boxes to match your system, swap the generic boxes for technology icons from the palette, then export a PNG, SVG or PDF, or share a link. No sign-up.