API Designs
Worked API designs for canonical product surfaces — Search, File, Comment, Pub-Sub, YouTube, Stripe, Twitter, Uber, and more.
Every API design follows the same seven-step walk-through, but the trade-offs differ wildly by domain. Search APIs sweat latency budget; File APIs sweat range-requests and signed URLs; Pub-Sub APIs sweat delivery semantics; payments APIs sweat idempotency. The system writeups in this topic walk a representative slice of the canonical product APIs end-to-end.
For effective prep, work 5–7 of these deeply rather than 15 superficially. The patterns repeat — once you've designed YouTube's streaming pipeline you've half-designed Zoom; once you've done Stripe you've half-done a webhook system.
Key concepts
- Every system writeup follows the same 9-section template — Context → Mock interview follow-ups
- Functional vs non-functional requirements must be separated explicitly
- The endpoint catalogue is the heart of the design; OpenAPI YAML for 2–3 key endpoints anchors it
- Latency budget is a sum: processing + network + queueing — show your work
- Client samples in Python / Go / Node show the contract from the consumer's side
Reference template
// Reading a system writeup
## Context — what the API is and isn't
## Requirements — functional + non-functional, separated
## Use case diagram — actors and headline use cases
## Class diagram — entities and relationships
## Sequence diagram — one or two key flows in dynamic detail
## Activity diagram — only where state machine is non-trivial
## API implementation — endpoints + OpenAPI + Python/Go/Node clients
## Trade-offs — what we gave up; what changes at 10x scale
## Mock interview follow-ups — questions a real interviewer asks next Adapt to your problem; the structure is the load-bearing part.
Common pitfalls
- Designing for an imaginary future instead of stated requirements
- An endpoint catalogue that's a wall of CRUD with no shape — pick the load-bearing 3-5
- Skipping the latency budget — interviewers read it as 'didn't think about it'
- Forgetting failure modes — every API has them, the question is whether you named them
Related topics
Items (15)
- Design a Search Service API
Query, suggest, rank, paginate. Where latency budget lives and how to write a search API that won't go viral on the wrong page.
System Intermediate - Design a File Service API
Upload, download, range requests, multipart, signed URLs, resumability. The S3-shaped contract every backend reinvents.
System Intermediate - Design a Comment Service API
Threaded comments, pagination by cursor, moderation hooks, the reaction subsystem. The CRUD that scales to millions of nodes.
System Intermediate - Design a Pub-Sub Service API
Topics, subscribers, fan-out, at-least-once vs exactly-once. The asynchronous backbone of every modern microservice mesh.
System Intermediate - Design the YouTube Streaming API
Upload pipeline, transcode, ABR manifests, CDN, recommendation. The biggest video service in the world, from the API's side.
System Advanced - Design the Facebook Messenger API
Real-time delivery, presence, read receipts, group threads, end-to-end encryption. WebSockets + a careful state machine.
System Advanced - Design the Google Maps API
Tiles, geocoding, routing, places, distance matrix. The geospatial endpoints behind a billion daily queries.
System Advanced - Design a Chess API
Game lifecycle, move validation, time control, spectator stream. The cleanest turn-based-game API in the catalogue.
System Intermediate - Design the Zoom API
Meetings, participants, signalling, recording, webhooks. The video-conferencing API behind a pandemic-era infrastructure.
System Advanced - Design the LeetCode API
Problem, submission, judge, leaderboard. The fan-out from problem-fetch to async judge to result subscription.
System Intermediate - Design the Stripe Payment API
PaymentIntent, charge, refund, webhook, the cards-network interaction. The gold-standard for payments-API design.
System Advanced - Design the Twitter API
Tweet, timeline, follow graph, search, streaming. The read-heavy fan-out problem at planet scale.
System Advanced - Design the Uber API
Riders, drivers, dispatch, trip lifecycle, surge. Real-time matching with geospatial constraints.
System Advanced - Design the CamelCamelCamel API
Price-tracking for Amazon products. A scraper-shaped API that must respect a partner's rate limits and ToS.
System Intermediate - Design a Gaming API
Matchmaking, lobby, real-time game state, leaderboards, anti-cheat hooks. Latency-sensitive APIs where 50 ms is everything.
System Advanced