Design a social media feed like Facebook or Twitter. How would you handle the news feed algorithm?

🏗️ System Design9/21/2025
System design for social media platform covering feed generation, content ranking algorithms, caching, and real-time updates.

Social Media Feed System Design

Functional Requirements

  • Users can post content
  • Users can follow other users
  • Generate personalized news feed
  • Real-time feed updates
  • Like, comment, share functionality

Feed Generation Approaches

1. Pull Model (Read-Heavy)

  • Generate feed on request
  • Query posts from followed users
  • Good for users with many followers

2. Push Model (Write-Heavy)

  • Pre-compute feeds when posts are created
  • Push to all followers' feeds
  • Good for users with few followers

3. Hybrid Approach

  • Push for regular users
  • Pull for celebrities
  • Best of both worlds

Ranking Algorithm Factors

  • Recency of post
  • User engagement (likes, comments, shares)
  • Relationship strength with author
  • Content type preferences
  • User activity patterns
By: System Admin