Your company wants to split a large monolith into microservices. How would you approach it, and when would you argue against it?
What the interviewer wants to hear
- Start from the real problem: team scaling, deploy speed or scaling hotspots
- Find boundaries by business domain (bounded contexts) and data ownership
- Strangler fig: extract one service at a time behind a facade or gateway
- Each service owns its data; handle consistency with events or sagas
- Invest in CI/CD, observability and contracts first
- A modular monolith may be the better answer for small teams
Model answer
First I would ask what problem we are solving: many teams blocking each other on releases, one part needing very different scaling, or just a messy codebase. Messy code is not fixed by adding a network; a modular monolith with clear internal boundaries may be enough, especially for a small team. If we go ahead, I would map business domains and data ownership to find boundaries, then use the strangler fig pattern: put a gateway in front, extract one well-bounded area like notifications or billing, route its traffic to the new service, and repeat. Each service must own its database; shared tables bring back the coupling. Cross-service consistency then needs events, an outbox, and sagas instead of transactions. Before the first extraction I would invest in CI/CD, tracing, centralised logs and API contracts, because debugging distributed failures without them is very painful.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Backend Developer questions
- Design a URL shortener like bit.ly that handles 100 million new links per month and many more redirects. Cover IDs, storage, caching and scale.
- A product manager says each payment event must be processed exactly once. How do you achieve that with real message queues and networks?
- Your single PostgreSQL database is reaching its limits. How would you scale reads and then writes, and what problems does each step bring?
- In a microservices system, placing an order touches the Order, Payment and Inventory services, each with its own database. How do you keep data consistent?
- You are building a B2B SaaS backend used by many companies. How would you design multi-tenancy and make sure one tenant can never see another tenant data?
- Design a notification service that sends email, SMS and push messages for many products, up to tens of millions of messages a day.
- Design the backend for a real-time chat app with one-to-one and group chats, online status and message history.
- One slow downstream dependency caused your whole platform to go down. How would you handle the incident, and what would you change afterwards?
- How would you design a ledger for a wallet or payments product so balances are always correct?