Social Media feed

Design a social media (Twitter/Facebook) timeline/feed

You have been asked to design a twitter feed by your interviewer so how are you going to approach it?

Most system design questions tend to be open ended and it is the candidates responsibilities to clarify the requirements, constraints and make necessary assumptions.

First of all, lets clarify the scope of the problem. Here are some possible use cases for this problem which should be clarified with the interviewer * User should be able to tweet to his timeline. * User should be able to upload media as part of his tweet. * User should be able to see recent tweets of all users whom he is following on his timeline. * User should be able to see his own tweets. * User should be able to follow other users. * User can see who is following him and whom he is following. * User should be able to block other users from following him. * User should be able to like tweets from another person.

Assumptions: * Registration and login are out of scope though it is always a good idea to show separate blocks for these functions.

Now lets make sure we know the constraints, here are some questions which can be asked to the interviewer to get this information: * How many followers on average will each user have? : 50 followers on average for each user. * Any limit on number of followers a person can have? : No limit but most popular users will have around 10K followers. * Number of tweets per day? : 10 million tweets per day. * Number of users? : 10 million users. * Number of active users per day? : 5 million active every day.

Lets first come up with a simple block diagram for this system which shows all required components.

Please let us know if there are any mistakes, missing edge cases or if you have a better solution in the comments section below.