API Design for Twitter System Design
A basic API design for our services:
8.1 Post a Tweets:
This API will allow the user to post a tweet on the platform.
{
userID: UUID,
content: string,
mediaURL?: string
}
- User ID (
UUID
): ID of the user. - Content (
string
): Contents of the tweet. - Media URL (
string
): URL of the attached media (optional). - Result (
boolean
): Represents whether the operation was successful or not.
8.2 Follow or unfollow a user
This API will allow the user to follow or unfollow another user.
{
followerID: UUID,
followeeID: UUID
}
{
followerID: UUID,
followeeID: UUID
}
Parameters
- Follower ID (UUID): ID of the current user.
- Followee ID (UUID): ID of the user we want to follow or unfollow.
- Media URL (string): URL of the attached media (optional).
- Result (boolean): Represents whether the operation was successful or not.
8.3 Get NewsFeed
This API will return all the tweets to be shown within a given newsfeed.
{
userID: UUID
}
Parameters
- User ID (UUID): ID of the user.
- Tweets (Tweet[]): All the tweets to be shown within a given newsfeed.
Designing Twitter – A System Design Interview Question
Designing Twitter (or Facebook feed or Facebook search..) is a quite common question that interviewers ask candidates. A lot of candidates get afraid of this round more than the coding round because they don’t get an idea of what topics and tradeoffs they should cover within this limited timeframe.
Important Topics for Designing Twitter
- How Would You Design Twitter?
- Requirements for Twitter System Design
- Capacity Estimation for Twitter System Design
- Use Case Design for Twitter System Design
- Low Level Design for Twitter System Design
- High Level Design for Twitter System Design
- Data Model Design for Twitter System Design
- API Design for Twitter System Design
- Microservices Used for Twitter System Design
- Scalability for Twitter System Design