When it comes to designing the API of the system the software engineers often consider different options like REST vs RPC vs GraphQL (or other hybrid

API Design of X (Twitter) Home Timeline

submited by
Style Pass
2024-12-12 21:00:06

When it comes to designing the API of the system the software engineers often consider different options like REST vs RPC vs GraphQL (or other hybrid approaches) to determine the best fit for a specific task or project.

In this article, we explore how the X (Twitter) home timeline (x.com/home) API is designed and what approaches they use to solve the following challenges:

We will only explore these challenges on the API level, treating the backend implementation as a black box, since we don't have access to the backend code itself.

Showing the exact requests and responses here might be cumbersome and hard to follow since the deeply nested and repetitive objects are hard to read. To make it easier to see the request/response payload structure, I've made my attempt to "type out" the home timeline API in TypeScript. So when it comes to the request/response examples I'll use the request and response types instead of actual JSON objects. Also, remember that the types are simplified and many properties are omitted for brevity.

You may find all types in types/x.ts file or at the bottom of this article in the "Appendix: All types in one place" section.

Leave a Comment