Design News Feed

Personalized home feed inspired by Facebook's and Twitter's published designs: fan-out on write into precomputed feeds, hybrid pull for high-follower accounts, ranking at read time, plus search and trending. A teaching design, not either company's internal architecture.

Functional requirements

  • Display a personalized feed aggregating posts from followed users, ranked by recency and engagement.
  • Allow users to publish posts (text, images, videos) distributed to all followers.
  • Support likes, comments, and shares on posts in real-time.
  • Show trending topics and hashtags based on engagement volume in the last hour.
  • Allow full-text search of posts by keyword, hashtag, author, and date range.
  • Support infinite scroll with cursor-based pagination.
  • Send push/email notifications to followers when someone they follow posts.

Non-functional requirements

  • Feed read latency: p99 < 300ms for pre-computed cached feed.
  • Post publish response: < 100ms (async fanout, not blocking).
  • Fanout propagation: new post visible to all followers within 5 seconds (eventual consistency).
  • Search latency: p99 < 200ms for keyword/hashtag queries.
  • Availability: 99.9%+; feed degrades gracefully (serve stale cache) on partial failures.
  • Scale: 500M registered users, 100M DAU, 1B posts/day.
  • Media serving: p99 < 50ms for images/video via CDN.

How the design evolves

Stage 1: Single Server, Feed Built by One Query

See why computing every feed from scratch on each request can't scale.

What was missing: Nothing yet: one server and one database answer every feed request.

Why that's risky: Every refresh runs a join over hundreds of accounts' posts, and 200K refreshes per second crush one database.

What gets added: A server that builds each feed with a query over the posts of everyone the user follows, sorted by time.

Trade-offs: Always fresh and very simple, but the expensive work is repeated on every read.

Stage 2: Split Services and Caches (Still Pull)

Separate posts, the social graph and feeds, and cache hot data, while still building feeds on read.

What was missing: One server and one query did everything.

Why that's risky: Each feed read still fans out into reads of many accounts' posts, so the post cache takes several reads per refresh.

What gets added: A post service and sharded posts database, a social graph service and database, caches for posts and follow lists, and a feed service that merges followed accounts' recent posts on every request (pull).

Trade-offs: Pull keeps writes cheap and the feed always fresh, but read cost grows with how many accounts a user follows.

Stage 3: Fan-out on Write

Do the work once when a post is published, so every feed read is a single lookup.

What was missing: Feeds were assembled on every read.

Why that's risky: An account with 50 million followers makes one post cost 50 million writes, and the feed is purely chronological.

What gets added: A fan-out queue and workers: when someone posts, the post id is pushed into each follower's precomputed feed in the feed cache. Reading a feed is now one cache read plus hydrating the newest posts.

Trade-offs: Writes multiply by follower count (about 200 on average here) to make reads cheap; most users read far more than they post.

Stage 4: Hybrid Fan-out and Ranking

Handle accounts with huge followings and order the feed by what each reader cares about.

What was missing: Huge accounts made fan-out explode, and the feed was ordered only by time.

Why that's risky: There's no way to search posts or see what's trending.

What gets added: Hybrid fan-out: normal accounts are pushed as before, but posts from accounts with millions of followers are pulled at read time and merged in. A ranking service scores the candidates on affinity, content type, freshness and engagement.

Trade-offs: A little read-time work for celebrity posts in exchange for capping fan-out cost; ranking adds latency but improves relevance.

Stage 5: Search and Trending

Make posts searchable within seconds and surface what is rising.

What was missing: No search and no trending topics.

Why that's risky: Images and videos are still served by application servers, and nothing measures feed health.

What gets added: A post event stream feeding a search indexer and a trending counter over sliding windows, a search index over post text and hashtags, a trending cache and a search service.

Trade-offs: Search results lag posting by a few seconds; trends are approximate counts.

Stage 6: Media, CDN and Observability

Serve images and videos from the edge and watch the feed's health.

What was missing: Media had nowhere to live outside application servers, and nothing measured fan-out lag or cache hit rates.

Why that's risky: Remaining risk is regional: feed caches must be rebuilt or failed over if a region is lost.

What gets added: Object storage for images and videos, a CDN in front of it, and monitoring of feed latency, fan-out lag and cache hit rates.

Trade-offs: CDN copies may stay briefly after a post is deleted until they're invalidated.

PRISM
System Design Interview
Round 1 of 4 · Architecture Design · 60:00 remaining
PRISM logo
AI Interview
Interview Prep
Interview Challenges
Design Your Own System NEW
System Architectures
Design & Fix NEW
Interactive Roadmap System Design Guides
Notifications
  • No new notifications
Feedback
Signed in
Phase
Design Your Own System
Phase 01: Thinking in Systems
Upcoming

Components

