API Design

Learn it once, explain it cold

API design, from first principles.

A visual, interactive course that builds your intuition from the wire up — so you can design, defend, and debug an API in any interview, from low-level networking to high-level system design. Every lesson has diagrams, worked examples, common traps, the interview angle, quizzes, and hands-on exercises.

↻ Review deckSpaced-repetition drills on every quiz you miss. ⏱ Mock interviewTimed design prompts + model answers to self-score. ⌕ SearchJump to any concept across 123 lessons.

0 / 123 lessons complete

Part 1 — Foundations10/10

How the machinery under every API works. Master this and the rest is application.

Part 2 — Data & Formats3/3

How API data is represented on the wire and why format choice matters.

Part 3 — Architectural Styles7/7

REST, GraphQL, gRPC — what each is and when to reach for it.

Part 4 — Resource Design Patterns8/8

Build-along resource modelling — standard & custom methods, field masks, long-running ops, batch, soft delete — ending in a complete mock API you can stand up.

Part 5 — Security12/12

Protecting APIs end to end: transport, identity, and input.

Part 6 — Reliability & Scale19/19

The patterns that keep APIs correct and fast under load.

rel-01

API versioning

Evolving without breaking callers.

rel-02

Idempotency

Making retries safe; idempotency keys in practice.

rel-03

Rate limiting algorithms

Token/leaky bucket, fixed & sliding windows — with code.

rel-04

API gateway deep dive

The front door: routing, auth, limiting, aggregation.

rel-05

Retries & backoff

Exponential backoff, jitter, and retry storms.

rel-06

Circuit breaker pattern

Failing fast to protect a struggling dependency.

rel-07

Caching at every layer

Client, CDN, gateway, app, and DB caches.

rel-08

Load balancing

Spreading traffic; L4 vs L7; health checks.

rel-09

Monitoring & observability

Metrics, logs, traces, and the four golden signals.

rel-10

Event-driven & pub/sub

Queues, topics, and decoupling with messages.

rel-11

Evolving APIs safely

Additive change, tolerant reader, expand-and-contract.

rel-12

Designing webhooks

Payloads, HMAC signing, retries, replay, idempotent consumers.

rel-13

Capacity estimation

Back-of-the-envelope sizing: QPS, storage, servers for N users.

rel-14

Scaling 1 → 1M users

Vertical vs horizontal, statelessness, the architecture progression.

rel-15

Scaling the database

Read replicas, sharding, hot keys, denormalization, CQRS.

rel-16

Consistency & CAP

Strong vs eventual, CAP/PACELC, quorum, stale reads.

rel-17

High availability

No SPOF, multi-AZ/region, active-active, failover.

rel-18

Resilience & disaster recovery

Graceful degradation, bulkheads, load shedding, RTO/RPO, chaos.

rel-19

Chaos & progressive delivery

Canary deployments, traffic shifting math, feature flagging, connection draining, and proactive fault injection.

Part 7 — Performance5/5

Estimating and shrinking response time.

Part 8 — Production at Scale10/10

Interactive simulators + evidence-based scaling walkthroughs — drag the load toward 100M and watch the behaviour. Figures are first-principles models, cited and labeled.

Part 9 — Platform & API Product Engineering9/9

Your API as a product others build on: nested quotas, webhook delivery, error models, multi-tenancy, dev-platform keys, platform auth, metering — ending in a full developer-platform design.

Part 10 — Debugging & Real-World6/6

Diagnosing real API failures — the skills interviews and on-call both test.

Part 11 — Design Case Studies22/22

The repeating interview pattern: requirements → decisions → API model → evaluation.

cs-00

The case-study framework

How to drive any 'design the API for X' question.

cs-01

Design: Search API

Query, filters, pagination, latency budget.

cs-02

Design: File upload/download API

Chunking, resumable uploads, presigned URLs.

cs-03

Design: Comment & rating API

Nested resources, moderation, counts.

cs-04

Design: Pub/Sub API

Topics, subscriptions, delivery guarantees.

cs-05

Design: URL shortener

Key generation, redirects, analytics (original).

cs-06

Design: Notification service

Fan-out, channels, preferences (original).

cs-07

Design: Video streaming API

Upload, transcode, adaptive playback.

cs-08

Design: Chat/messenger API

Delivery, presence, ordering, real-time.

cs-09

Design: Maps API

Tiles, routing, geo queries.

cs-10

Design: Video conferencing API

Rooms, signaling, media routing.

cs-11

Design: Online judge API

Submit, sandbox, verdicts.

cs-12

Design: Payments API

Charges, idempotency, webhooks, the money path.

cs-13

Design: Social feed API

Timeline, fan-out, follows.

cs-14

Design: Ride-hailing API

Matching, location, trip lifecycle.

cs-15

Design: Gaming/leaderboard API

Real-time state, rankings, anti-cheat.

cs-16

Design: Chess / turn-based game API

Move validation, game state, anti-cheat, real-time turns.

cs-17

Design: Price-tracker API

External polling, price history, alerts (original).

cs-18

Design: Slack API

Real-time messaging, WebSockets, connection lifecycle, and presence.

cs-19

Design: Collaborative Editing API

Real-time document sync, Operational Transformation (OT) vs. CRDTs, and scaling math.

cs-20

Design: IoT Data Ingestion API

High-throughput append-only telemetry, binary serialization (Protobuf), and time-series DB scaling.

cs-21

Design: E-commerce Saga Checkout API

Distributed transactions, Saga pattern, compensating actions, and the outbox pattern.

Part 12 — Failure Case Studies4/4

What real outages teach about API design.

Part 13 — Interview Prep7/7

Drill, self-test, and a repeatable method to ace the interview.

Part 14 — Wrap-up1/1