Twitter API Design Decisions

Learn the different design considerations in Twitter's API and the reasons behind them.

This lesson covers the design considerations that will help us design an effective API for a service like Twitter. Before getting into the details of those design decisions, we will need to understand the end-to-end architecture of Twitter. Let's discuss the workflow of how Twitter APIs work.

Design overview

The following illustrations demonstrate a high-level view of how users are able to interact with the back-end services. Some of Twitter's functional requirements (that we defined in the previous lesson) have already been covered in this course. Now, we are interested in the creation process of Tweets and the generation of timelines for different users. The Tweet service allows the creation and storage of new Tweets, whereas the timeline service generates the timeline by interacting with multiple components, such as timeline generation, trendsTrends are phrases, words, or hashtags that are mentioned beyond a specific threshold in multiple Tweets. For example, if "Educative" goes over a specific threshold in Tweet mentions, it becomes a Twitter trend., people discovery, and ads. These services return the stream of Tweets, trends, suggestions for accounts to follow, and ads for different products to the timeline service. Moreover, the timeline service can return three different types of timelines (depending on the user's request), which are as follows:

  • Home timeline: This consists of the most recent Tweets of its followers with recommendations (ads, trends, and people to follow).

  • User timeline: This consists of the Tweets, Retweets, and recommendations of a specific user.

  • Mentions timeline: This returns the top N Tweets in which the logged-in user (@username) is tagged.

Let's see the details of how Tweets are sent to the system and how it generates a timeline.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.