1. How do you decide between a monolith, modular monolith, and microservices for a new system?
Start with the team and domain, not the technology.
The decision tree I follow:
Monolith — When the team is small (≤5 engineers), the domain is not well understood yet, or you're building an MVP. It's the fastest path to working software and easiest to refactor later. Don't prematurely distribute.
Modular Monolith — When the domain is understood well enough to draw clear boundaries, but operational complexity of microservices isn't justified. Modules share a process but enforce strict interface contracts between them (no direct cross-module DB access). This is the sweet spot for most mid-size companies.
Microservices — When you have independent scaling requirements per domain, team autonomy demands it (Conway's Law), different services have genuinely different deployment cadences, or you need polyglot persistence. The cost is high: distributed tracing, network failures, eventual consistency, operational overhead.
Key heuristic: If you can't draw clear bounded contexts on a whiteboard, microservices will hurt you. Start modular monolith and extract services only when there's a concrete, proven pain point.