High-Level Design tutorial
Design systems that hold up under real traffic. Write requirements, estimate load, pick components and prove each choice with a simulator, using one food delivery app from start to finish. Then design ten real systems end to end on a design canvas.
Course contents
HLD Foundations
- Requirements and the Design Loop — Start every design by asking what the system must do and how well: functional and non-functional requirements, SLIs, SLOs and SLAs, percentiles, error budgets, scope, and the design loop.
- Back-of-Envelope Estimation — Turn people per day into requests per second, storage, bandwidth and servers with quick, rounded sums, and learn why you always plan for the peak.
- Latency and the Request Path — Follow one request from the phone to the database and back, learn the latency numbers worth remembering, and find out where the time really goes and how to cut it.
- Load Balancing — Share traffic across many servers: scale up vs scale out, round robin, weighted and least connections, health checks, sticky sessions vs stateless servers, layer 4 vs layer 7.
- Caching — Keep popular data somewhere fast: hits and misses, why small caches work, cache-aside, write strategies, TTLs, LRU and LFU eviction, cache stampedes and what not to cache.
- Data Storage and Replication — Choose where data lives: SQL tables, joins and transactions, NoSQL document, key-value and graph stores, indexes and their cost, leader-follower replication, lag and failover.
- Partitioning and Consistent Hashing — Split data across machines: partitioning vs replication, choosing a partition key, range vs hash splits and hot spots, why hash mod N fails, the consistent hash ring, virtual nodes and hot keys.
- CAP, PACELC and Quorums — Decide what happens when copies disagree: strong, read-your-writes and eventual consistency, what CAP really says, PACELC's latency trade-off, and N, W, R quorums with the R + W > N rule.
- Queues, Streams and Idempotency — Hand slow work to queues: producers, consumers and acks, absorbing bursts, queues vs pub/sub, streams and offsets, at-least-once delivery, idempotency keys and dead-letter queues.
- Rate Limiting — Protect busy endpoints: choosing keys and limits, 429 and Retry-After, fixed windows and their edge problem, sliding windows, token buckets, shared counters and well-behaved clients.
- Reliability: Timeouts, Retries and Circuit Breakers — Keep working when dependencies fail: cascading failures, timeouts, retries with backoff and jitter, circuit breakers, fallbacks, bulkheads, backpressure and load shedding.
- Observability: Metrics, Logs and Traces — See what your system is doing: the three pillars, golden signals, structured logs, distributed traces, and alerting on SLO burn rate instead of noise.
B2B SaaS Architectures
- Multi-Tenancy Models — Many customers on one system: compare pool (shared tables + tenant key), bridge (schema per tenant) and silo (database or cell per tenant) on cost, isolation, migrations and restore time.
- Tenant Context and Isolation — Carry the tenant through every hop: request, cache, database, queue, worker and search index. Find where the tenant context gets dropped, and fix it with tenant-scoped keys and row-level security.
- Noisy Neighbours and Fairness — One tenant's huge export spikes everyone's p99. Protect shared capacity with per-tenant quotas, fair queues and a dedicated cell for the whale tenant.
- Custom Fields and Objects — Every customer wants different fields. Store customer-defined fields without a schema change per tenant: compare EAV, JSONB and generated columns in real Postgres, with indexes and query plans.
- Authorization and Sharing — Decide who inside a tenant may read, edit or delete each record: role-based access (RBAC), record-level sharing, private records and row-level security, checked in a fixed order with deny by default.
- Enterprise Identity: SSO and SCIM — Customers bring their own identity provider. Follow a SAML and an OIDC login message by message, provision users with SCIM, and close the gap where a leaver keeps access.
- Audit Logs and Compliance — Make every action traceable: an append-only, hash-chained audit trail that shows tampering, answers 'who changed this and when', and keeps each tenant's events exactly as long as its contract says.
- Workflow and Automation Engines — Let each tenant automate its own work with trigger, condition and action rules, then stop the rule that triggers itself, the retry that pages someone twice and the import that takes every worker.
- Integrations: Public API and Webhooks — Customers connect Northwind to their own systems. Deliver every webhook with retries and a dead-letter queue, sign it, keep one broken endpoint from slowing the rest, and rate-limit the API per tenant.
- Data Residency, Regions and Cells — Keep each tenant's data in the regions its contract allows: home cells, a tenant directory for routing, every copy kept in-region, and a tenant moved between cells with no data loss.
- Usage Metering and Billing — Bill exactly what each customer used: usage events with ids, deduplication, late events billed as adjustments instead of edited invoices, and prorated plan changes.
- Cloud, Private Cloud and On-Premises — Run the same product in your cloud, in a customer's cloud account and in an air-gapped data centre from one build: interfaces and adapters, config profiles, offline licences and signed release bundles.
HLD Case Studies
- Design a URL Shortener — Design QuickBite's link shortener end to end: requirements, traffic and storage estimates, code length, 301 vs 302, base62 codes from ID ranges, caching, and a design sandbox.
- Design a Rate Limiter Service — Turn one server's rate limiter into a shared service: local vs shared counters, atomic increments, sliding windows, 429 and Retry-After, and failing open.
- Design a News Feed — Build QuickBite's food feed: pull vs push, fan-out through a queue, the big-account problem, hybrid feeds and a replicated feed cache.
- Design a Chat System — Build customer–rider chat: WebSockets, sizing gateways by connections, routing through pub/sub, saving before delivering, and splitting messages by conversation.
- Design a Notification System — Send order updates by push, SMS and email: queue the work, a queue per channel, provider rate limits, retries with backoff and dedupe keys.
- Design File Storage — Store QuickBite's menu photos and receipts: object storage for bytes, a metadata database, presigned uploads, CDN downloads and background thumbnails.
- Design Search Autocomplete — Suggest dishes as customers type: prefix trees with saved top answers, debouncing, caching popular prefixes and rebuilding rankings from logs.
- Design a Payment System — Charge cards exactly once: payment states, idempotency keys, a double-entry ledger, background charging and daily reconciliation.
- Design Video Streaming — Serve recipe videos: transcoding into qualities and segments, adaptive bitrate, chunked parallel transcoding and CDN delivery.
- Design LLM Inference Serving — Run an AI support assistant on GPUs: prefill and decode, time to first token, streaming, continuous batching and answer caching.
- Capstone: Design the QuickBite Platform — Design the whole QuickBite order platform yourself: requirements, per-flow estimates, choosing parts, passing every check, and writing down trade-offs.
- HLD Cheat Sheet — Every number, formula, building block and pattern from High-Level Design on one page: latency, estimation, capacity, the four checks and common trade-offs.