Design of Instagram
Learn the high-level design of Instagram and understand its data model.
High-level design
Our system should allow us to upload, view, and search images and videos at a high level. To upload images and videos, we need to store them, and upon fetching, we need to retrieve the data from the storage. Moreover, the users should also be allowed to follow each other.
API design
This section describes APIs invoked by the users to perform different tasks (upload, like, and view photos/videos) on Instagram. We’ll implement REST APIs for these tasks. Let’s develop APIs for each of the following features:
- Post photos and videos
- Follow and unfollow users
- Like or dislike posts
- Search photos and videos
- Generate a news feed
All of the following calls will have a userID
, that uniquely specifies the user performing the action. We’ll only discuss new parameters in the calls.
Post photos or videos
The POST method is used to post photos/videos to the server from the user through the /postMedia
API. The /postMedia
API is as follows:
postMedia(userID, media_type,
...