Loading...

A 20-minute mock system design interview. You drive the pace. Jump to the board when you are ready; skip capacity math if you want. The interviewer grades your thinking, not a template match.
The happy path here is short: a service asks, a vendor delivers. The signal lives in what happens around it: a vendor outage, a retry that sends twice, a marketing blast that buries a password reset, a user who opted out. Naming "Kafka plus workers" is not a design.
Two shared surfaces (only one is on screen at a time; use the panel arrow to switch):
Build incrementally while you talk. Trace one notification end to end through your diagram, including the one sent while the SMS vendor is down. Argue the tradeoff, not "industry standard."
Read this before you go in. These are the decisions, and why they matter.
Delivery always goes through a provider: APNs for iOS, FCM for Android, an SMS vendor (Twilio, Vonage and similar), an email service (SES, SendGrid, Postmark). Your system's job is everything before the hand-off: who to reach, on which channel, with what text, whether they agreed to it, and what to do when the provider says no. Draw the providers as third-party boxes at the edge of the board.
Callers (billing, orders, social, a campaign tool) should not wait on a vendor. The notification service validates, records the request, queues it and returns 202 with an id. Workers do the slow part. A single server that calls vendors inline is a fine first sketch, then name its three problems: a single point of failure, vendor latency tying up the box that accepts requests, and no way to scale the parts separately.
With one shared queue, an SMS vendor outage or a slow email provider backs up every channel behind it. A queue (and a worker pool) per channel turns a vendor outage into a backlog for that channel only. Some designs go further and split by priority too, so a marketing blast never sits in front of a one-time passcode.
Queues redeliver after a crash or a lost acknowledgement, so a worker can send twice. Exactly-once delivery is not available; exactly-once effect is. Give each notification an id and have the worker atomically claim it (a set-if-absent with a TTL, or a unique row) before calling the vendor. "Check the log, then send" is a race: two workers both see "not sent".
Retry timeouts, 429s and 5xx with exponential backoff and jitter, under a budget; then a dead-letter queue someone watches and can replay. Do not retry a rejected payload. When APNs or FCM says a device token is no longer registered, delete the token instead of retrying it forever.
Every attempt lands in a notification log (status, attempts, timestamps). Delivery receipts, opens and clicks flow to analytics. Those numbers decide which templates to kill and catch a silent provider failure early.
One complete design you can study, then rebuild in your own words. Do not recite it. In the interview, draw your graph and defend the choices.
How the graph works: callers hit a load balancer in front of a stateless notification service. It authenticates the caller, checks opt-in and per-user caps against cached settings, renders the template, records the request and puts one message per channel on that channel's queue, then returns 202. Each channel's worker pool claims the notification id in Redis, calls its provider under that provider's rate limit, logs the attempt, and retries with backoff or dead-letters. Tracking events flow from the log to analytics.
Service (callers) + Scheduler (campaigns)
→ Load Balancer
→ Service: Notification service (stateless; mark distributed)
↔ Cache (settings, templates, device tokens) ← Postgres (users, devices, settings, templates)
→ Kafka / SQS: push queue, SMS queue, email queue (one per channel)
→ Worker pools per channel (mark distributed)
↔ Redis (dedupe claims, per-user and per-provider counters)
→ Third-party API: APNs, FCM, SMS vendor, email vendor
→ Cassandra (notification log) → Data Warehouse (tracking, analytics)
→ Queue: retry with backoff, then dead-letter
Components:
POST /v1/notifications with the user, template order_shipped, parameters, category transactional and an idempotency key.SMS vendor down for 20 minutes: SMS messages wait in their own queue while push and email keep flowing; workers retry with backoff and the queue drains when the vendor returns. Messages past the retry budget go to a dead-letter queue with an alert.
A worker dies after sending but before acknowledging: the message comes back; the next worker finds the id already claimed and skips it.
users(user_id, email, phone, timezone, locale)
devices(device_id, user_id, platform, device_token, updated_ts)
settings(user_id, channel, category, opt_in) primary key (user_id, channel, category)
templates(template_id, channel, locale, version, body)
notification_log(user_id, created_ts, notification_id, channel, template_id, status, attempts)
user_id, clustered by created_tsSQS per channel instead of Kafka topics. A per-user notification inbox for in-app messages. Rendering in the workers instead of the service. Buying a notification platform when the team is small. What matters is that you can argue the tradeoff.