vishal patel
UnderstoodIntermediateUpdated 2026-09-23

Design: Notification System

Send email, SMS, push and webhooks at scale — fan-out, user preferences, retries, dedupe and provider failover.

fan-outqueueswebhooksretries

Requirements

  • Channels: email, SMS, push, in-app, webhooks. Triggers come from domain events or scheduled jobs.
  • Respect user preferences and quiet hours. Templates and localisation. At-least-once delivery without spamming duplicates.

Design

diagram

Key decisions

  • Queue per channel so a slow SMS provider doesn't block email (a bulkhead).
  • Dedupe key = eventId + userId + channel, checked before sending.
  • Retries with backoff: for webhooks, retry for hours to days with exponential backoff, then disable the endpoint and notify the owner.
  • Sign webhooks (HMAC with a timestamp) so receivers can verify them and reject replays.
  • Provider failover behind a circuit breaker for critical channels (OTP SMS).
  • Batching and digests to avoid a flood when 10k entries publish in one release.

Cheatsheet

The whole topic on one page. Click to open full screen.

Sources & further learning

Videos, courses, docs and books I recommend for this topic.

Related topics