Design a Notification Center
Design a durable, user-scoped notification inbox with stable pagination and read state.
Problem statement
For this exercise, assume you are designing a notification center. Authenticated upstream producers create typed notifications for a recipient, and duplicate producer retries must not create duplicate entries.
A recipient can page through a newest-first inbox, see an unread count, mark one notification read, or mark all notifications through a stable cutoff read.
Also assume 50 million daily active users, 100,000 notification writes and 500,000 inbox reads per second at peak, 30-day retention, p95 first-page reads below 150 milliseconds, and 99% of accepted notifications visible within 5 seconds.
Exclude email, SMS, mobile push, notification-content authoring, and cross-user social ranking.
What to build
- Accept authorized producer events and create at most one user notification per producer idempotency identity.
- Return a newest-first, cursor-paginated recipient inbox with deterministic ordering through concurrent inserts.
- Support idempotent single-item read and mark-all-through-cutoff semantics with an explainable unread count.
- Expire old notifications and surface delayed fanout or stale counts without exposing another user's data.
At scalePractice assumption
- 50 million daily active users with 100,000 notification writes and 500,000 inbox reads per second at peak.
- 30-day retention, p95 first-page reads below 150 milliseconds, and accepted notifications visible within 5 seconds for 99% of healthy traffic.
- Users with unusually high producer fan-in must not monopolize shared fanout, storage, or cache capacity.