System Design Tutorial: Case Studies, CAP, SQL vs NoSQL, JWT
Free system design tutorial: SQL vs NoSQL, CAP, message queues, authentication and JWT, and case studies like flash sales, chat, ChatGPT and IRCTC Tatkal.
What you will learn
- Flash sale: who gets the last unit, and why a paid order is cancelled
- Food delivery: orders, a menu cache, search, and rider locations
- Cache stampede: one expiry on the database that also takes orders
- Live final: scale before the toss, and an ad break everyone hits together
- A chat model: the answer is written on a GPU, then streamed
- Product Q&A: retrieve, call a tool, and treat a review as a quote
- Tatkal: a seat sold in stretches, lock released before payment
- Group chat: one register, a directory of sockets, a retry that is the same message
- Authentication: JWT vs sessions, revocation, and refresh-token rotation
How it works
Each case study names the load, the store that owns the decision, and the follow-up the short leaves open. The same chapters sit in the database case studies.
Start here
Core concepts
API design
- REST, GraphQL or RPC: picking the protocol
- Start from the consumer: goals, resources and flows
- REST: resources, methods and passing data
- Under REST: HTTP semantics, maturity levels and hypermedia
- GraphQL: one endpoint, the client picks the fields
- RPC and gRPC: calling functions across the network
- Nine principles of a clean API
- Designing the payload: names, shapes, links and errors
- From tables to API resources: one table to many-to-many
- Mapping a complex schema: trees, polymorphic links and a full booking system
- Pagination, idempotency keys, errors and versioning
- Network-efficient APIs: caching, ETags and response shaping
- Long jobs, events and bulk: beyond request and reply
- Evolving an API without breaking clients
- Contracts: OpenAPI, contract tests and documentation
- API security: who is calling, what may they do, how often
- OAuth 2, OpenID Connect and scopes for APIs
- How APIs get breached: the OWASP API Top 10
- Running APIs: gateways, mesh, quotas, releases and signals
- Troubleshooting APIs: slow responses and unexpected errors
- Capstone: a staff-level API design review
- Spotify Web API I: resources, IDs, payloads and paging
- Spotify Web API II: OAuth scopes, quotas and rate limits
- Spotify Web API III: how a real API changes, and what it leaves out
Database-heavy designs
Games
Case studies
- Who gets the last phone in a flash sale
- Which database for a food delivery app
- The cache expired and the database fell over
- A live final: scale before the toss
- An app like ChatGPT: the answer is written live
- A product Q&A box on sale day
- Tatkal at 10:00: one seat, sold in stretches
- A group chat: one register, many sockets
Authentication · JWT
- JWT Interview Questions and Answers
- JWT: Life of a session, step by step
- JWT Structure Explained: Header, Payload, Signature
- JWT: Forge lab: why verification must be strict
- JWT vs Session Authentication: Which to Use
- JWT: The validation pipeline: where a bad request dies
- How to Revoke a JWT: Blocklists and Short Expiry
- Refresh Tokens and Rotation Explained
- JWT: Logout in depth: one device, all devices, SSO
- JWT Security Best Practices
- OAuth 2.0 and OpenID Connect Explained
- Where to Store JWT: localStorage vs HttpOnly Cookie
- JWT in Microservices: API Gateway vs Service Validation
- JWT: Microservices, keys, and trust boundaries
- JWT: Sender-constrained tokens: making a stolen token…
- Authentication vs Authorization Middleware
- JWT: Failure explorer: what breaks when X fails
- JWT: Capacity planner: sessions vs JWT vs hybrid
- JWT: Edge cases catalog
- JWT: Test it, measure it, migrate to it
- JWT: Anti-patterns to reject in a design review
- JWT: Design checklist and cheat sheet
More courses
- Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
- Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
- React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
- Databases in depth — How a query becomes work. Indexes, isolation, locks, and the plans that explain why a page is slow — not an ORM tour.
- NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
- Microservices — Microservice patterns one diagram at a time: how to split a monolith, how services talk, and how data stays consistent without distributed transactions.
- Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
- AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
- Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
- TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
- CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
- Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
- Docker — What an image is, why layers cache, and how containers find each other on a network.
- Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
- Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
- AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
- Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.