Chapter 11 · High Level Design
Revision sheet
Every lesson's idea and recap on one page. Read it before an interview, or print it.
-
11.1HLD Overview
One frame, eight steps, forty-five minutes — the structure is what's being graded, not the trivia.
- Eight steps, in order, every time — the frame is the skill.
- Five minutes scoping, fifteen minutes of depth, always a trade-off close.
- Frontend HLD is about rendering, state, transport, and components — not databases.
-
11.2HLD – Photo Sharing App (Instagram)
An image pipeline feeding an infinite feed — the two hard problems are upload and scroll.
- Two hard problems: upload latency and scroll performance.
- Downscale on the client, upload direct to storage, preview optimistically.
- Cursor pagination + virtualization + correct image variants carry the feed.
-
11.3HLD – E-commerce App (Amazon, Flipkart)
Different pages need different rendering strategies — that decision is the whole design.
- The design is the per-route rendering decision.
- Cache the page, fetch the price — islands keep SEO and accuracy together.
- Guest cart merges on login; the server owns it afterwards.
-
11.4HLD – News Media Feed (Facebook, Twitter)
A cursor-paginated list that must accept live inserts without ever moving content under the reader.
- Cursor pagination is mandatory the moment items can be inserted.
- Never move content under someone who's reading — buffer and offer.
- Normalize, so one event updates every view of that entity.
-
11.5HLD – Video Streaming (Netflix)
Adaptive bitrate keeps the buffer full — every other decision serves that one goal.
- Keep the buffer full; quality is the variable you trade to do it.
- Start at the lowest rung for a sub-second first frame, then climb.
- Rebuffer ratio, not resolution, is the metric users actually feel.
-
11.6HLD – Music Streaming (Spotify)
The player must survive navigation, so it lives above the router — everything else follows from that.
- The player lives above the router — that's the design.
- Queue is explicit state: context, index, shuffle order, repeat mode.
- Prefetch at ~80% and swap audio elements for truly gapless playback.
-
11.7HLD – Live Commentary (CricInfo, Cricbuzz)
One event fans out to millions of read-only clients — the design problem is broadcast, not interaction.
- Read-only fan-out means SSE, not WebSocket.
- Send deltas with event ids; reconnect resumes automatically.
- Always have a CDN-cached polling fallback — it's the only mode that can't be overwhelmed.
-
11.8HLD – Email Client
An offline-first local database that syncs both ways — the design is the sync protocol.
- The UI reads only from the local database; the network is a background concern.
- Sync is a server-issued watermark plus an ordered outbox, never a client clock.
- Classify conflicts: merge commutative ops, define rules for destructive ones, never discard user text.
-
11.9HLD – Diagram Tools (Excalidraw)
A canvas render loop plus an operation log — undo, collaboration, and persistence all come from the log.
- Layered canvases: redraw the smallest surface that changed.
- The operation log gives you undo, collaboration, and persistence from one structure.
- Spatial indexing turns hit testing from O(n) into O(log n).
-
11.10HLD – Analytics Dashboard (Google Analytics)
Aggregate on the server, render only what fits on screen, and never ship a million rows to a browser.
- Aggregate server-side; the browser gets chart-ready series.
- Independent widgets: one slow query must not blank the dashboard.
- Filters in the URL, cached by key — shareable and instant on return.
-
11.11HLD – Google Docs
Two people typing in the same paragraph is the entire problem — OT or CRDT is the answer.
- Concurrent text editing is the problem; OT and CRDT are the two real answers.
- Local echo immediately; sync in the background.
- Presence is ephemeral and separate from document history.
-
11.12HLD – Google Sheets
A virtualized grid over a dependency graph — render what's visible, recalculate only what changed.
- Virtualize both axes; only ~1,000 cells ever exist in the DOM.
- The dependency DAG is what makes editing fast — recalc the dependents, not the sheet.
- Cells are independent, so collaboration is far simpler here than in a document.
-
11.13Microfrontend
Split the frontend by team ownership, compose at runtime, and pay for it in shared-dependency discipline.
- Split by team and domain; compose at runtime through a shell.
- Shared singletons are mandatory, and their versioning is the ongoing tax.
- Recommending against microfrontends for a small team is the stronger answer.
-
11.14HLD Kanban Board
Drag-and-drop with optimistic reordering — the design problem is what happens when the server says no.
- Snapshot, move optimistically, reconcile or roll back.
- Fractional ordering keys turn a reorder into a single write.
- Keyboard-accessible dragging is a requirement, not an enhancement.
Capstone
Record yourself designing any two of these in 45 minutes each, following the 8-step frame without notes.