Notification Feed: Design a Scalable Real-Time Notification Delivery System
Question Details
Round 1 System Design
Problem
Design a notification feed system for a social platform. Users generate events (likes, comments, follows) that trigger notifications delivered to the relevant users in near-real-time. The system must support:
- Generating notifications from events
- Delivering them to online users via push and storing them for offline users
- Marking notifications as read
- Paginating a user's notification feed
Key Components
Event Producers -> Message Queue (Kafka) -> Notification Service
| |
Push (WebSocket) Storage (DB)
|
Feed API (paginated)
Schema (abbreviated):
sql
CREATE TABLE notifications (
id BIGINT PRIMARY KEY,
recipient_id BIGINT,
actor_id BIGINT,
type VARCHAR(50), -- "like", "comment", "follow"
entity_id BIGINT,
is_read BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP
);
Follow-ups
- How do you fan out a notification to 10M followers efficiently without blocking the event producer?
- How do you deduplicate — e.g., a user gets 50 likes in 5 minutes; show "50 people liked your post" not 50 separate notifications.
- What index strategy enables fast unread-count queries per user?
- How would you implement notification preferences — a user wants only follow notifications, no likes?
Full Details
Round 1 System Design
Problem
Design a notification feed system for a social platform. Users generate events (likes, comments, follows) that trigger notifications delivered to the relevant users in near-real-time. The system must support:
- Generating notifications from events
- Delivering them to online users via push and storing them for offline users
- Marking notifications as read
- Paginating a user's notification feed
Key Components
Event Producers -> Message Queue (Kafka) -> Notification Service
| |
Push (WebSocket) Storage (DB)
|
Feed API (paginated)
Schema (abbreviated):
sql
CREATE TABLE notifications (
id BIGINT PRIMARY KEY,
recipient_id BIGINT,
actor_id BIGINT,
type VARCHAR(50), -- "like", "comment", "follow"
entity_id BIGINT,
is_read BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP
);
Follow-ups
- How do you fan out a notification to 10M followers efficiently without blocking the event producer?
- How do you deduplicate — e.g., a user gets 50 likes in 5 minutes; show "50 people liked your post" not 50 separate notifications.
- What index strategy enables fast unread-count queries per user?
- How would you implement notification preferences — a user wants only follow notifications, no likes?
About This Question
This is a reported interview question from a patreon interview during the onsite round.
It covers the following topics: System Design, Sql, System Design, Queue, Onsite .