Newsfeed Generation

Interview question: Design Facebook's Newsfeed/Timeline


Timeline/newsfeed is something which you see as soon as you open an app may it be Facebook, Twitter, Instagram, Quora, etc. If you are asked to design any one of these platforms, the interviewer might discuss newsfeed/timeline generation also alongside other features of the platform asked to design.

Facebook’s newsfeed is a scrollable version of life stories from your friends, connections, or pages which you follow. Facebook launched newsfeed in 2010 when it had 10 million users.

Your News Feed is made up of stories from your friends, Pages you've chosen to follow, and groups you've joined. Facebook users spend up to 40% of their time in the News Feed.

Let's design the same.

Step 1: Use Case Discussion:

  • Interviewee: Newsfeed will be made up of posts from user connections. Will posts contain media like photos and videos?
  • Interviewer: Yes

  • Interviewee: Do we also have to show the number of likes and comments for each post?
  • Interviewer: Yes

  • Interviewee: On what basis should we rank the posts?
  • Interviewer: Recent posts must appear up. Newsfeed must be shown such that relevant or posts from close friends must appear up. I.e the newsfeed must be unique for each user.

  • Interviewee: What is the scale of our application?
  • Interviewer: Let's consider the current user base of Facebook (2020).

From the above discussion, we have jot down the following feature requirements-

  • The news feed consists of posts from connections.
  • Posts can contain photos and videos.
  • Newsfeed must contain likes and comments for each post.
  • Newsfeed must be shown such that relevant or posts from close friends must appear up. I.e the newsfeed must be unique for each user.
  • Currently, as of 2020, the total Facebook user base is 1.5 billion. Let’s say out of 1.5B users 500M are daily active users.
Tip: The point is that at the interview if you need to come up with such numbers it's good to have some background knowledge. Sometimes the interviewer might give the estimates, sometimes won’t.