Practice/Amazon/Design a Video Sharing App
Design a Video Sharing App
System DesignOptional
Problem Statement
Design a short-form video sharing platform like TikTok or Instagram Reels where users upload, share, and view short videos. The system must handle video upload and transcoding, serve a personalized feed of videos, support social interactions (likes, comments, shares), and deliver smooth playback at scale. Focus on the upload-to-playback pipeline and the feed generation system.
Interviewers ask this to test your ability to design a media processing pipeline, build a recommendation-driven content feed, handle massive read-heavy traffic with CDN strategies, and manage the interplay between content creation and consumption at scale. Expect to discuss video encoding, content delivery, feed ranking, and real-time engagement tracking.
Key Requirements
Functional
- Video upload -- users upload short videos (up to 60 seconds) with titles, descriptions, tags, and music overlays
- Video playback -- users watch videos with adaptive bitrate streaming, smooth scrolling between videos, and minimal buffering
- Personalized feed -- users see a feed of recommended videos based on watch history, engagement patterns, and content preferences
- Social engagement -- users like, comment on, share, and follow creators, with real-time engagement count updates
Non-Functional
- Scalability -- support hundreds of millions of daily active users watching billions of videos per day, with millions of new uploads daily
- Reliability -- maintain 99.9% availability for video playback; zero data loss for uploaded videos
- Latency -- feed loading under 500ms, video playback start under 1 second, engagement actions reflected within 2 seconds
- Consistency -- strong consistency for upload status and user-generated content; eventual consistency for engagement counts and feed recommendations
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Video Upload and Transcoding Pipeline
Raw uploaded videos must be transcoded into multiple resolutions and formats before they can be served to viewers with different devices and network conditions.
Hints to consider:
- Accept uploads through a chunked upload API that supports resumable uploads for unreliable mobile connections
- Store raw uploads in object storage (S3) and trigger a transcoding pipeline that produces multiple renditions (360p, 720p, 1080p) in HLS or DASH format
- Use a distributed task queue (SQS or Kafka) to manage transcoding jobs across a fleet of GPU-equipped workers with priority levels
- Generate thumbnails, extract metadata, and run content moderation checks in parallel with transcoding to minimize time-to-publish
2. Content Delivery and Playback Performance
Billions of video views per day require an efficient CDN strategy to minimize origin load and deliver smooth playback globally.
Hints to consider:
- Serve video segments through a multi-tier CDN with edge caches close to users, mid-tier regional caches, and origin storage as the last resort
- Implement adaptive bitrate streaming so the player automatically adjusts quality based on the viewer's network bandwidth
- Pre-fetch the next few videos in the feed while the current video plays to eliminate loading delays during scrolling
- Cache popular videos aggressively at the edge while using longer TTLs; use cache warming for videos trending upward based on engagement velocity
3. Feed Generation and Ranking
The personalized feed is the core user experience. It must balance relevance, freshness, diversity, and creator fairness.
Hints to consider:
- Use a two-stage ranking system: a candidate generation stage retrieves hundreds of potential videos from multiple sources, then a ranking model scores and orders them
- Generate candidates from collaborative filtering (users who watched X also watched Y), content-based signals (tags, audio, visual features), and social graph (followed creators)
- Implement real-time feature updates (recent watch history, session engagement) alongside batch-computed features (long-term preferences) for ranking
- Cache pre-computed feed pages per user with a short TTL, regenerating on scroll or when the cache expires to balance freshness and latency
4. Engagement Tracking and Social Features
Likes, comments, shares, and view counts must update in near real-time while handling massive write throughput on viral videos.
Hints to consider:
- Use distributed counters (Redis or DynamoDB atomic increments) for engagement counts on viral videos, batching updates to avoid write hotspots
- Stream engagement events through Kafka for async processing: updating counts, feeding the recommendation engine, and notifying creators
- Store comments in a database with pagination support, using a fan-out-on-read approach since most videos have relatively few comments
- Implement rate limiting and spam detection on engagement actions to prevent bot-driven inflation of metrics
Suggested Approach
Step 1: Clarify Requirements
Confirm scope with the interviewer. Ask about video length limits, supported formats, and whether live streaming is in scope. Clarify the recommendation system depth: is a basic engagement-based feed sufficient or is ML-based personalization expected? Establish whether creator analytics, monetization, or content moderation pipelines are in scope. Determine geographic distribution and whether multi-region deployment is required.