MentorNode
Start free
Social, Feed & EngagementHarddesign-photo-sharing

Design a Photo Sharing Service (Instagram)

Design upload-to-feed for photos and short video: derivative generation, metadata storage, feed fanout, and delivery that keeps a mobile scroll smooth on a bad connection.

Media PipelineFanoutCDN DeliveryMetadata Sharding
Traffic & Capacity Estimates:

500M DAU · 100M uploads/day · 5B feed views/day · 20:1 read:write

Functional Requirements

  • •Upload media directly to blob storage and generate resized, re-encoded derivatives asynchronously.
  • •Store post metadata, captions, tags, and engagement counters separately from the media bytes.
  • •Deliver the right derivative for the viewer's device and network conditions via CDN.
  • •Support likes, comments, and follower feeds on the same post objects.

Non-Functional Requirements

  • •Upload appears in the user's own profile immediately, even before derivatives finish.
  • •Feed images must be served from the edge with a hit ratio above 95%.
  • •Metadata reads must stay under 20ms at p99 across a sharded store.

Back-of-the-Envelope Math

  • 100M uploads/day * 2 MB average * 4 derivatives = ~800 TB/day of new object storage.
  • 5B feed views/day at 10 images each = 50B image requests/day — the CDN carries essentially all of it.

Key Architectural Trade-offs

  • Presigned direct-to-blob uploads take the bytes off your API tier entirely, at the cost of a more complex client and a post-upload validation step.
  • Eager derivative generation makes every view fast and wastes compute on posts nobody sees; lazy generation is cheap and adds first-view latency.
  • Engagement counters in the post row cause write hotspots on viral content — sharded counters or an approximate counter service trade exactness for survivability.

Click or drag a component onto the canvas, then connect the handles to draw the data flow.

3 nodes · 2 edges

Components · 35

Client & Edge4
Compute & Gateway7
Storage & Caching11
Messaging & Streaming6
Coordination & Ops5
Intelligence2
Canvas overview