User
CDN
Load Balancer
Server
Cache
Database
Blob Storage
Search Index
Queue
Worker
Rate Limiter
Service
API Gateway
Reverse Proxy
WebSocket Server
Third-party API

Inspector

Notes
Use clear names so your design intent is easy to understand.
Good
Name by business meaning
"Order API", "Restaurant Service"
Avoid
Generic names = zero signal
"Server 1", "API", "Queue"
A short description for each component makes feedback much better.
100%
Start by identifying:
  • Users & entry points
  • APIs & services
  • Databases & storage
  • Traffic flow & scale

Round 1 of 4 Architecture Design

Run a simulation to see results.

Time Remaining
60:00
System Design Interview

What are the core functional requirements?
What are the key non-functional constraints?

Questions

Start Evaluation to unlock questions.

Components Added
No components listed
Click "+ Add" to document components introduced in this stage.
Design Decisions

Click Simulate to run your design and see results here.

Internal notes — not shown to learners.

EVALUATE MODE

Test yourself like it's the real thing.

A structured 4-module evaluation that mirrors how top companies assess system design candidates.

Architecture Design
Draw your system on the canvas. Define components, connections, and data flow.
FR & NFR Requirements
Answer functional and non-functional requirement questions about your design.
MCQ Round
Multiple choice questions testing your depth on the chosen system.
Tradeoff Analysis
Justify your design decisions and defend your architectural tradeoffs.
AI Report Generated
A R S
Used by engineers preparing for FAANG & top-tier companies
Choose a Problem
No problem selected
  • 30 min
  • 45 min
  • 60 min
Round 2 of 4
MCQ Round
Answer multiple-choice questions based on your design.

Exit Interview?

You're in the middle of an interview session. Leaving now will end your current attempt.

Your progress will be saved.

Open a saved design

Select a design to load into the canvas.

My Evaluations

Your past evaluation sessions

Here’s a simple request flow that follows the expected layer order.

External User
→
Edge CDN → API Gateway → Load Balancer
→
Compute App Servers / Services
→
DataAccess Cache
→
Storage Database / Search Index
→
Async Queue → Worker

Tip: keep arrows moving forward through layers (Edge → Compute → Storage). Avoid sending storage back to compute.

Evaluation Instructions

Read the rules carefully before starting. The test auto-submits on refresh.

Before you start

  • Build your architecture on the canvas. The timer starts when you click Start Evaluation.
  • Don't forget to answer Functional Requirement and Non Functional Requirements.
  • When satisfied with your design, click Next to lock it and view the questions.
  • Please answer final step questions to complete the evaluation.

Dos

  • Do read each question carefully before answering.
  • Do include required components to maximize component coverage.
  • Do save a copy of your design if you want to keep it before submission.

Don'ts

  • Don't refresh or close the tab during an active evaluation — this will auto-submit your answers.
  • Don't switch app modes or open another tab while the evaluation is running.
  • Don't attempt to edit the design after clicking Next; the workspace will be locked.

All the best!!

Confirm

Input

Notice

Evaluation Report

Evaluation Complete

Generating Your Report

Hang tight — our AI is evaluating your design…

Did you know?

Loading…

Share feedback

Tell us what worked well and what we can improve.

Let's personalize this

Answer a couple of quick questions so we can tailor your journey and missions.

You can change this anytime from your Profile.

Your personalized missions are ready

We tailored these first steps based on your answers.

    PRISM Welcome Gift

    This is a personal welcome gift from PRISM.

    Congratulations.

    You explored PRISM.

    You earned Apprentice.

    As a welcome gift, unlock Full PRISM Access for the configured trial duration.

    This starts Trial. Trial timer begins only after you activate this gift.

    Welcome to PRISM

    We've prepared a personalized Apprentice Journey based on your goals and experience.

    This journey introduces you to the capabilities of PRISM that are most relevant to you.

    Complete all 8 missions to earn your Apprentice title. 8 MISSIONS

    PRISM Surprise Offer

    Complete your Apprentice Journey to unlock a special gift from PRISM.

    • No payment required
    • No credit card required
    • Just complete the journey
    MISSION CONTROL
    0 / 8 missions complete
    NEXT UP Continue your missions
    View full roadmap →
    Mission Complete 0 / 8 Completed Next: Keep going
    SYSTEM BRIEF

    ⬤ System Constraints

    What the system must do — every item is a user-facing behaviour your architecture must support.

      ↑ Engineering Constraints

      These are the failure modes you must design against — latency SLAs, durability targets, traffic ceilings.

        ⇆ Architecture Constraints

        ◈ Core Concepts to Master

        Your Journey
        PHASE – –
        0 / 0 0%
        0
        Mock Interview Checklist

        Pick a topic to start

        Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.

        Phase Mastered

        You've conquered this phase. These are the skills you now own:

          +500 XP

          Company Interview Paths

          Progress Summary