← Back to All Questions
Easy~45 minSocial Media

Design Instagram - Photo Sharing Platform

MetaGoogleAmazonPinterestSnapchat

šŸ“ Problem Description

Design a photo-sharing social media platform like Instagram where users can upload photos, apply filters, follow other users, and see a feed of photos from people they follow. Support likes, comments, and stories.

šŸ‘¤ Use Cases

1.
User wants to upload a photo with filters so that photo is processed and shared with followers
2.
User wants to follow another user so that they see that user's photos in their feed
3.
User wants to scroll through feed so that they see photos from followed users
4.
User wants to like or comment on a photo so that engagement is recorded
5.
User wants to post a story so that it appears for 24 hours to followers

āœ… Functional Requirements

  • •Upload photos with filters and captions
  • •Follow/unfollow users
  • •View personalized feed
  • •Like, comment, save photos
  • •Stories (24-hour ephemeral content)
  • •Explore page with trending content
  • •Direct messaging
  • •User profiles with photo grid

⚔ Non-Functional Requirements

  • •Photo upload and processing < 5 seconds
  • •Feed load time < 500ms
  • •Support 1 billion users
  • •Handle 100M photo uploads per day
  • •99.99% availability

āš ļø Constraints & Assumptions

  • •Photo size: up to 10MB
  • •Generate multiple resolutions (thumbnail, medium, full)
  • •Stories expire after 24 hours
  • •Feed shows posts from last 7 days primarily

šŸ“Š Capacity Estimation

šŸ‘„ Users
1B monthly active, 500M daily active
šŸ’¾ Storage
50PB for photos (500M DAU Ɨ 2 photos Ɨ 5MB Ɨ 365 days)
⚔ QPS
Uploads: 2K/sec, Feed reads: 100K/sec
🌐 Bandwidth
10PB/day (photos served)
šŸ“ Assumptions
  • • 500M DAU
  • • Average user uploads 2 photos/day
  • • Average photo: 5MB original, 2MB after compression
  • • 50:1 read to write ratio

šŸ’” Key Concepts

CRITICAL
Image Resizing
Generate multiple resolutions for different use cases: thumbnails for grid, medium for feed, full for detail view.
CRITICAL
CDN for Photos
90%+ of photo requests served from edge cache. Critical for global low-latency delivery.
HIGH
Fan-out on Write
When user posts, push photo_id to all followers' timelines for fast reads.
HIGH
Async Processing
Upload returns quickly, image processing happens in background.

šŸ’” Interview Tips

  • šŸ’”Focus on the photo upload and processing pipeline
  • šŸ’”Explain CDN usage for photo delivery
  • šŸ’”Discuss feed generation using fan-out
  • šŸ’”Mention async processing for good UX
  • šŸ’”Be ready to discuss Stories as a key differentiator
  • šŸ’”Explain Explore page ranking and personalization
  • šŸ’”Cover Reels recommendation if asked about video
  • šŸ’”Discuss content moderation for image-heavy platform