Design a notification service that sends email, SMS and push messages for many products, up to tens of millions of messages a day.
What the interviewer wants to hear
- Single API that accepts requests and writes them to a durable queue
- Per-channel workers with provider integrations and failover
- User preferences, quiet hours, templates and deduplication
- Retries with backoff, rate limits per provider, dead-letter handling
- Priorities so urgent messages like OTPs are not stuck behind bulk campaigns
- Delivery tracking and metrics
Model answer
Products call one API with a template id, recipient and data, plus an idempotency key. The API validates the request, stores it, and publishes it to a durable queue like Kafka or SQS, so producers are never blocked by slow providers. A routing step loads user preferences and opt-outs, applies quiet hours and deduplication, renders the template, and puts the message on a per-channel queue. I keep separate high and low priority queues so a marketing blast of five million emails cannot delay one-time passwords. Channel workers call providers such as an email service, SMS gateway, APNs and FCM, respecting each provider's rate limits, retrying with backoff, failing over to a backup provider, and sending permanent failures to a dead-letter queue. Provider callbacks update delivery status in a store built for heavy writes. Metrics on queue lag, send rate and failure rate per provider drive alerts.
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?
- Your company wants to split a large monolith into microservices. How would you approach it, and when would you argue against it?
- 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?