---
title: "How Do You Build a Social Media Feed? (System Design)"
url: https://daily.dev/posts/how-do-you-build-a-social-media-feed-system-design--avpzybzxl
source_url: https://milanjovanovic.tech/blog/how-do-you-build-a-social-media-feed-system-design
type: article
source: "Milan Jovanović"
published: 2026-08-14T19:32:03.955Z
updated: 2026-08-14T19:45:28.509Z
tags: ["career", "distributed-systems", "redis"]
reading_time: 10
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How Do You Build a Social Media Feed? (System Design)

**[Milan Jovanović](https://daily.dev/sources/milanjovanovic)** · 10 min read · 0 upvotes · 0 comments

## Summary

A deep dive into how social media home feeds scale from a naive read-time query to production-grade architectures. Covers fan-out on read versus fan-out on write, the single-writer rule for transactional consistency, write amplification caused by celebrity accounts with millions of followers, and the hybrid fan-out approach that combines materialized timelines with a celebrity index merged at read time. Also touches on ranked feeds (candidate generation, light/heavy ranking, re-ranking) as used by Twitter's open-sourced recommendation algorithm, and operational metrics like consumer lag and commit-to-visible latency. Ends with a plug for a system design practice tool called Katabench.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://milanjovanovic.tech/blog/how-do-you-build-a-social-media-feed-system-design>

## Questions this post answers

### What is the difference between fan-out on read and fan-out on write for a social media feed?

Fan-out on read computes the feed at query time by merging posts from all followed accounts live, while fan-out on write materializes each follower's timeline at publish time so reads become a single lookup. Twitter's numbers show roughly 300,000 timeline reads per second against about 5,000 new tweets, a 60-to-1 read-to-write ratio that justifies shifting the work to writes.

_Explore more real-world system design tradeoffs like this one on daily.dev._

### How do social media platforms handle celebrity accounts with millions of followers in feed fan-out systems?

Celebrity accounts are routed to a hybrid fan-out approach where ordinary authors keep fan-out on write, but celebrity posts are appended to a compact index keyed by author instead of being pushed to every follower's timeline, making publishing a single write regardless of follower count. At read time, the feed API merges the user's materialized timeline with recent candidates from celebrity indexes they follow.

_daily.dev helps engineers comparing feed architectures find writeups like this._

### How does Twitter's ranked feed algorithm decide what posts to show?

Twitter's open-sourced recommendation algorithm generates roughly half its candidates in-network and half out-of-network, then funnels them through a cheap light ranker to trim thousands down to a few hundred, before a neural heavy ranker scores each surviving post by predicting engagement probabilities like, reply, repost, and dwell time, followed by product rules such as diversity and integrity filters.

_Follow daily.dev for deeper dives into ranking pipelines behind major feed products._

---

Tags: [#career](https://daily.dev/tags/career), [#distributed-systems](https://daily.dev/tags/distributed-systems), [#redis](https://daily.dev/tags/redis)

[View this post on daily.dev](https://daily.dev/posts/how-do-you-build-a-social-media-feed-system-design--avpzybzxl)
