SystemKit

News Feed

Decide when a post reaches its readers. Compare fan-out on write and on read, handle accounts with millions of followers, and paginate a feed that keeps changing underneath the reader.

Lessons

  1. 01Define the feed promiseAgree on who can publish, who may read, and how fresh the timeline must feel.
  2. 02Commit the post before fanoutKeep one canonical post, then distribute lightweight references asynchronously.
  3. 03Keep media off the post rowStore post metadata and media bytes in systems suited to their different access patterns.
  4. 04Choose where fanout happensPush common posts to inboxes, pull very large audiences at read time, and mix both when needed.
  5. 05Assemble one feed pageGather candidate IDs, enforce current visibility, hydrate post data, and return a stable page.
  6. 06Separate candidates from orderStart with recency, then add ranking without making the source of truth depend on a score.
  7. 07Repair derived state when rules changeTreat timeline entries as disposable pointers and recheck access at the final read boundary.
  8. 08Measure the feed that readers receiveWatch publish-to-visible delay, queue lag, read latency, cache behavior, and privacy failures.

Practice this chapter

  1. TaskDesign a workout activity feed for a fitness appApply the news feed chapter to workouts, where a few athletes have huge followings, uploads arrive late, and a route map can reveal where someone lives.