37. Design a News Feed
1
The interview prompt2
37.1 What do you ask first?3
37.2 How big is this, really?4
37.3 What are the doors?5
37.4 What do we store?6
37.5 What does the whole system look like?7
37.6 Fan-out on write or on read?8
37.7 How do you solve the celebrity problem?9
37.8 How does ranking work?10
37.9 How do the feed cache and pagination work?11
37.10 What would you say in the last five minutes?12
Score yourself13
Variations to practise14
Sources15
Code lab37. Design a News Feed
Variations to practise
3 min read+10 XP
Chapters used
Approach (1), Estimation (2), Unique IDs (10), Blob storage (11), Caching (12, 13), Sharding (15), Message queues (22), Pub/sub and fan-out (23), APIs and pagination (24), CDNs (26).
Try these variations
Each is a common follow-up. Answer in two minutes, then check the sketch.
- "Delete a post." → Mark it deleted in the posts store; filter deleted IDs at hydration instead of removing them from millions of feeds.
- "Private accounts." → Fan out only to approved followers; check visibility at hydration too.
- "Show like counts live." → Counters updated asynchronously and cached per post; the feed shows a slightly stale count.
- "10× users." → More fan-out workers and cache shards; lower the celebrity threshold so fewer posts are pushed; cap feed length lower for less active users.