Users upload photos straight to object storage, background workers create resized versions, and a fan-out service pushes each new post into followers' feeds. Celebrities are the exception — their posts are pulled in at read time so one upload doesn't trigger millions of writes. A CDN serves nearly every image.
Functional requirements
- Sign up, log in and edit a profile
- Upload photos and short videos with a caption and hashtags
- Follow and unfollow other users; private accounts need approval
- See a home feed of posts from people you follow
- Like and comment on posts
- Search users and hashtags; get notified about likes, comments and new followers
Non-functional requirements
- Feed loads in well under a second
- Hundreds of millions of daily users, very read-heavy
- Uploaded media is never lost
- Feeds, like counts and follower counts may be eventually consistent
- Privacy rules (private accounts, blocks) are always enforced
Extensions
- Stories that expire after 24 hours (TTL on storage and cache).
- Explore page ranked by an ML model over engagement signals.
- Direct messages over persistent connections.
- Reels: short video using the same transcoding and CDN path as YouTube.
- Content moderation with image classifiers before posts go public.