MongoDB
Designing a Photo Sharing App
Architecture of an Instagram-like photo sharing platform — image upload, processing, CDN delivery, explore feed, and hashtag indexing.
S
srikanthtelkalapally888@gmail.com
Designing a Photo Sharing App
A photo sharing platform lets users upload, process, and share images with followers.
Requirements
- Upload photos up to 10MB
- Apply filters
- Follow users, view feed
- Explore / discover content
- Hashtags, location tags
- 500M users, 100M photos/day
Photo Upload Pipeline
Client uploads photo
↓
Upload Service → S3 (original)
↓
Message Queue (Kafka)
↓
Image Processing Workers:
- Resize: thumbnail, medium, large
- Apply filter (optional)
- Extract EXIF data
- Generate blurhash (placeholder)
↓
S3 (processed variants)
↓
CDN distribution
↓
Update photo metadata in DB
Storage Estimation
100M photos/day × 3 variants × 200KB avg = 60TB/day
→ CDN caches hot content
→ S3 Intelligent Tiering for cold storage
Metadata Database
photos(id, user_id, caption, location, created_at)
photo_urls(photo_id, size, s3_url)
hashtags(id, tag)
photo_hashtags(photo_id, hashtag_id)
Feed Generation
Same as news feed:
- Hybrid fan-out
- Redis sorted set per user (score = timestamp)
- Celebrity posts merged at read time
Explore / Discover
Content signals → ML pipeline → Explore feed
- Post engagement rate
- Similarity to liked content
- Geographic proximity
- Trending hashtags
Hashtag Indexing
Post created → Extract hashtags
→ Index in Elasticsearch
Hashtag search: #sunset
→ Elasticsearch query → Recent + popular photos
Stories (24-hour ephemeral)
Story uploaded → S3
Story metadata → Redis (TTL: 24 hours)
Viewer list → Redis SET per story
→ Auto-expire after 24 hours
Conclusion
Photo apps are CDN-first. Async image processing, hybrid feed fan-out, and Elasticsearch-powered hashtag search form the core architecture.