12. Twitter


Design a social feed like twitter

Functional Requirements
  • The users should be able to follow other users.
  • The posts, statuses, and app activity of other people, pages, and groups they have followed should be visible to users.
  • On posts, users can "like", react and comment.
  • The most recent/trending posts ought to be immediately updated in the News Feed.
  • The Feeds can be text, images or videos.
  • There should be three sections to the timeline:
  1. Users Timeline: Users can view their own posts/tweets and posts they have shared on their timeline.
  2. Home Timeline: This will show the posts from users who are following them.
  3. Search Timeline: When users conduct a keyword or hashtag search, they are shown posts containing those specific terms.
Nonfunctional Requirements
  • The user should be able to post in just a few seconds. Only one and a half seconds of latency should be experienced by the user.
  • Users should be able to tweet/post millions of followers within a few seconds (5 seconds).
  • Each post is 1KB in size.
Estimated Usage
  • The system will have 1 billion DAU (Daily Active Users).
  • A user fetches the newsfeed 10 times per day.
  • Requires to handle 1e10 requests per day and about 116K QPS.

Seen this question in a real interview before?

Not all editor features are supported on mobile