Build the whole app as one piece that is built, deployed and run together.
A monolith is an application built, deployed and run as one single unit. All features (users, orders, payments and so on) live in one codebase, usually share one database, and start as one process.
In a monolithic architecture, everything the product does is packaged together. When a user places an order, the same program checks the user, reads the cart, charges the card and sends the email. These are only functions and classes that call each other inside one process.
Usually the monolith is split into layers (web, business logic, data access), and one shared database holds all the tables. To release a change, even a tiny one, you build and deploy the whole thing.
A monolith can be well organised or a mess. A modular monolith keeps clear boundaries between modules (each module owns its tables and exposes a small interface), but still deploys as one unit. This gives most of the order of microservices, without the network.
| Question | Monolith | Microservices |
|---|---|---|
| Deploy | One unit, all together | Each service on its own |
| Scale | Copy everything | Scale only what is busy |
| Talk between parts | Function calls | Network calls |
| Data | Usually one shared database | A database per service |
| A crash | Can take the whole app down | Usually limited to one service |
| Team size it suits | Small to medium | Many teams |
| Operations effort | Low | High (many things to run and watch) |
A simplified model with made-up sizes. The point: in a monolith the unit you scale, release and crash is always the whole app. A well-built monolith can still reduce these costs with caching, background jobs and good module boundaries.
| Term | Meaning in easy words |
|---|---|
| Monolith | An application built and deployed as one single unit |
| Deployable | The thing you ship. In a monolith there is just one |
| Modular monolith | A monolith with clear module boundaries inside |
| Layered architecture | Code split into presentation, business and data layers |
| Coupling | How much one part depends on the details of another |
| Cohesion | How well the things inside one module belong together |
| Big ball of mud | A codebase with no clear structure where everything depends on everything |
| Shared database | One database used by every module of the app |
| Horizontal scaling | Running more copies of the app behind a load balancer |
| Blast radius | How much of the system a single failure can hurt |
| Strangler Fig | A way of replacing a monolith piece by piece |
| Choice | We gain | We lose |
|---|---|---|
| One deployable | Simple releases and debugging | Small changes cost a full release, and one bug can stop all |
| Shared database | Joins and transactions are easy | Modules become tied through the schema |
| In-process calls | Speed and reliability | No independent scaling or failure isolation |
| One codebase | Easy refactoring and code sharing | Merge conflicts and slow builds as teams grow |
| Modular boundaries | Order inside, easy later split | Needs discipline, as nothing enforces it by default |
| Staying a monolith | Low complexity | May hit scale or team limits one day |