System Design

News Feed

Design a social news feed like Instagram's or Facebook's home feed.

Functional requirements

  • Users can create posts (text + up to 10 photos/videos referenced by media ID) that appear in their followers' feeds.
  • Users can view a personalized, ranked home feed of recent posts from accounts they follow, with infinite scroll (paginated fetches).
  • Users can follow/unfollow other users; follow changes should be reflected in the feed within minutes.
  • Feed items display basic engagement counts (likes, comments) that are approximately current.
  • The feed should surface new content since the user's last visit while remaining stable during a single scrolling session (no items jumping around mid-scroll).

Non-functional requirements

  • Feed reads are the hot path: p99 feed-page load under 200ms (excluding media download, which comes from a CDN).
  • Eventual consistency is acceptable: a new post should appear in followers' feeds within ~30 seconds at p99; users must always see their OWN posts immediately (read-your-writes).
  • Highly available for reads: a degraded/stale feed is preferable to an error page during partial failures.
  • Posts are durable once the author sees a success acknowledgment, no lost posts, even if feed delivery is delayed.
  • Engagement counts may lag by up to a minute; exact real-time accuracy is not required.

Scaling & constraints

  • 500M DAU; average user opens the feed 10 times/day and fetches ~3 pages of 20 posts per session.
  • ~100M new posts per day; average post metadata ~1 KB (media stored separately in blob storage/CDN).
  • Read:write ratio for feed operations is roughly 100:1.
  • Median user follows ~200 accounts; the top 0.1% of accounts (celebrities/brands) have 1M to 200M followers each.
  • Posts must remain retrievable indefinitely, but the home feed only needs to cover the most recent ~30 days of content per followed account.
  • Traffic is diurnal with 3x peak-to-average, plus occasional viral spikes when a celebrity posts.

Out of scope

  • Media upload, transcoding, storage, and CDN delivery pipelines (assume a media service exists; posts reference media by ID).
  • Stories, reels, live video, and ephemeral content formats.
  • The ML model internals for ranking (assume a scoring function exists; focus on where/when scoring happens and what data it needs).
  • Ads insertion, content moderation, and spam/abuse detection.

Sign in to save your progress

AI design evaluation

Get a grounded score, what your design does well, its gaps, and what to study next.

Sign in to evaluate

Sign in to get AI feedback on your design.