Design a Notification System That Delivers Events to Users at Scale
MetaSoftware Engineer · OnsiteLast updated
A system design question on a notification platform that takes events from many product services and delivers them to users through push and in-app channels. It tests ingestion contracts, preference checks, grouping and rate limiting, priority isolation, third-party push delivery, and deduplication under retries.
Design the notification system for a large social platform. Many product services, such as comments, reactions, friend requests, messages, and event reminders, produce events that should become notifications. Notifications must reach users as push notifications on their mobile devices and appear in an in-app notification list; whether other channels such as email or SMS are needed is something to clarify.
Clarifying Questions
- Which channels are required: mobile push, in-app list, email, SMS?
- What is the daily event volume, and how bursty is it (for example, a viral post drawing a flood of reactions)?
- What latency does each notification type need, from a chat message to a weekly digest?
- Can users control notifications per type and per channel, and are quiet hours required?
- Which is worse for this product, a duplicate notification or a missed one?
Hints
Hint 1
Decouple the producers: Many product teams will send notifications. Think about the contract between them and your system, and what happens when one of them suddenly floods it.
Hint 2
Not every event deserves a buzz: Think about what should sit between "an event happened" and "the phone vibrates": preferences, grouping, and limits.
Follow-up questions
- A post goes viral and draws a flood of reactions for one user within minutes. What does that user receive?
- How do you avoid sending a notification twice when a worker crashes right after calling the push provider?
- How would you add a machine-learned "should we send this now" decision without adding much latency?
- How do you handle device tokens that have become invalid?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.