Back to Publication
Architecture
By Riazul Islam•
Summary: Everyone wants microservices until they have to maintain 15 separate services. Here's when each approach actually makes sense.
## The Architecture Decision That Matters Most
I've built monolithic applications that scaled to millions of users. I've also built microservices architectures that were overkill for the team size. Here's what I learned.
### Start Monolith, Extract Later
This is the advice most experienced engineers give, and it's correct. A well-structured monolith is easier to:
- Develop (one codebase, one deployment)
- Debug (one log stream, one database)
- Test (integration tests are simpler)
- Deploy (one artifact, one process)
### When to Consider Microservices
**You need microservices when:**
- Different parts of your app need different scaling
- Teams are large enough to own separate services (5+ developers per service)
- You need technology diversity (Python for ML, Node for APIs)
- Parts of the system have very different deployment cycles
**You DON'T need microservices when:**
- Your team is small (< 10 developers)
- The application is relatively simple
- You're building an MVP
- You don't have DevOps expertise
### The Hidden Costs of Microservices
1. **Network complexity** - services communicate over HTTP/gRPC
2. **Data consistency** - no more simple database joins
3. **Deployment complexity** - managing 15 deployments vs 1
4. **Debugging difficulty** - tracing requests across services
5. **Operational overhead** - monitoring, logging, alerting for each service
### The Pragmatic Approach: Modular Monolith
Structure your monolith like it could become microservices:
```
src/
modules/
users/
controllers/
services/
models/
orders/
controllers/
services/
models/
payments/
controllers/
services/
models/
```
Each module has clear boundaries. When (if) you need to extract a service, the code is already organized.
**Architecture should serve your team, not the other way around.**
