Design a video platform like YouTube / Netflix
Design a service where people upload videos and other people watch them. Uploads come from phones on unreliable networks. Playback should start quickly and adapt to the viewer's connection.
About this problem
“Design a video platform like YouTube / Netflix” is a hard-level problem in the big files family. The payload is far bigger than the metadata, and it should not go through your servers at all.
The key challenge: Uploading and processing have hours of slack. Starting playback has almost none. Designing both paths the same way is the usual way to fail this problem.
Time budgets: Processing: minutes. Playback start: under 2 seconds. Upload: hours if needed.
The worked solution for Video platform goes through why those budgets shape the design, stage by stage.
Before you start
You will work this in five timed stages. Here is what each one asks you to think about. None of it is the answer; the answers unlock in the workspace below once you have written your own.
- Stage 1 · Requirements · 5 min
- What is the first thing to say about where the bytes travel?
- Is playback public or access-controlled? That changes caching completely.
- Live or on-demand? Do not assume silently.
- Stage 2 · Actors and lifecycle · 6 min
- Phones on trains lose connections. What does that do to a 500 MB upload?
- Transcoding takes minutes and can fail. Then what?
- What does the uploader see between upload and watchable?
- Stage 3 · Numbers · 6 min
- Storage is cheap and easy to estimate. Do not stop there.
- What does transcoding multiply your storage by?
- Compare the cost of storing a video with the cost of serving it.
- Stage 4 · High-level design · 12 min
- Where do the bytes go on upload? Not through your servers, hopefully.
- What is a "segment" and why does it exist?
- How does the player decide which quality to fetch?
- Stage 5 · Deep dive and tradeoffs · 14 min
- The numbers pointed at egress. What drives the cache hit rate?
- A video goes viral in one country. What happens?
- How do you make a phone on a train succeed at a 500 MB upload?
Work it through
Five stages, gated. You write your answer for each stage before its model answer unlocks. That is the core of the method.
Done all five? The diagrams, numbers, trade-offs and follow-ups for this problem are on the worked solution page, to check your own design against.
How it is really built
Write your own answer first. Then read how teams who run this at scale describe it. Their constraints were real, and the write-ups often say what their choices cost.
- RFC 8216 — HTTP Live Streaming ↗The HLS spec. Playlists and segments are plain HTTP files, which is why a CDN can cache them like any other object.