Design a notification system

Send notifications (mobile push, SMS, email) to users reliably, at large scale.

Why interviewers ask it

It tests queues, priorities, third-party integrations, retries and avoiding duplicates — everyday problems in real products.

Functional requirements

Non-functional requirements

From version 1 to the final design

  1. Version 1: the order service calls the email provider directly.
  2. Version 2: a notification service with templates and user preferences.
  3. Version 3: a queue per channel, workers, retries and a dead-letter queue.
  4. Version 4: priority lanes, idempotency keys, provider failover and per-user rate limits.

The design, step by step

  1. A notification service checks preferences and rate limits, and fills in the template.
  2. It puts messages onto separate queues per channel (push, SMS, email) and per priority (passcodes ahead of marketing).
  3. Channel workers call the providers (Apple and Google push services, an SMS gateway, an email service).
  4. Retries with backoff; repeated failures go to a dead-letter queue; every status is recorded in a log.

Deep dives

Common mistakes

Not true: One shared queue is fine for both marketing messages and login passcodes.
In fact: A marketing blast of millions would sit in front of the passcodes and delay them. Use separate queues, by priority.

In the interview

Producers call a notification service that checks preferences, fills in templates and puts messages on queues per channel and priority. Workers deliver through providers like Apple and Google push services and SMS gateways, with retries, dead-letter queues and idempotency keys to avoid duplicates. Passcodes get a high-priority lane, so campaigns never delay them.

Part of Unit 8: High-level design questions in the free System Design course.