Requirements
- Deliver notifications over push, email, and SMS from one pipeline.
- Be reliable, deduplicate, and respect user preferences.
- Handle provider failures without losing messages.
High level design
Events enter a queue, get enriched with templates and preferences, then dispatch to channel specific workers.
- Ingestion: producers drop events into a durable queue so spikes are buffered.
- Processing: a worker resolves the recipient, applies templates, and checks opt out preferences.
- Channel workers: separate senders call the push, email, and SMS providers with retries.
Bottlenecks
- Provider outages: wrap each provider with retries and a fallback, and use dead letter queues for repeated failures.
- Duplicates: an idempotency key per event stops a retried event from notifying twice.
- Rate limits: providers throttle, so workers respect per provider limits and queue overflow.
Track delivery status so you can report success, retries, and failures, and let users mute channels they do not want.
Key idea
A notification system is a queue fed pipeline that enriches events and dispatches them to per channel workers with retries, dedup, and preference checks.