Design a Notification System That Delivers Events to Users at Scale
Company: Meta
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
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.
```hint 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 Not every event deserves a buzz
Think about what should sit between "an event happened" and "the phone vibrates": preferences, grouping, and limits.
```
### 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?
### What a Strong Answer Covers
- A producer API with an idempotency key and asynchronous ingestion through a durable log
- Preference, eligibility, and deduplication checks before sending
- Grouping of related events and per-user rate limits
- Channel-specific delivery workers and integration with third-party push providers
- In-app notification storage and unread counts
- Priority isolation so urgent notifications are never stuck behind bulk traffic
- Retries, provider failures, invalid device tokens, and expiry of stale notifications
- Delivery, open, and opt-out metrics
### 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?
Overview: 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.