Interview Question: Design Facebook

When you think about designing Facebook, what all features of Facebook come to your mind?

  • Facebook Timeline
  • Uploading posts
  • Sending friend requests
  • Chatting with friends
  • Liking, commenting on posts

And how are you really going to cover all these features in an interview of around an hour or so when it took over a decade and over a hundred engineers to design these functions?

So first let’s make it clear what really has to be designed in the next 45 to 50 mins.

Step 1: Discuss Use Cases

Clarify with dialogue like this-

  • Interviewee: Apart from uploading posts, do we also have to include timeline generation?
  • Interviewer: No. Let's discuss uploading content and viewing profiles on connections. If time permits we will discuss timeline generation.

  • Interviewee: Will posts also contain videos and photos apart from the text?
  • Interviewer: Yes.

  • Interviewee: Do we have features like the number of likes and comments on posts?
  • Interviewer: Yes.

  • Interviewee: Will uploaders be able to see who has liked the posts?
  • Interviewer: Yes.

  • Interviewee: Can comments be liked?
  • Interviewer: Yes.

  • Interviewee: Is commenting on comments also allowed?
  • Interviewer: No. Let's not include this.

  • Interviewee: Do we also have to design a search bar for Facebook?
  • Interviewer: No.

  • Interviewee: Facebook also enables users to chat with other users. Should we include this feature too?
  • Interviewer: No.

  • Interviewee: How big is our user base?
  • Interviewer: Let's design for about 100 Million daily active users.

According to the above discussion, the interviewer might ask you to drop a few features. By asking such questions, you will understand what exact goal or final picture the interviewer has in their mind about the system.

Tip: The final question about the number ofdaily active users (DAU) is important. This way we will design for the right scale. Many system design features depend on how big our system is.

Let’s assume finally you jot down the following requirements-

  • Users should be able to upload posts.
  • Users can like and comment on each other’s posts.
  • Posts can contain photos and videos.
  • Both posts and comments can be liked but commenting or replying on comments are not yet expected.
  • Daily Active Users: 100M

So basically we have to design Facebook as it was in 2004 with no search and timeline generation feature. Simple right? If you are interested to know how Facebook has evolved, this is an interesting article.

With the above expectations, we know we need a basic version of Facebook. Our UI might look like-