Design a Recency-Ordered Home Feed for a Social App
Company: Nextdoor
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
Design the home feed of a social app: when users open the app, they see posts from the sources they are connected to, newest first, and can keep scrolling to load older posts. Ranking is out of scope; the feed is ordered by recency only. The report gives no scale or product details beyond that, so settle them with the interviewer before designing.
```hint When to do the work
Compare building each user's feed when a post is written with building it when the feed is read, and ask which kinds of sources make each choice expensive.
```
```hint Scrolling while posts arrive
Think about how the client asks for the next, older page while new posts keep appearing at the top of the feed.
```
### Clarifying Questions
- Which posts belong in a user's feed: posts by people they follow, posts from groups or local communities they joined, or all of these?
- How many daily active users are there, how many posts are written per day, and how many members does a typical and a very large source have?
- How fresh must the feed be: should a new post appear within seconds, and must authors see their own post at once?
- Can posts be edited or deleted, and can users block each other or leave a source?
- How far back can a user scroll: a fixed number of posts, a time window, or everything?
### What a Strong Answer Covers
- Requirements and estimates: feed sources, read and write rates, freshness and page size
- A data model for posts, memberships and per-user feed storage, with ids that sort by time
- A choice between fan-out on write, fan-out on read or a hybrid, justified by the estimates, including very large sources
- Stable cursor-based pagination by recency and a way to surface newly arrived posts
- Deletions, blocks, new memberships and departures reflected correctly in feeds
- Caching, sharding, failure handling, and the metrics that show the feed is healthy
### Follow-up Questions
- One source has millions of members and posts often. How does your design handle it?
- A user joins a new group or community. How do its recent posts appear in their feed?
- A post is deleted, or its author is blocked by a reader. How quickly does it disappear from feeds, and how?
- How do you make sure users see their own new post at the top of their feed immediately?
Overview: A system design question asking for a social app's home feed ordered purely by recency, with ranking explicitly out of scope. It tests fan-out on write versus fan-out on read for large sources, feed storage, cursor pagination while new posts arrive, deletions and privacy, caching and failure handling.