AI Hints
Home›System Design Tutorial›Case Study: Feeds and Notifications
System Design · Lesson 102 of 120

Notification System

Email, SMS, push.

⏱ 2 min read▶ Video at 2:03:50🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Shoply needs to send notifications. Order confirmed emails, delivery text messages, and phone push alerts. Millions a day, through several outside providers, without spamming anyone.

Notification System
From the video: Notification System
  • Email, SMS, push
  • Millions a day
  • No spam

The notification pipeline

Services publish a notification request, like order shipped for Sam. The notification service checks Sam's preferences, and rate limits, so nobody gets flooded. It fills in a template. Then it puts a job on a queue for each channel. Workers send through providers, like an email service, an SMS gateway, and Apple and Google push.

  1. Event
  2. Preferences + limits
  3. Template
  4. Channel queues
  5. Providers
The notification pipeline
From the video: The notification pipeline

Making it reliable

Providers fail sometimes, so workers retry with backoff, and failed jobs go to a dead letter queue. Each notification has an ID, so retries never send twice. Every send is logged, for support. And users can turn off any channel, which the system must always respect.

keyvalue
Retrieswith backoff
Idempotentno double sends
Dead lettersfor failures
Preferencesalways respected

Summary

A notification system checks preferences, fills templates, and sends through per channel queues, with retries and no duplicates. Next, video streaming.

Key takeaways
  • Preferences and limits
  • Queue per channel
  • Retry without duplicates
Next up: Video Streaming: Upload — from file to formats