Design an Image Feed
Design a newest-first image feed with durable media delivery, stable cursors, and removal propagation.
Problem statement
For this exercise, assume you are designing a service that presents an authenticated reader with a newest-first feed of immutable image items. An authorized upstream source creates an image item with caption and publication timestamp or removes an existing item.
Readers request stable cursor-paginated metadata and receive durable media-delivery URLs; removed items must stop appearing and must not be returned from a stale feed cache.
Also assume 100 million retained items, average image size of 4 megabytes, 5,000 ingestions and 200,000 feed reads per second at peak, 20 items per page, p95 metadata response below 150 milliseconds, and 99% of accepted items visible within 10 seconds.
Exclude image editing, comments, advertising, and personalized or social-graph ranking.
What to build
- Create immutable image items through an authorized, idempotent ingest path and publish metadata only after the durable image is verified.
- Return a newest-first, cursor-paginated feed whose ordering remains deterministic through concurrent inserts.
- Serve image bytes through versioned object identities and caches while keeping metadata and media ownership aligned.
- Remove an item from new feed reads and media authorization within a bounded interval, including cached paths.
At scalePractice assumption
- 100 million retained image items averaging 4 megabytes each.
- 5,000 ingestions and 200,000 feed reads per second at peak with 20 items per page and p95 metadata response below 150 milliseconds.
- 99% of accepted items become feed-visible within 10 seconds, while removals override stale feed and media caches through a bounded invalidation path.