Your startup’s Next.js monolith is growing and some engineers want to split it into microservices. How do you decide, and what would you do?
What the interviewer wants to hear
- Identify the real pain: deploy speed, scaling, team ownership or reliability
- Microservices add network failures, distributed data and ops cost
- A modular monolith with clear boundaries is often the better first step
- Extract services only where scaling or ownership clearly needs it
- Use the strangler pattern and keep data ownership per service
Model answer
First I ask what problem we are actually solving. Slow builds, unclear ownership, one hot path that needs different scaling, or frequent outages caused by unrelated code all have different fixes. Microservices bring real costs: network calls that fail, distributed transactions, harder debugging, more deployment pipelines and the need for good observability. For a small team that cost usually outweighs the benefit. So my default is a modular monolith: clear domain modules such as billing, catalog and accounts, with explicit interfaces, no reaching into each other’s tables, and lint rules that enforce boundaries. If one part truly needs independent scaling or a separate team, like video processing or search indexing, I extract it using the strangler pattern behind a stable API, give it its own data, and communicate through events where possible. I measure whether the split improved the original pain.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Full Stack Developer questions
- You are building a multi-tenant B2B SaaS app. How would you design data isolation between tenants, and what are the trade-offs?
- Your app works well for 1,000 users. Traffic is expected to grow to 1 million users. How would you prepare the system, and in what order?
- An order flow touches your database, a payment provider and an email service. How do you keep the system consistent when any step can fail?
- You need to split a large users table column "name" into "first_name" and "last_name" on a table with 50 million rows, with no downtime. Walk through your plan.
- For a large e-commerce site in Next.js, how would you choose the rendering and caching strategy for the home page, product pages, cart and account pages?
- Design an e-commerce checkout end to end: cart, payment with a provider like Stripe, inventory and order confirmation. What can go wrong and how do you make it reliable?
- Ten minutes after a deploy, 500 errors jump from 0.1% to 8% on the main API. Walk through how you handle the incident.
- Customers need to import CSV files with up to two million rows into your app. Design the feature end to end.
- You are opening your product’s API to outside partners. How do you design authentication, authorization, rate limiting and change management for it?