Design a Twitter-like Microblogging Platform
Design a scalable microblogging platform similar to Twitter. Your solution should encompass API design, storage choices, and the feed generation approach. Ensure you address key system design considerations such as scalability, consistency, and pagination.
Core User Interactions
The platform must support the following fundamental user interactions:
- Tweet Management: Create and delete tweets.
- Tweet Viewing: View your own tweets and tweets from any specific account.
- Following: Follow and unfollow other accounts.
- Liking: Like and unlike tweets, even from accounts you do not follow.
- Social Graph Viewing: View lists of accounts that follow you and accounts you are following.
Home Feed (Dashboard)
A central feature is the personalized home feed, which must be paginated and display a curated list of "top X tweets" for each user.
Feed Prioritization Signals
The curation and ranking of tweets in the home feed should incorporate various signals, including but not limited to:
- Tweets from accounts the user follows.
- Tweets with a high number of likes.
- Tweets with a high number of recent likes.
- Recently created tweets.
- Tweets from accounts the user recently followed.
- Tweets from accounts the user recently viewed.
- Tweets from accounts the user views frequently.
Suggested Data Entities
Consider the following entities and their attributes as a starting point for your data model:
- Tweets:
tweet_id,text,account_id,created_at - Follows:
follow_from_account_id,follow_to_account_id,created_at - Likes:
tweet_id,liked_from_account_id,created_at - Accounts:
account_id,created_at
AI interview prep
Core dilemma
Balancing the extreme read amplification for personalized feeds (fan-out-on-read) with the high write throughput of tweets and social graph updates (fan-out-on-write), all while maintaining relevance and freshness for the feed.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design a Twitter-like Microblogging Platform
Design a scalable microblogging platform similar to Twitter. Your solution should encompass API design, storage choices, and the feed generation approach. Ensure you address key system design considerations such as scalability, consistency, and pagination.
Core User Interactions
The platform must support the following fundamental user interactions:
- Tweet Management: Create and delete tweets.
- Tweet Viewing: View your own tweets and tweets from any specific account.
- Following: Follow and unfollow other accounts.
- Liking: Like and unlike tweets, even from accounts you do not follow.
- Social Graph Viewing: View lists of accounts that follow you and accounts you are following.
Home Feed (Dashboard)
A central feature is the personalized home feed, which must be paginated and display a curated list of "top X tweets" for each user.
Feed Prioritization Signals
The curation and ranking of tweets in the home feed should incorporate various signals, including but not limited to:
- Tweets from accounts the user follows.
- Tweets with a high number of likes.
- Tweets with a high number of recent likes.
- Recently created tweets.
- Tweets from accounts the user recently followed.
- Tweets from accounts the user recently viewed.
- Tweets from accounts the user views frequently.
Suggested Data Entities
Consider the following entities and their attributes as a starting point for your data model:
- Tweets:
tweet_id,text,account_id,created_at - Follows:
follow_from_account_id,follow_to_account_id,created_at - Likes:
tweet_id,liked_from_account_id,created_at - Accounts:
account_id,created_at