Skip to content

Instagram feed system design interview: a worked guide

Design a home feed for photo and video posts. The hard part is deciding which posts to consider, how to rank them within a latency budget, and how to keep a very large author from multiplying work without limit. This is an interview proposal based on public engineering sources, not a claim about Instagram's private implementation.

Clarify what the prompt means by feed

Ask whether the feed contains only posts from followed accounts, or also recommendations from accounts the viewer does not follow. Meta has described these as different candidate sources: Home Feed uses accounts a person chose to follow, while Explore and suggested posts can use inferred interests. The product may combine them in one screen, but the design should keep their retrieval paths explicit. Read Meta's explanation of how Instagram suggests new content.

For this exercise, assume people can publish a photo or video, follow accounts, and load a personalized, paginated home feed. Include recommendations only if the interviewer asks for them. Treat comments, messaging, Stories, and video transcoding as separate systems unless the prompt adds them.

Ask the interviewer to set targets for first-page latency, how soon a new post should appear, and how much ranking quality can cost. Do not invent Instagram's traffic or service-level numbers. Use the agreed targets to choose the amount of precomputation and ranking work.

A practical feed architecture

Instagram home feed system designThe read path merges followed and recommended candidates, checks privacy and deletion state, ranks in stages, then hydrates and paginates posts. A separate asynchronous write path fans new post IDs out to active followers, while the post store remains the source of truth.READ PATH · BUILD A PAGE FROM CANDIDATESViewerfeed request + cursorFeed APIauthorize + start readCandidate mergefollowed + suggestedEligibilityprivacy + deletionsStaged rankingshortlist → deeper rankHydrate + paginatepost data + media URLsFeed pageordered items + cursorFollowed accountsgraph + recent timelinesRecommendationsretrieval from activityWRITE PATH · KEEP PUBLISHING INDEPENDENT OF DELIVERYPublish poststore before deliveryPost storesource of truthDurable queueretryable fan-out jobFan-out workersactive followers onlyTimeline cachederived post IDsprecompute active followers; merge huge accounts at read time
Keep candidate sources separate. The read path filters and ranks them; the write path prepares follower timelines asynchronously, while the post store remains authoritative.
  1. 1. Store the post and media separately

    Upload media to object storage, then save a post record and a fan-out event in the same transaction. Store the author, media key, visibility, creation time, and processing state. The post record remains the source of truth. Feed entries refer to post IDs instead of copying captions or media.

  2. 2. Build candidate sources

    Fetch recent posts from followed accounts. If the prompt includes recommended posts, add a separate source for those candidates. Merge and deduplicate the candidate IDs before ranking. This keeps the connected follow graph distinct from recommendations based on viewing and interaction history.

  3. 3. Keep fan-out bounded

    For ordinary accounts, process the durable fan-out event and write the post ID into active followers' timeline candidate lists. Skip inactive followers. For accounts above a follower threshold, merge recent posts at read time instead of writing to millions of timelines. The threshold is an interview parameter, not a public Instagram constant. The existing Twitter timeline exerciseworks through the read/write trade-off with figures from Twitter's published system in 2012 and 2013.

  4. 4. Rank in stages

    Check visibility and policy first, then apply a lightweight ranker to the remaining candidates. Run more expensive ranking on a smaller shortlist, then apply freshness and diversity rules. Recheck privacy and deletion state before returning the page. Meta describes retrieval, early ranking, and later ranking layers for Instagram recommendation surfaces in its article about scaling Instagram's recommendation system. Do not assume every surface uses the same model or pipeline.

  5. 5. Hydrate and paginate

    Fetch post metadata for the ranked IDs, attach media delivery URLs, and return a stable cursor. Recheck visibility and deletion when hydrating so stale candidate lists do not expose content that is no longer available. Use a cursor tied to the last returned ordering key rather than an offset that shifts as new posts arrive.

  6. 6. Measure more than clicks

    Track whether people hide or report a post, whether they see repeated authors, and whether the feed remains fresh. A ranking objective should balance useful interactions with negative feedback and integrity constraints. A click-only score can reward content that viewers quickly regret opening.

Decisions to explain in the interview

Start with a chronological feed if the prompt does not require recommendations. It is easier to explain and gives you a baseline. Add ranking when the requirements say the product should order by relevance or mix in suggested posts. Meta's public article on Instagram Explore describes retrieval and multiple ranking stages for Explore specifically. Use it as evidence for a staged design pattern, not as proof that Home Feed uses the same implementation: Instagram Explore recommendation design.

Fan-out on write makes common reads cheap, but multiplies each post by its audience size. Fan-out on read makes publishing cheap, but asks every reader to fetch and merge many authors. A hybrid handles the long-tail of very large accounts. These are trade-offs to calculate from the prompt, not universal rules.

Treat the feed cache as derived data. The post store owns the content, and the follow graph owns the relationships. If a worker fails, a durable queue can retry fan-out; idempotent inserts prevent duplicates. If a ranker times out, return a bounded fallback such as recent followed posts instead of holding the entire page open.

A 45-minute answer outline

  1. Minutes 0 to 5. Clarify home feed scope, recommendations, privacy, pagination, latency, and freshness.
  2. Minutes 5 to 10. Estimate the read/write ratio from interviewer-provided rates and choose what to precompute.
  3. Minutes 10 to 20. Draw post storage, follow graph, candidate sources, fan-out workers, and feed service.
  4. Minutes 20 to 35. Deep dive on ranking stages, large accounts, pagination, and privacy or deletion checks.
  5. Minutes 35 to 45. Walk through worker failures, stale candidates, ranker timeouts, and a change in the latency target.

Instagram feed system design questions

How do you design an Instagram feed in a system design interview?
Start by defining whether the prompt covers posts from followed accounts, recommended posts, or both. Build candidate sources for each, filter candidates against current privacy and deletion state, rank a manageable set in stages, and hydrate the selected posts for the client. State the latency, freshness, and ranking assumptions before choosing fan-out or read-time work.
How do you handle an account with millions of followers?
Fan out ordinary authors' post IDs asynchronously to active followers, but do not synchronously write a celebrity's post into every follower's timeline. Merge recent posts from very large accounts at read time or use a hybrid threshold. This caps write amplification while keeping the common read path short.
Is this Instagram's actual feed architecture?
No. This is a system design interview proposal, not a description of Instagram's private production system. It uses patterns described in public Meta Engineering articles and marks additional choices as interview assumptions.
How is a home feed different from Explore?
A home feed starts with sources a person chose to follow. Explore starts with candidates inferred from activity and other recommendation sources. Keep those candidate sources distinct, then apply shared filtering, ranking, and diversity steps where the product requires them.

Sources describe public engineering work from Meta. The proposed design is an interview exercise, and it does not reproduce Instagram's private system. More practice: 14 system design questions and worked answers. By SysGeeks.