Social Media (Instagram)

Hard Social

Overview

Designing a Social Media platform (Instagram) combines photo/video storage, news feed, real-time features, and discovery. The question tests your ability to handle media uploads at scale, feed generation (push vs pull), stories (ephemeral content), and explore/recommendations. This design matters in interviews because it's a well-known product with multiple subsystems—each with its own scaling challenges. Demonstrating you understand CDN for media, fan-out for feed, and how to design for both read-heavy (feed) and write-heavy (upload) workloads shows you can architect complex social products. Meta and other companies ask this to see if you can reason about the full stack from client to storage.

Requirements

Functional

  • Upload photos/videos with captions
  • Follow users, view feed of posts
  • Stories (24-hour ephemeral)
  • Like, comment, direct message
  • Explore/discover content
  • Search users and hashtags

Non-Functional

  • Low latency — feed load <200ms
  • High availability — 99.99%
  • Media delivery — CDN, multiple resolutions
  • Scalability — billions of posts, millions of uploads/day

Capacity Estimation

Assume 1B users, 100M posts/day. 50M stories/day. 10B feed reads/day. Media: 100M * 5MB = 500TB/day upload.

Architecture Diagram

ClientsAPI GatewayUpload SvcFeed SvcStories SvcCDNSearch IndexMetadata Cache

Component Deep Dive

Media Upload Service

Accepts uploads, stores in object store. Generates thumbnails, multiple resolutions. Async processing.

Feed Service

Generates feed from followed users. Push (pre-compute) or pull. Ranking by engagement.

Story Service

Ephemeral content, 24h TTL. Separate pipeline. High write, high read, auto-delete.

CDN

Serves images/videos. Multiple resolutions. Reduces origin load.

Search/Discovery

Elasticsearch for users, hashtags. Recommendation engine for explore.

Notification Service

Push for likes, comments, new followers. Real-time delivery.

Database Design

Posts, users, follows in PostgreSQL/Cassandra. Media URLs in object store. Feed in Cassandra (push) or computed (pull). Stories in Redis with TTL or Cassandra with TTL.

API Design

MethodPathDescription
POST/api/postsUpload post. Multipart. Returns post_id.
GET/api/feedGet feed. Paginated.
POST/api/storiesPost story. Expires in 24h.
GET/api/exploreDiscover content. Personalized.

Scalability & Trade-offs

Related System Designs