Skip to the guide

Design a news feed (like Facebook or X)

IntermediateCase study12 pages

The news feed gathers posts from the accounts each reader follows, orders them and serves them a page at a time, with no end to the scrolling. It's a newspaper delivered to every door, except each household gets its own edition.

It's also asked as "design Twitter's timeline"; the closest case study is Photo sharing, the same feed with the uploads behind it. Interviewers like it because every post meets millions of readers. The round turns on whether the work happens when a post is written or when the feed is read, and on the few accounts so popular that the usual answer breaks.

Below is a full mock interview following the seven steps of the framework. You're the candidate: at each Guess before you read on, stop and answer first.

Step 1 · Clarify the features and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design a news feed, like Facebook's or X's.

You: A few questions first. Only accounts I follow, or suggestions too? Ranked?

Interviewer: Mostly accounts you follow, plus some suggested posts. Ranked.

You: What's in a post, and can it change after posting?

Interviewer: Text and photos. Authors can edit or delete, choose who sees each post, and block anyone.

You: Are follows one-way, as on X, and how big can an account get?

Interviewer: One-way. The biggest have tens of millions of followers.

You: Do readers see likes, and does the feed change while I'm reading it?

Interviewer: Like counts, yes. New posts can wait until you refresh.

You: Then I'll cover posting, following, a ranked feed with suggestions, like counts, edits, deletes, audiences and blocks. Out: comments, search, ads, notifications, messaging, and photo uploads, treated as links. OK?

Interviewer: Fine.

Each answer shapes the design: huge one-way accounts break pushing alone, ranking decides the order at read, waiting for a refresh lets a session keep one order, and blocks filter every page.

Step 2 · Non-functional requirements

Minutes 5–8 · How this step works

You: Say 100 million daily users who open 20 feed pages a day, 10 posts a page, and 10 million new posts a day. A page within 200 ms at p99, measured at our servers. Reading the feed is 99.99% available, about 4.3 minutes down a month, and posting 99.9%. A post is never lost once its author sees it, and it reaches followers' next refresh within about 5 seconds. A delete or a block takes it off the next page, and like counts can be a few seconds behind.