The interview prompt

“Design a home feed showing posts from accounts a user follows.”

Begin with a reverse-chronological feed, not a personalized ranking model. Assume 10 million daily readers, 1 million daily posts, and highly uneven follower counts. Users expect their own posts to appear quickly; eventual propagation to followers is acceptable within a defined freshness target.

01. Separate posts from feed entries

Store the post once in a durable post service. Feed entries reference post IDs and ordering metadata. The follow graph, post visibility, blocks, and deletion state have their own authoritative records.

Propose POST /posts with an idempotency key and GET /feed with a cursor. Define behavior for private accounts, unfollows, deletions, and moderation. A precomputed feed is a candidate list, not final authorization.

Cursor pagination should remain stable enough to avoid repeated or skipped entries as new posts arrive. A snapshot boundary with a deterministic timestamp-and-ID tie-breaker is one possible policy.

02. Choose push, pull, or a hybrid

StrategyWhen work happensCost
Fan-out on writeInsert references into follower inboxes when a post is created.Fast reads; heavy writes for large audiences.
Fan-out on readMerge followed authors' posts when the user opens the feed.Cheaper publishing; more expensive reads.
HybridPush normal authors; pull selected high-fan-out authors.Balances workloads but complicates merging and freshness.

If a typical post has 200 eligible followers, one million posts imply roughly 200 million inbox inserts per day under full push. A single author with 10 million followers can create a very different burst. These illustrative counts motivate a hybrid rather than establish a universal threshold.

03. Make fan-out durable and repeatable

Publish to read
Post store + outboxFan-out workersFeed referencesHydrate + filter
The read path merges pulled authors, loads current post data, and enforces visibility.

Persist the post and its publication intent atomically, then process fan-out asynchronously. Partition work into bounded follower batches and checkpoint progress. Make an inbox insert idempotent with a key such as (recipient, post).

Store a bounded recent feed window and use another path for older history. Reconstruct a user's feed when necessary from authoritative posts and follows rather than treating the cache as the only copy.

For read-your-write behavior, merge the author's recent posts into their own response even if fan-out is still catching up.

04. Handle changing relationships

A user who unfollows an author may still have old references in an inbox. Filter by current visibility and relationship policy during reads, then clean up asynchronously. Deleted posts must not survive simply because their IDs were precomputed.

Specify whether follow changes affect only future posts or also recent history. For private content, current permission checks must happen before material is returned, including in caches.

If you later add learned ranking, separate candidate generation from scoring. Keep a chronological fallback and do not let the ranker decide authorization.

05. Operate the queue and hot paths

Measure fan-out lag, batch retries, inbox size, hydration latency, and stale-reference rates. A queue that is available but hours behind is still failing the freshness objective.

Prioritize active users or recent posts when that matches the product policy. Bound per-author work so one burst cannot starve everyone else. Cache hot posts independently of user feed references.

When the fan-out pipeline is delayed, a bounded pull supplement can preserve freshness, but it increases read cost. Test that degraded path under the same burst that caused the backlog.

06. Answer the follow-up

“Why not always push?”

Very large audiences and inactive followers can make write amplification wasteful. The threshold should reflect measured read frequency, follower distribution, and cost.

“The feed shows duplicates after retries.”

Check idempotency keys in fan-out and deduplication in the merge path. At-least-once event processing must not imply duplicate user-visible posts.

Common mistakes

Copying full posts into every feed, ignoring celebrities, trusting stale permission checks, or omitting a replayable publication path.

Sources & further reading

Apache Kafka: design for background on partitioned event processing. Fan-out choices and capacity estimates are original illustrative proposals.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.