Design Case StudiesIntermediate15 min read2 questions

Design a Notification System

Push, email and SMS at scale. Provider failover, preference enforcement, deduplication and the digest logic that stops you spamming your own users.

Covers: Multi-channel delivery, templating, user preferences, deduplication, rate limiting, retries, third-party providers

Notifications look trivial and are not. The delivery is easy; the hard parts are respecting user preferences correctly, not sending the same thing twice, surviving a provider outage, and rate limiting so a runaway loop does not email a user four hundred times.

Notification pipeline

One entry point, a preference and dedup gate, then per-channel workers with independent retry behaviour.

ServiceQueueComputeExternalDatastoreTap a box for detail

Flow

  • Event sourcesNotification API
  • Notification APIPreference & dedup gate
  • Preference & dedup gatePer-channel queues
  • Per-channel queuesChannel workers
  • Channel workersProviders
  • Channel workersDelivery log
Filter
0/2 mastered
IntermediatenotificationsdeduplicationpreferencesAsked at Meta, Uber

30-second answer

Route every notification through a single gate that owns both concerns. Deduplicate on a caller-supplied idempotency key stored with a TTL, so retries and duplicate events collapse into one send. Enforce preferences as a layered check: global opt-out, then per-category, then per-channel, then quiet hours in the user's own time zone, then a frequency cap. Critical transactional messages - password resets, security alerts, payment failures - bypass marketing preferences but must still be deduplicated and rate limited.

AdvancedreliabilityretriesprovidersAsked at Twilio, Uber

30-second answer

Each channel needs at least two providers with automatic failover driven by a circuit breaker on error rate, not just on hard failures. Retries must distinguish transient errors - timeouts, 5xx, provider rate limits - which are retried with exponential backoff and jitter, from permanent errors like an invalid address or an unregistered device token, which must not be retried at all and should update the user's contact record. Queue depth grows during an outage, which is exactly what the queue is for, but you need a maximum age after which time-sensitive notifications are dropped rather than delivered uselessly late.

Showing 2 of 2 questions for design-a-notification-system.

Check your understanding

3 questions · no sign-up, nothing stored

0/3 answered
Question 1

1.A notification arrives during a user's quiet hours. What is the best behaviour?

Question 2

2.An email hard-bounces with 'mailbox does not exist'. What should happen?

Question 3

3.Why separate queues per channel?