System Design Arena
System Design: Video Streaming Platform (like YouTube)
Break the problem into upload, processing, delivery, and engagement-just like you would during a senior-level interview.
Case Study
Video Streaming Platform
Same conversation, diagrams, and wrap-up you expectโnow framed with clearer scaffolding and iconography.
Prompt
Build a user-generated video platform supporting hour-long uploads, adaptive streaming, moderation, and creator analytics at global scale.
Interview snapshot
- โข Topic: Video Streaming Platform
- โข Expected depth: 45 - 60 minutes
- โข Focus areas: APIs, scale estimation, resilient architecture
- โข Wrap-up: risk, monitoring, disaster recovery
Key takeaways
- โข Creators upload, edit metadata, set privacy, manage monetization.
- โข Upload success >99.9% across regions.
- โข POST /api/videos - returns signed upload URL + metadata record, enqueues processing job.
๐๏ธ Interview mode
Practice this like a real interview
Don't read the answer first. Work the framework against the bare prompt, then compare against what the interviewer expected at each step.
Scorecard
What the interviewer is evaluating
Staff-level signal
Does the candidate split the write path (upload โ transcode โ distribute) from the read path (CDN-served playback) and treat them as different systems with different budgets?
๐ง Staff engineer judgment
The database barely matters here. If you are debating SQL vs NoSQL for video metadata before you have drawn the transcoding pipeline, you are designing the wrong system.
Calibration
The common (bad) answer
User โ API โ Video Service โ Storage
โ
Databaseโ Why this scores poorly: Ignores the two facts that define video: files are huge (transcoding is a pipeline, not a call) and playback is 99.9% of traffic (the CDN IS the product).
โ What a strong answer adds
- Estimate storage per minute of upload across renditions โ the number justifies everything else.
- Design upload as resumable chunks feeding an async transcoding DAG.
- Serve playback from CDN with signed URLs; origin only on cache miss.
- Adaptive bitrate (HLS/DASH) as the mechanism connecting transcoding to smooth playback.
- Keep metadata (views, titles) in a separate, boring CRUD system.
Build it up
Step-by-Step Walkthrough
Video is a bytes problem wearing an app-server costume. The interview is won by separating three flows early โ upload, processing, delivery โ and letting each one scale on its own terms.
Naive: upload through the app server, serve the file back
One service, one endpoint. POST /api/videos streams the whole file through your web server onto attached storage; GET streams it back out. Metadata is a row in SQL. For a handful of videos this genuinely works.
Then say the sizes out loud: a single upload is ~200 MB, and a flaky mobile connection at minute nine of a ten-minute upload restarts from zero. Your web server is now a file-transfer proxy burning connections on multi-minute requests, and every viewer pulls the one original file at whatever bitrate their network can't sustain.
?Do the ingest math before drawing anything
On the order of ~500K uploads/day at ~200 MB each is ~100 TB/day of ingest โ ~300 TB/day after triple replication, before renditions. That single number justifies object storage, an async pipeline, and storage tiering in one breath.
Get the bytes off your servers: signed URLs + resumable chunks
The fix is to stop proxying bytes. POST /api/videos creates the metadata record and returns a signed URL; the client uploads directly to object storage (S3/GCS) in chunks, each retryable and idempotent under an uploadId. A dropped connection resumes at the last acknowledged chunk instead of restarting.
When the final chunk lands, storage emits a completion event onto an event bus. Your API tier never touched the video โ it only brokered permission. This is the upload contract interviewers want stated explicitly: signed URLs, chunking, idempotency, resume.
Processing is a DAG, not a function call
One file can't serve a phone on 3G and a TV on fiber. The completion event feeds Kafka; a fleet of transcoding workers fans each video out into ~6 renditions (multiple resolutions and bitrates), segments them for HLS/DASH, and writes results back to object storage before flipping the metadata row to available.
Renditions add roughly ~0.6x the original size โ on the order of another ~120 TB/day โ and peak load wants ~tens of thousands of concurrent transcode jobs, so the fleet autoscales on queue depth. Jobs must be idempotent: a worker that dies mid-encode gets its job redelivered, and re-running it must be safe.
!The retry question is coming
Interviewers will ask what happens when a transcode fails halfway. The answer is idempotent jobs keyed by (videoId, rendition) writing to deterministic paths โ retries overwrite, never duplicate. Without that, your storage fills with orphaned half-renditions.
Delivery: the CDN is the product
Playback is GET manifest.m3u8 โ signed CDN URLs โ the player adaptively picks renditions segment by segment. At ~5M concurrent viewers around ~3 Mbps, egress is on the order of ~15 Tbps โ your origin cannot serve that, so you need a >95% CDN offload rate, with an origin shield collapsing edge misses so storage sees one fetch per segment, not thousands.
Private and unlisted videos ride the same edge: tokens embedded in the signed segment URLs are validated at the POP, so authorization never adds an origin round trip. Playback start under ~2 s comes from the manifest listing a low-bitrate first segment the edge almost certainly has cached.
Engagement, analytics, and the moderation lane
Likes and comments are high-write, low-consistency data โ they go to a NoSQL store plus a search index, not the relational metadata DB. Watch events stream into the analytics lake, powering creator dashboards that are eventually consistent by design; nobody needs view counts accurate to the second.
Moderation is the lane candidates forget: an ML service scores every upload for risk during processing, flagged content routes to a human review tool that fetches assets via signed URLs, and copyright fingerprinting (Content ID-style) runs as one more consumer of the same processing events. Raising takedowns unprompted is a strong senior signal.
Blueprint
Architecture Diagram
The narrated components above, laid out as an actual flow โ so you can see how a request moves through the system, not just read a list of pieces.
Upload flow
client
upload gateway
signed URL (S3/GCS)
object storage
event bus
Processing
Kafka
transcoding workers
storage
metadata DB update
publish availability event
Delivery
CDN edges serve
CDN edges serve HLS/DASH
origin shield protects
origin shield protects storage
token-based auth for
token-based auth for private videos
Engagement
likes/comments in NoSQL + search index
watch events stream into analytics lake
Moderation
ML service labels risk
ML service labels risk, human review tool fetches assets via signed URLs
Flow Diagram
How the API maps to this flow
- 1
POST /api/videosโ returns signed upload URL + metadata record, enqueues processing job. - 2
POST /api/videos/{id}/chunksโ resumable upload chunk endpoint (idempotent with uploadId). - 3
GET /api/videos/{id}/manifest.m3u8โ ABR manifest referencing signed CDN URLs. - 4
GET /api/videos/{id}/statsโ aggregated watch metrics. - 5
POST /api/videos/{id}/moderationโ flag video for review.
?But why does this actually hold up at scale?
500K uploads/day * 200 MB ~ 100 TB ingest; triple replication = 300 TB/day growth before tiering.
Video walkthrough
Design YouTube โ System Design Interview
NeetCode ยท 26 min
Upload pipeline, transcoding and CDN delivery, explained in the order an interviewer expects to hear them.
Work the prompt yourself first โ guided practice grades your own answer step by step. Watching someone else design it feels like progress and teaches you far less.
Interview flow
Dialogue timeline
Interviewer
State the core flows.
Candidate
Creators upload via signed URLs, videos get processed into multiple renditions, viewers stream via CDN, and engagement data feeds analytics and recommendations.
Interviewer
How do uploads stay reliable?
Candidate
Use resumable chunk uploads to object storage, with a control plane tracking state. Metadata writes go to SQL, and uploads emit events to kick off processing.
Interviewer
Processing pipeline?
Candidate
Kafka queue fans out to autoscaled transcoding workers (FFmpeg). Each worker writes renditions + thumbnails, updates metadata state machine, and publishes completion events.
Interviewer
Describe playback and analytics.
Candidate
CDN serves manifests and segments with token auth. Watch/like/comment events stream through Kafka -> Flink -> BigQuery for dashboards and recommender training.
Scoping
Requirements & trade-offs
Functional Requirements
- โCreators upload, edit metadata, set privacy, manage monetization.
- โViewers search, subscribe, stream via adaptive bitrate, interact (likes/comments).
- โReal-time creator dashboards for views/watch time/RPM.
- โModeration workflows for flags, copyright claims, takedowns.
Non-Functional Requirements
- โUpload success >99.9% across regions.
- โPlayback start <2 s for 95th percentile viewers.
- โStorage durability 11 nines with multi-region replication.
- โCost controls: cold storage tiering, autoscaled transcoding, CDN offload >95%.
Blueprint
Architecture modules
Module 1
API Endpoints
- โขPOST /api/videos - returns signed upload URL + metadata record, enqueues processing job.
- โขPOST /api/videos/{id}/chunks - resumable upload chunk endpoint (idempotent with uploadId).
- โขGET /api/videos/{id}/manifest.m3u8 - ABR manifest referencing signed CDN URLs.
- โขGET /api/videos/{id}/stats - aggregated watch metrics.
- โขPOST /api/videos/{id}/moderation - flag video for review.
Module 2
Back-of-the-Envelope
- โข500K uploads/day * 200 MB ~ 100 TB ingest; triple replication = 300 TB/day growth before tiering.
- โขEach video -> 6 renditions (~0.6x size) ~ 120 TB/day extra. Autoscale transcoding fleet to ~20K concurrent jobs peak.
- โข5M concurrent viewers @3 Mbps ~ 15 Tbps egress; CDN needed for 95% hit rate.
- โขMetadata DB: 500K rows/day * 2 KB ~ 1 GB/day; partition by upload date, archive after 1 year.
Module 3
System Diagram Notes
- โขUpload flow: client -> upload gateway -> signed URL (S3/GCS) -> object storage -> event bus.
- โขProcessing: Kafka -> transcoding workers -> storage -> metadata DB update -> publish availability event.
- โขDelivery: CDN edges serve HLS/DASH; origin shield protects storage; token-based auth for private videos.
- โขEngagement: likes/comments in NoSQL + search index; watch events stream into analytics lake.
- โขModeration: ML service labels risk, human review tool fetches assets via signed URLs.
Module 4
Design Playbook
- โขStart with upload contract, retries, signed URLs.
- โขExplain processing DAG and failure retries (idempotent jobs).
- โขDiscuss CDN strategy, cache keys, token auth.
- โขCover moderation + copyright (fingerprinting, DMCA).
- โขTalk monitoring: ingest latency, transcoding backlog, CDN cache hit ratio, analytics lag.
- โขEnd with DR: multi-region storage replication, config rollbacks, chaos tests on processing fleet.