Module 92: Architecture Patterns
Monoliths
🏠The everyday picture
A large joint family living in one house: one kitchen, one front door, shared bills. Decisions are quick and everyone's close by, but if rooms aren't kept tidy and separate, the house becomes chaos.
📘What it really is
-
A monolith is an application built and deployed as one unit: one codebase, one deployable (one container, Module 69), usually one database. Your CRM is a monolith.
-
Strengths:
- simple to build, test, deploy and debug: one place to look;
- fast in-process function calls between parts, no network in between;
- transactions across features are easy (one database, Module 56);
-
one set of infrastructure to run and pay for.
-
Weaknesses as it grows:
- without discipline, parts become tangled (a "big ball of mud"), and every change risks breaking something unrelated;
- the whole app is deployed for every small change;
- one heavy part can't be scaled separately (though you can run several copies of the whole thing, Module 70);
-
large teams step on each other in one codebase.
-
The modular monolith keeps one deployable but divides the code into modules with clear boundaries:
bookings,availability,payments,notifications, each with its own folder, public interface and, ideally, its own tables. Modules call each other only through those interfaces, never by reaching into each other's internals or tables. -
Most products should start as a (modular) monolith. Many successful companies run large, well-structured monoliths for years.
🖱️Try it
Sketch the booking platform as a modular monolith: list the modules, each one's responsibility, its public functions and the tables
it owns. Then look at your CRM's backend: is it organised by technical layer (routes/, services/) or by feature
(customers/, invoices/)? Note where modules reach into each other's internals.
✅Quick check
What's a modular monolith?
Show the answer
One deployable application whose code is divided into modules with clear boundaries and interfaces.
Name two strengths of a monolith.
Show the answer
Any two: simplicity to build, test, deploy and debug; fast in-process calls; easy transactions; one set of infrastructure.
