Design a News Feed
Build a paginated feed that handles high-fan-out authors, fresh posts and visibility changes.
Backend and product engineers designing software behavior.
Your approach: Use diagrams, tables or prose for customer contracts, state transitions and data ownership; include APIs only to the depth the question requests.
The problem
Design a following-based news feed, starting with reverse chronological order. Follow publication through feed reads and pagination, including a high-fan-out author. Explain how deletion and privacy changes affect precomputed entries before discussing an optional ranked feed.
- There are 10 million daily active users, each opening their feed 20 times/day.
- Publish 20 million posts/day; a few authors have over 5 million followers.
- Users follow and unfollow authors. Authors can delete posts or make their account private.
Work within these constraints
Declare p95 server latency for a page of 20 entries.
Required target: ≤ 300 milliseconds
Do not expose a deleted or unauthorized post solely because a feed entry was precomputed.
Explain duplicates and omissions when new posts arrive between page requests.
What to deliver
Data and API
Define posts, follows, feed entries and cursors.
Publication and feed assembly
Show push, pull or hybrid responsibilities and high-fan-out handling.
Capacity estimates
Estimate feed-read QPS and fan-out work with explicit follow-count assumptions.
Freshness and privacy walkthrough
Trace a backlog and a privacy change, comparing latency, freshness and write amplification.