Monolith vs Modular Monolith vs Microservices
Weigh the honest costs of distributed systems, team topology (Conway's Law), and why starting with a modular monolith is the default choice.
TL;DR
Start with a Modular Monolith. Microservices buy organizational scaling and independent deployment, not cleaner code—and they charge a steep tax in network failures, distributed tracing, and eventual consistency. Extract a service only when a specific scaling, runtime, or team-autonomy bottleneck proves you need it.
Context
Many teams adopt microservices on day one hoping it will keep code modular. In reality, if you can't draw clean module boundaries inside one repository, splitting them across HTTP/gRPC creates a distributed monolith—all the coupling of a bad monolith plus network latency and partial failures.
Comparison
| Dimension | Big-Ball-of-Mud Monolith | Modular Monolith | Microservices |
|---|---|---|---|
| Module boundaries | Tangled imports & shared tables | Strict public APIs, isolated schemas | Network APIs + separate databases |
| Communication | Direct function calls | Public module interfaces / in-process events | HTTP/gRPC + message brokers |
| Consistency | Single ACID DB transaction | Single ACID DB transaction (or local events) | Eventual consistency (Outbox / Sagas) |
| Deployment | One artifact | One artifact | N independent pipelines & versions |
| Ops complexity | Low | Low | High (service mesh, tracing, retries, DLQs) |
| Best team size | 1–3 devs (short-lived) | 2–30+ devs | Multiple autonomous teams (30+ devs) |
Decision criteria
- Team topology (Conway's Law): If 1–2 squads ship the product, one modular monolith lets everyone refactor atomically in one PR. Microservices pay off when 5+ teams step on each other's release trains.
- Independent scaling or runtime: A video transcoder or Python ML inference service genuinely benefits from being its own deployable worker; your CRUD billing module usually doesn't.
- Domain maturity: Early-stage domains change boundaries weekly. Moving a function across folders takes 10 seconds; moving an API across two microservices takes weeks.
Gotchas
- Microservices for "clean code": network boundaries don't fix unclear domain modeling—they just make refactoring 10× slower.
- Synchronous call chains: Service A → Service B → Service C → Service D multiplies tail latency and turns a 99.9% SLA per service into cascading outages.
- Shared database across microservices: if two microservices share one Postgres database, you built a distributed monolith with extra steps.
Production checklist
- Default to a Modular Monolith unless you have a concrete team, scaling, or compliance driver
- Enforce module boundaries with lint rules and separate DB schemas so extraction stays possible
- If you extract a service, give it its own database and use async events/outbox where possible
Check yourself
Check Yourself
1. A 5-person startup splits their new SaaS into 8 microservices so the code stays clean. What is the most likely outcome?
2. What is a 'distributed monolith'?
Sources
Related Notes
Modular Monolith
Organize a single deployable application into isolated business modules that communicate only through public APIs—with zero shared database tables.
DDD Essentials: Ubiquitous Language, Bounded Context, Context Map
Align code and domain experts using Ubiquitous Language, isolate models inside Bounded Contexts, and document integration boundaries with a Context Map.