Start Here

Tier 1 · Building Blocks

Scale Reads

Scale Writes

Database Selection

Traffic Control

Consistency & Coordination

Estimation

Tier 2 · Core Systems

Tier 3 · Location & Real-Time

Tier 4 · Infrastructure & Data

Tier 5 · Finance & Commerce

Tier 6 · Advanced & Collaborative

Phase 1: Clarify, Scope & Constraints


Interviewer: "Let's design Twitter — specifically the home timeline and trending topics features. How do you approach this?"

Candidate: "Good. Let me identify the user journeys I'll focus on:

  1. Tweet journey — User posts a tweet (text, optionally with media); it appears in their followers' timelines
  2. Timeline journey — User opens the app and sees a ranked home timeline of tweets from accounts they follow
  3. Trending journey — User sees a list of trending topics/hashtags in real time, filtered by location
  4. Search journey — User searches for tweets matching a keyword, seeing real-time results

The dominant complexity is the timeline delivery problem — specifically the write amplification challenge. Twitter has ~245M DAU and some users (Elon Musk, Barack Obama) have tens of millions of followers. A single tweet to 100M followers naive fan-out means 100M write operations. At 500M tweets/day that's potentially trillions of timeline writes — you cannot push everything synchronously.

WHY: The secondary complexity is trending topics — computing what's trending requires real-time stream processing of tweet velocity, not just volume. A topic trending since 2020 shouldn't outrank something that just went viral in the last 5 minutes. This is a sliding window velocity problem, not a simple count.

Non-goals for V1:

  • Twitter Spaces (audio rooms)
  • Twitter/X Premium features (long-form posts, priority ranking)
  • Direct Messages
  • Ads serving and monetization
  • Twitter API / developer platform

Interviewer: "What about the 'For You' algorithm-based timeline vs. the 'Following' chronological timeline? Both exist now."

Candidate: "Great distinction. I'll design…

In the full tutorial

  • Phase 2: High-Level Architecture
  • Phase 3: Deep Dive & Evolution
  • Phase 4: Robustness & Operations

Glossary history

Click dotted jargon to save explanations here.