System requirements


Functional:

Write and publish a tweet

Tweets can include photos and text

Users can follow other users

A User's home timeline displays tweets from other users they follow

A User can favorite a tweet

A User can comment on another User's tweet

A User should be able to login

A User should be able to create a profile

A User should be able to use a profile picture



Non-Functional:

The system should have high availability

A user's timeline should update in near-real time

A user's should receive notifications about interactions in near real time

A tweet is 250 char





Capacity estimation

The platform will support millions of active users - assume 500M


20-30% Tweets: 150M new tweets / day

A tweet is no more than 2 KB

300 GB of new tweets per day


30 - 40% of tweets include images

Average size of an image is 4MB

60M Tweet include images ~ .1PB / day






API design


HTTP Based design for Web Clients


GET/PATCH/POST - tweeter.com/users/{userid}

GET/POST - tweeter.com/users/{user}




Database design


User

-- User_ID (GUID)

-- DOB (date)

-- Name (string)



Tweet

-- Tweet_Id (GUID) PK

-- User_Id (GUID) FK

-- Image Path (string)

-- Time (Date)

-- Content (string)


Images (Object DB)



High-level design

You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...








Request flows

Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...






Detailed component design

Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...






Trade offs/Tech choices

Explain any trade offs you have made and why you made certain tech choices...






Failure scenarios/bottlenecks

Try to discuss as many failure scenarios/bottlenecks as possible.






Future improvements

What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?