CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/System Design Interview Classics

πŸ“ System Design Interview Classics Β· Data Flow

Social News Feed (Twitter-style)

How posts reach followers' feeds: fan-out on write for normal users, fan-out on read for celebrities, and a ranked feed built from a cache.

More System Design Interview Classics templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • Normal users' posts are pushed to followers' feed caches
  • Celebrity posts are merged in at read time to avoid millions of writes
  • Feeds are ranked before they are shown

Prompt used

Data flow for a social feed: a post is saved in the post store and sent to a fan-out service. For users with fewer than 10,000 followers the fan-out service writes the post ID into each follower's feed cache in Redis. For celebrities it does nothing at write time. When a user opens the app, the feed service reads their cached feed, merges recent posts from celebrities they follow, ranks them, and hydrates post details from the post store. Number the processes and label every flow.

Mermaid code
flowchart LR
subgraph EXT ["External entities"]
author["Author"]
reader["Reader"]
end
subgraph PROC ["Processes"]
p1("1.0 Create and Store Post")
p2("2.0 Fan-out Post to Followers")
p3("3.0 Fetch and Rank Feed")
p4("4.0 Hydrate Post Details")
end
subgraph STORE ["Data stores"]
d1[("D1 Post Store")]
d2[("D2 Redis Feed Cache")]
d3[("D3 Follow Graph Store")]
end
author -->|"Post content and Metadata"| p1
p1 -->|"Saved Post Data"| d1
p1 -->|"Post ID and Author ID"| p2
p2 -->|"Author ID query"| d3
d3 -->|"Follower IDs and Follower Count"| p2
p2 -->|"Post ID"| d2
reader -->|"Feed Request and Reader User ID"| p3
p3 -->|"Reader User ID"| d3
d3 -->|"List of Followed Celebrity IDs"| p3
d2 -->|"Cached Post IDs"| p3
p3 -->|"Celebrity User IDs"| d1
d1 -->|"Recent Celebrity Post IDs"| p3
p3 -->|"Merged and Ranked Post IDs"| p4
d1 -->|"Full Post Content and Details"| p4
p4 -->|"Hydrated Social Feed Data"| reader

Inside this diagram

A data flow diagram with 6 processes and outside parties, 3 data stores and 15 data flows.

Processes and outside parties

  • Author
  • Reader
  • 1.0 Create and Store Post
  • 2.0 Fan-out Post to Followers
  • 3.0 Fetch and Rank Feed
  • 4.0 Hydrate Post Details

Data stores

  • D1 Post Store
  • D2 Redis Feed Cache
  • D3 Follow Graph Store

Data flows

  • Author β†’ 1.0 Create and Store Post: Post content and Metadata
  • 1.0 Create and Store Post β†’ D1 Post Store: Saved Post Data
  • 1.0 Create and Store Post β†’ 2.0 Fan-out Post to Followers: Post ID and Author ID
  • 2.0 Fan-out Post to Followers β†’ D3 Follow Graph Store: Author ID query
  • D3 Follow Graph Store β†’ 2.0 Fan-out Post to Followers: Follower IDs and Follower Count
  • 2.0 Fan-out Post to Followers β†’ D2 Redis Feed Cache: Post ID
  • Reader β†’ 3.0 Fetch and Rank Feed: Feed Request and Reader User ID
  • 3.0 Fetch and Rank Feed β†’ D3 Follow Graph Store: Reader User ID
  • D3 Follow Graph Store β†’ 3.0 Fetch and Rank Feed: List of Followed Celebrity IDs
  • D2 Redis Feed Cache β†’ 3.0 Fetch and Rank Feed: Cached Post IDs
  • 3.0 Fetch and Rank Feed β†’ D1 Post Store: Celebrity User IDs
  • D1 Post Store β†’ 3.0 Fetch and Rank Feed: Recent Celebrity Post IDs
  • 3.0 Fetch and Rank Feed β†’ 4.0 Hydrate Post Details: Merged and Ranked Post IDs
  • D1 Post Store β†’ 4.0 Hydrate Post Details: Full Post Content and Details
  • 4.0 Hydrate Post Details β†’ Reader: Hydrated Social Feed Data

Boundaries

  • External entities: Author and Reader
  • Processes: 1.0 Create and Store Post, 2.0 Fan-out Post to Followers, 3.0 Fetch and Rank Feed and 4.0 Hydrate Post Details
  • Data stores: D1 Post Store, D2 Redis Feed Cache and D3 Follow Graph Store

Make your own diagram like this

Describe your own system in plain English and CloudSketch AI draws it in seconds. See all AI diagram generators.

Related templates

C4 ArchitectureProSystem Design Interview Classics

URL Shortener System Design

The classic interview design for a service like bit.ly: short code generation, fast redirects from a cache, and click analytics processed separately.

SequenceSystem Design Interview Classics

Chat App Message Delivery (WhatsApp-style)

How a one-to-one chat message is delivered in a WhatsApp-style system, with sent, delivered and read ticks, and push notifications when the receiver is offline.

C4 ArchitectureProSystem Design Interview Classics

Ride Matching System (Uber-style)

The core of a ride-hailing app: drivers stream their locations, a geo index finds nearby drivers, and a matching service offers the trip to the best one.

FlowchartSystem Design Interview Classics

API Rate Limiter (Token Bucket)

How a token bucket rate limiter decides whether to let an API request through, using Redis so all servers share the same counts.

DeploymentProSystem Design Interview Classics

Notification Service Design

A notification system that sends email, SMS and push messages at scale: one API, a queue per channel, user preferences, and retries.

Data FlowSystem Design Interview Classics

Search Autocomplete (Typeahead)

How search suggestions appear as you type: a prefix index built offline from past searches, served from memory, and refreshed regularly.