Monolith Architecture
A single application where all components — frontend, backend, data access — live in one codebase and deploy as one unit.
What is it?
A monolith is the simplest way to structure a software application: everything in one place. One codebase contains all the code. One build process compiles it. One deployment puts it on a server. One database stores all the data. When a user’s request arrives, it’s handled entirely within this single application.
This is how most software starts, and for good reason. When a project is small — one developer or a small team, one product, straightforward requirements — a monolith is the fastest, simplest, and most productive architecture. There’s no network communication between services, no distributed systems complexity, no need to coordinate deployments across multiple applications.
The alternative — microservices — splits the application into many small, independent services that communicate over the network. Microservices solve real problems (independent scaling, independent deployment, technology diversity), but they introduce significant complexity. For most projects, especially early-stage ones, this complexity costs more than it’s worth.
The industry consensus in 2025-2026 is clear: start with a monolith. Split into services only when you have a concrete, measurable reason to do so. Many successful applications run as monoliths at scale — including large parts of Shopify, Stack Overflow, and Basecamp.
In plain terms
A monolith is like a single restaurant with one kitchen, one dining room, and one menu. Everything happens under one roof. The chef, the waiter, and the dishwasher are all in the same building. This is simple and efficient — the chef doesn’t need to phone another building to get ingredients. A franchise with separate kitchens in different cities (microservices) makes sense when you’re huge. For one location, one kitchen is all you need.
At a glance
Monolith vs. microservices structure (click to expand)
graph TD subgraph Monolith["Monolith (one unit)"] direction TB MF[Frontend] --> MB[Backend Logic] MB --> MD[Database Access] MD --> MDB[(Database)] end subgraph Micro["Microservices (many units)"] direction TB GW[API Gateway] --> S1[Service A] GW --> S2[Service B] GW --> S3[Service C] S1 --> DB1[(DB A)] S2 --> DB2[(DB B)] S3 --> DB3[(DB C)] end style Monolith fill:#e8f4e8,stroke:#4a9ede style Micro fill:#fde8e8,stroke:#e74c3cKey: The monolith is one application with internal function calls (fast, simple). Microservices are separate applications communicating over the network (flexible, but complex). The green shading on the monolith indicates it’s the recommended starting point.
How does it work?
A monolith has a straightforward internal structure. All the pieces live together, but they’re still organised logically.
1. One codebase
All the source code — frontend pages, backend logic, database access, configuration — lives in a single repository. When you open the project, you see everything. When you search for a function, you find it. When you trace a request from button click to database query, the entire path is in front of you.
Think of it like...
A single book with chapters. You can flip between chapters easily. The table of contents shows you where everything is. Compare this to a series of separate pamphlets stored in different drawers — you spend more time finding things than reading them.
2. One build, one deploy
You run one command to build the application. You run one command to deploy it. There’s no need to coordinate deployment order between services, no need to check that Service A deployed before Service B starts.
Example deployment flow (click to expand)
1. git push origin main 2. CI pipeline runs tests (all tests, one suite) 3. Build step compiles the application (one build) 4. Deploy step pushes to the server (one deployment) 5. The entire application is liveWith microservices, steps 2-4 would repeat for each service, potentially in a specific order, with rollback strategies if one service fails.
3. Internal communication
Components within a monolith communicate through function calls — the fastest, most reliable form of communication in software. When the frontend needs data, it calls a backend function directly. No network request, no serialisation, no latency, no failure modes beyond the code itself.
| Communication type | Speed | Reliability | Complexity |
|---|---|---|---|
| Function call (monolith) | Nanoseconds | Extremely high | Trivial |
| HTTP request (microservices) | Milliseconds | Network-dependent | Significant |
4. Logical separation within the monolith
A monolith doesn’t mean a tangled mess. Good monoliths are organised into modules or layers that have clear boundaries. The frontend code doesn’t directly access the database — it goes through the backend layer. The backend doesn’t render HTML — it returns data to the frontend layer.
The separation is logical (organised in code) rather than physical (running in different processes). This gives you the benefits of separation-of-concerns without the overhead of distributed systems.
Concept to explore
See modular-monolith for how to structure a monolith with clean module boundaries that could become services later if needed.
When to move beyond a monolith
A monolith is not forever — it’s a starting point. Move beyond it when you have concrete, measurable reasons:
| Trigger | What it means | Solution |
|---|---|---|
| Independent deployment | Two teams need to ship at different speeds | Extract the slower-changing part into a service |
| Independent scaling | One part of the app handles 100x more load | Scale that part separately |
| Technology diversity | A component needs a different programming language | Isolate it as a service |
| Team autonomy | Teams of 8+ people stepping on each other’s code | Draw service boundaries along team boundaries |
Don't split prematurely
“We might need to scale later” is not a reason to use microservices now. Premature splitting adds complexity, slows development, and often creates worse problems than it solves. Split when you have evidence, not speculation.
Why do we use it?
Key reasons
1. Simplicity. One codebase, one build, one deployment, one database. There’s nothing to coordinate, no network calls to fail, no distributed transactions to manage. This simplicity translates directly into faster development.
2. Easy debugging. When something breaks, the entire stack trace is in one application. You can step through the code from the user’s click to the database query without crossing process or network boundaries.
3. Fast local development. Run one command and the entire application starts on your machine. No need to spin up 5 services, 3 databases, and a message queue just to test a button.
4. Fast iteration. Change any code, see the result immediately. No waiting for service-to-service communication, no redeploying multiple services for one feature change. This speed compounds — faster iteration means faster learning means a better product.
When do we use it?
- When starting a new project — almost always the right default
- When working as a solo developer or small team (fewer than ~8 people)
- When the application has straightforward scaling needs (one server can handle the load)
- When you want the fastest possible development speed and simplest debugging
- When building a walking-skeleton — the skeleton is naturally monolithic
Rule of thumb
Start with a monolith. Move away from it only when you feel specific, measurable pain that a monolith can’t solve. “Monolith first” is the near-universal expert recommendation.
How can I think about it?
The all-in-one workshop
A woodworker has a single workshop with all their tools: saws, drills, sandpaper, paint, workbenches. Everything is under one roof. They can walk from the saw to the drill in three steps. They can see all their projects at once. If they need a tool, it’s right there.
As the business grows and they hire people, they might split into a cutting shop and a finishing shop. But only when the single workshop gets genuinely crowded — not because they imagine they might be crowded someday.
- One workshop = monolith (all code in one place)
- Walking to the drill = function calls (fast, direct)
- Separate shops = microservices (independent but harder to coordinate)
- Sending materials between buildings = network requests (slower, can fail)
- Splitting when crowded = extracting services when team or scale demands it
The Swiss Army knife
A Swiss Army knife puts multiple tools in one compact unit: blade, scissors, screwdriver, bottle opener. You carry one thing that does many things. It’s convenient, portable, and you always have what you need.
A toolbox with separate, specialised tools (a full-size knife, full-size scissors, a real screwdriver) is more powerful for each individual task. But you need a whole toolbox, and you need to find the right tool each time.
- Swiss Army knife = monolith (all tools in one unit, good enough for most tasks)
- Full toolbox = microservices (specialised tools, more overhead to manage)
- Pocket-sized = easy to deploy and manage
- Finding the right tool = service discovery and routing in microservices
- Upgrade to the toolbox when the Swiss Army knife isn’t enough = split when you have a reason
Concepts to explore next
| Concept | What it covers | Status |
|---|---|---|
| walking-skeleton | The first thin slice through a monolith’s architecture | complete |
| vertical-slices | Building features end-to-end within the monolith | complete |
| separation-of-concerns | Keeping components logically separated even in one codebase | stub |
| microservices | The distributed alternative — and when it’s actually worth it | stub |
| modular-monolith | Structuring a monolith with clean boundaries for future splitting | stub |
Some of these cards don't exist yet
They’ll be created as the knowledge system grows. A broken link is a placeholder for future learning, not an error.
Check your understanding
Test yourself (click to expand)
- Explain what a monolith architecture is and why it’s the recommended starting point for most projects. What specific advantages does it provide?
- Name three benefits of a monolith and describe how each one contributes to faster development.
- Distinguish between a monolith and microservices. When is the added complexity of microservices justified?
- Interpret this scenario: a solo developer building a new web application is considering starting with microservices “to be ready for scale.” What advice would you give, and why?
- Connect monolith architecture to separation-of-concerns. Why does a monolith still need logical separation between components, even though they share a codebase?
Where this concept fits
Position in the knowledge graph
graph TD SA[Software Architecture] --> MA[Monolith Architecture] SA --> MS[Microservices] SA --> SC[Separation of Concerns] MA -.->|can evolve into| MM[Modular Monolith] MM -.->|can split into| MS style MA fill:#4a9ede,color:#fffRelated concepts:
- walking-skeleton — the skeleton is naturally monolithic; all layers in one codebase
- vertical-slices — features are built as vertical slices within the monolith
- microservices — the alternative architecture; recommended only when monolith pain is concrete
Further reading
Resources
- MonolithFirst (Martin Fowler) — The authoritative argument for starting with a monolith
- Microservices vs Monolith (Atlassian) — Balanced comparison of both approaches
- Monolith vs Microservices: The Real Trade-offs (Medium) — Practical trade-off analysis for engineers
- Microservices vs Monolith in 2026 (Webcoderspeed) — The current industry consensus on monolith-first
- Microservices vs Monolithic Architecture: A Beginner-Friendly Guide (Medium) — Accessible introduction for newcomers
