handbook-academy/engineering-handbook
Sobre
Manuais de código aberto sobre design de sistemas de alto nível, DSA e engenharia de IA. CC BY-SA 4.0, gratuitos para sempre.
Aprendizado e educaçãoCrescimento medido de estrelas
- em 24 h
- +2
- em 7 dias
- +23
- em 15 dias
- +65
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalThe Engineering Handbook
Free, open-source engineering books for people who build software.
System design, data structures and algorithms, and AI engineering, each taught in full and free to read forever.
Read online at handbook.academy
HLD Handbook · DSA Handbook · AI Engineering Handbook · Where to start · Study plans · Contributing · FAQ
Table of contents
- About this project
- The three handbooks
- Read online
- Who it's for
- Where to start
- The HLD Handbook
- The DSA Handbook
- The AI Engineering Handbook
- Study plans
- How the books are written
- Contributing
- Repository structure
- Development setup
- FAQ
- License
- Citation
- Acknowledgments
- Community
About this project
The Engineering Handbook is a set of free textbooks for software engineers. Each book is a complete course: every topic is taught on the page, from first principles to the mistakes teams make in production. You won't find outlines, link lists, or "read this elsewhere" here.
The books live in this repository as plain Markdown. They render on GitHub with every diagram, figure and footnote intact, and the same text powers the websites at handbook.academy. Everything is licensed CC BY-SA 4.0, so the text stays free to read, share and adapt.
What makes the books different:
- Taught in full. Each chapter explains the idea, shows it in diagrams and worked examples, compares the alternatives, and ends with what to watch for in production.
- Opinionated. Chapters recommend an approach and explain why. When reasonable people disagree, the trade-offs are spelled out so you can decide.
- Sourced. Claims are backed by footnoted primary sources: papers, RFCs, official documentation and engineering postmortems.
- Current. The books cover today's stack: LLM serving, RAG, agents, MCP, CRDTs, edge computing, FinOps and post-quantum cryptography. Every chapter records when it was last updated.
- Open. Anyone can suggest a fix, and every change goes through review.
The three handbooks
| Handbook | What you'll learn | Best for | Read |
|---|---|---|---|
| HLD Handbook | How to design large software systems: networking and storage, distributed systems theory, architecture, reliability, security, end-to-end case studies, and AI system design. | System design interviews, and engineers who design or operate backend systems. | Chapters · Website |
| DSA Handbook | Data structures and algorithms organized by pattern, with LeetCode problems solved in Python, and most also in Java, C++ and Go. | Coding interviews, competitive programming, and sharpening problem-solving. | Chapters · Website |
| AI Engineering Handbook | How to build and run production AI products on top of model APIs: prompts, evals, context, retrieval, agents, observability, security, cost and product. | Software engineers shipping AI features. No model training required. | Chapters · Website |
Read online
Each book also has its own website. Every chapter is free to read there, for anyone, with no sign-in needed.
| Site | Address | What's there |
|---|---|---|
| Home | handbook.academy | All three books |
| HLD Handbook | hld.handbook.academy | The HLD Handbook |
| DSA Handbook | dsa.handbook.academy | The DSA Handbook |
| AI Engineering Handbook | ai-eng.handbook.academy | The AI Engineering Handbook |
Prefer GitHub? Every chapter link in this README opens the source file, and Mermaid diagrams render right in the browser.
Who it's for
- Engineers preparing for interviews. DSA for the coding rounds, HLD for system design, and both books' interview framework parts for the round itself.
- Engineers moving up a level. HLD's distributed systems, reliability and security parts are what separate Senior from Staff designs.
- Engineers building AI features. The AI Engineering Handbook covers making an LLM feature reliable, measurable, secure and affordable.
- Self-taught engineers. HLD's Prerequisites and DSA's Foundations cover the computer science a degree would have given you.
- Career switchers moving from frontend to backend, backend to infrastructure, or software to AI, who need system-level intuition fast.
- Teachers and course creators who want a full curriculum to build on. The license allows it.
Not the right fit: if you've never programmed, start with CS50 or The Odin Project and come back. The books also teach concepts that apply across languages rather than any one language's syntax.
Where to start
| I want to… | Start here |
|---|---|
| Get a quick taste of system design | Scalability → Back-of-the-envelope estimation → Design a URL shortener |
| Prepare for a system design interview | How to approach a design question, then the interview prep plan |
| Refresh my distributed systems foundations | HLD Part 3 — Distributed Systems Theory |
| Get better at coding interviews | Arrays → Two pointers → Sliding window |
| Choose between two approaches | The Trade-offs Library for design, the pattern decision pages for algorithms |
| Build an AI feature that holds up | What an AI engineer is → The escalation ladder → Why you can't ship without evals |
| Design AI systems at scale | HLD Part 9 — AI & ML System Design and the AI systems case studies |
| Follow a plan with a deadline | Study plans, from one weekend to the full curriculum |
The HLD Handbook
How to design large software systems, from the network up to LLM serving.
Website · content/hld/ · Style guide
The HLD Handbook starts with the prerequisites (networking, operating systems, databases, API design) and builds up through the building blocks, distributed systems theory, data systems and architecture patterns. It then covers what it takes to run systems for real: reliability, operations and security. The case studies put it all together in end-to-end designs, and the last parts cover AI system design and how to handle the interview.
How a chapter is built. Each teaching chapter follows the same path: an introduction, the idea from first principles, diagrams, a worked example, the trade-offs, production gotchas, and references. Case studies follow the interview shape instead: requirements, estimates, API, data model, architecture, deep dives, and scaling.
HLD parts at a glance
Pick a part number to jump to its chapters, or open any part below.
| Part | What it covers | Level |
|---|---|---|
| 0 | Prerequisites — networking, OS, data structures, databases, API design | Beginner |
| 1 | Core Fundamentals — scalability, latency, availability, consistency, estimation, trade-off thinking | Beginner to intermediate |
| 2 | Building Blocks — load balancers, caches, queues, CDNs, databases, sharding, pub/sub, rate limiting, blob storage, geo, edge | Intermediate to advanced |
| 3 | Distributed Systems Theory — consensus, consistency, clocks, CRDTs, transactions | Intermediate to advanced |
| 4 | Data Systems — storage engines, OLTP/OLAP, warehouses/lakes, streams, search, time-series, graph, vector, KV | Intermediate to advanced |
| 5 | Architecture Patterns — monolith vs micro, event-driven, CQRS, ES, serverless, BFF, strangler, hex, multi-region, multi-tenant, CRDT apps | Intermediate to advanced |
| 6 | Reliability & Operations — observability, SLOs, resilience, scaling, deploys, chaos, incidents, FinOps, platform | Intermediate to advanced |
| 7 | Security at Scale — AuthN/Z, OAuth/OIDC, JWT, mTLS, secrets, DDoS/WAF, compliance, supply chain, privacy, PQC | Intermediate to advanced |
| 8 | Case Studies — end-to-end designs, grouped by theme; the centerpiece of interview prep | Intermediate to advanced |
| 9 | AI & ML System Design — LLM serving, RAG, vector search, agents, LLMOps, safety, recommenders, multimodal | Intermediate to advanced |
| 10 | Emerging Patterns — green and sustainable computing | Intermediate |
| 11 | Interview Framework — RESHADED/PEDALS/ADEPT, requirements, diagrams, trade-offs, company flavors, RFCs | Intermediate to advanced |
Part 0 · Prerequisites
Level: Beginner · For: Engineers without a CS degree, or anyone who wants to confirm their foundations before moving on.
Foundational topics that the rest of the handbook assumes. If you can explain TCP's three-way handshake, the difference between a process and a thread, a B-tree's internal structure, and why idempotent PUT is better than non-idempotent POST for a retry-prone endpoint — you can skip this part.
| # | Chapter | What it covers |
|---|---|---|
| 0.0 | Networking Fundamentals for System Design | A practical tour of OSI layers, TCP/UDP, HTTP/1.1 through HTTP/3, DNS, TLS 1.3, and realtime transports like WebSockets and SSE. |
| 0.1 | Operating System Essentials for System Design | Processes, threads, memory hierarchy with real latency numbers, I/O models (epoll, kqueue, io_uring), and file system internals you need to design systems. |
| 0.2 | Data Structures for Distributed Systems | The handful of data structures that power modern infrastructure: hash tables, B-trees, LSM-trees, Bloom filters, skip lists, and consistent hashing rings. |
| 0.3 | Database Fundamentals for System Design | SQL, ACID, indexing, query execution, and the normalization vs denormalization debate, covered at the depth you need to design real systems. |
| 0.4 | API Design Basics: REST, GraphQL, gRPC, and the Hard Parts | Resource modeling, GraphQL's N+1 problem, gRPC streaming, versioning strategies, idempotency keys, and cursor pagination done right. |
Part 1 · Core Fundamentals
Level: Beginner to intermediate · For: Everybody — read this part even if you know the topic, because the vocabulary here is used for the rest of the book.
The vocabulary and the reasoning habits that every later chapter assumes. "Scalability," "consistency," "trade-off," and "back-of-envelope" get defined here rigorously so they mean something specific when we use them later.
| # | Chapter | What it covers |
|---|---|---|
| 1.0 | Scalability: Growing a System Without Breaking It | Vertical vs horizontal scaling, stateless services, read vs write scaling, and when scaling is the wrong answer. The vocabulary every system design conversation uses. |
| 1.1 | Latency and Throughput: The Two Numbers That Matter | Latency vs throughput, Jeff Dean's numbers, tail latency (p50/p95/p99), Little's Law, and how to find the real bottleneck in any system. |
| 1.2 | Availability and Reliability: Nines, SLOs, and Staying Up | Availability math, MTBF/MTTR, redundancy patterns, SLI/SLO/SLA, error budgets, dependency math, and real-world outage lessons. |
| 1.3 | Consistency Models: What Readers Actually See | Strong, eventual, and causal consistency. Read-your-writes, monotonic reads, and the client-centric vs data-centric distinction that makes consistency tractable. |
| 1.4 | Back-of-the-Envelope Estimation | Powers of 2 and 10, storage and bandwidth templates, QPS math, and worked examples for Twitter and YouTube scale. The interview skill that matters in production too. |
| 1.5 | How to Approach a System Design Question | A repeatable 6-step framework for 45-minute system design interviews: clarify, estimate, API, high-level design, deep dive, trade-offs. Minute-by-minute plan with company-specific flavors. |
| 1.6 | Trade-off Thinking | Every design decision is a trade-off. How to articulate, structure, and defend your choices, and how to recognize when not choosing is the right move. |
Part 2 · Building Blocks
Level: Intermediate to advanced · For: Anyone who'll assemble backend systems. This part is the Lego brick inventory.
Deep dives on the pieces you assemble to build real systems: load balancers, caches, queues, CDNs, databases (SQL and NoSQL), partitioning, replication, pub/sub, rate limiters, service discovery, blob storage, geospatial indexes, and edge compute.
| # | Chapter | What it covers |
|---|---|---|
| 2.0 | Load Balancers: Spreading Traffic, Absorbing Failure | L4 vs L7 load balancing, algorithms, health checks, and how Envoy, HAProxy, NGINX, and AWS ALB/NLB actually work in production. |
| 2.1 | Reverse Proxies and API Gateways: The Smart Edge | TLS termination, routing, auth, rate limiting, and why an API gateway is more than a smarter load balancer. |
| 2.2 | Content Delivery Networks: Moving Bytes Closer to Users | How CDNs work, edge caching, cache keys and invalidation, and how Cloudflare, Akamai, and Fastly differ in practice. |
| 2.3 | Caching: From Browser to Database | Cache hierarchy, five write patterns, eviction policies (LRU/TinyLFU), stampede prevention, and why invalidation is the hardest problem in distributed systems. |
| 2.4 | SQL Databases: The Boring Technology That Wins | B-trees, MVCC, isolation levels, indexing, and why PostgreSQL and MySQL are still the right answer for most systems. |
| 2.5 | NoSQL Databases: Picking the Right Non-Relational Tool | Key-value, document, wide-column, and graph stores, and how DynamoDB, Cassandra, MongoDB, and Neo4j differ in practice. |
| 2.6 | Database Partitioning and Sharding: When One Node Is Not Enough | Range, hash, and consistent-hash partitioning, hot spots, resharding, and how Notion, Figma, and Discord partition data in practice. |
| 2.7 | Database Replication: Keeping Copies in Sync | Leader-follower, multi-leader, and leaderless replication, sync vs async, failover, and how Postgres, MySQL, Cassandra, and DynamoDB differ. |
| 2.8 | Message Queues and Streaming: Decoupling at Scale | Queues vs logs, Kafka vs RabbitMQ vs SQS, delivery semantics, partitioning, consumer groups, and when streaming beats request-response. |
| 2.9 | Pub/Sub: Fan-Out and Event-Driven Systems | Topics, subscriptions, fan-out strategies, and how Google Pub/Sub, Redis, NATS, and SNS+SQS implement publish/subscribe at scale. |
| 2.10 | Real-Time Communication: WebSockets, SSE, and Long Polling | Long polling, Server-Sent Events, WebSockets, WebRTC, and MQTT: when to use each, how to scale persistent connections, and production lessons from Discord and Slack. |
| 2.11 | Rate Limiting: Protecting Systems from Themselves | Token bucket, leaky bucket, fixed and sliding windows, distributed rate limiting, and how Stripe, Cloudflare, and GitHub protect their APIs. |
| 2.12 | Service Discovery and Service Mesh: Finding and Talking to Services | DNS, client-side and server-side discovery, health checks, sidecars, mTLS, and what Consul, Envoy, Istio, and Linkerd actually solve. |
| 2.13 | Blob and Object Storage: Storing the Big Stuff | S3 semantics, object storage internals, multipart uploads, lifecycle policies, and when to pick S3 vs GCS vs MinIO vs a filesystem. |
| 2.14 | Geospatial Indexing: Geohash, Quadtree, R-tree, S2, and H3 | Space-filling curves, hierarchical grids, and tree indexes for location queries - with decision guidance on geohash vs quadtree vs R-tree vs S2 vs H3. |
| 2.15 | Edge Computing (Cloudflare Workers, Lambda@Edge, Deno Deploy) | Design applications for the edge: cold starts, state replication with Durable Objects, edge databases, and the limits of running code close to users. |
Part 3 · Distributed Systems Theory
Level: Intermediate to advanced · For: SDE2+ preparing for Senior/Staff. If you haven't internalized linearizability vs serializability, read this.
The theory that makes distributed systems distributed: consensus (Raft/Paxos), the full consistency spectrum, CAP/PACELC in 2025 framing, logical clocks, CRDTs, distributed transactions (2PC/Saga), exactly-once delivery, failure detection, consistent hashing, and Merkle-tree anti-entropy.
| # | Chapter | What it covers |
|---|---|---|
| 3.0 | Consensus Protocols: How Distributed Systems Agree | Raft and Multi-Paxos explained: leader election, log replication, safety under term numbers, and why etcd, Consul, and CockroachDB picked Raft. |
| 3.1 | Consistency Deep Dive: Linearizability, Serializability, and the Spectrum Between | Linearizability vs serializability vs causal vs eventual, external consistency, and how to reason precisely about what your database actually gives you. |
| 3.2 | Quorums and Replication: The Math of R + W > N | Read and write quorums, Dynamo-style replication, sloppy quorums, hinted handoff, and when quorums give you linearizability (and when they do not). |
| 3.3 | CAP and PACELC: The Tradeoff That Keeps Confusing People | What CAP actually says (and what it doesn't), the three big misconceptions, and how PACELC fixes the omission of latency. |
| 3.4 | Clocks and Ordering: Lamport, Vector, and Hybrid Logical Clocks | Why wall-clock time lies, happens-before, Lamport clocks, vector clocks, hybrid logical clocks, and Google TrueTime. |
| 3.5 | CRDTs: Conflict-Free Replicated Data Types | State-based (CvRDT) and op-based (CmRDT) CRDTs, G-Counter, PN-Counter, OR-Set, LWW-Register, and how Yjs, Automerge, Figma, and Redis use them. |
| 3.6 | Distributed Transactions: 2PC, Saga, and When to Avoid Both | Two-phase commit, Percolator, Sagas, outbox pattern, and the honest answer to distributed transactions: don't, or pay the price. |
| 3.7 | Idempotency and Exactly-Once: The Honest Truth About Delivery Guarantees | Why exactly-once delivery is a myth, how idempotency keys make at-least-once feel exactly-once, and how Stripe and Kafka implement it. |
| 3.8 | Failure Detection: Deciding a Node Is Dead | Heartbeats, phi-accrual detectors, gossip (SWIM), and why 'is it dead or just slow?' has no correct answer. |
| 3.9 | Consistent Hashing: Keys to Nodes Without Global Reshuffles | The hash ring, virtual nodes, bounded-load variant, rendezvous hashing, Maglev, and jump hash for distributing keys across dynamic node sets. |
| 3.10 | Merkle Trees and Anti-Entropy: Keeping Replicas in Sync Cheaply | Merkle trees, anti-entropy protocols, read repair, hinted handoff, and how Dynamo, Cassandra, and Git use hashed trees to find the differences. |
Part 4 · Data Systems
Level: Intermediate to advanced · For: Anyone who owns a data pipeline or picks a database.
Every flavor of data system you might pick, and when each actually fits. Storage engines (B-tree vs LSM), OLTP vs OLAP, warehouses/lakes/lakehouses, streaming vs batch, CDC, search, time-series, graph, vector, and key-value.
| # | Chapter | What it covers |
|---|---|---|
| 4.0 | Storage Engines: B-Trees, LSM-Trees, and Why Your Database Feels the Way It Does | How B-tree and LSM-tree storage engines shape read, write, and space amplification, with examples from InnoDB, PostgreSQL, RocksDB, and Cassandra. |
| 4.1 | OLTP vs OLAP: Row Stores, Column Stores, and Matching Shape to Workload | Why transactional systems use row-oriented storage and analytical systems use columnar, with examples from Postgres, MySQL, Redshift, BigQuery, ClickHouse, and Snowflake. |
| 4.2 | Data Warehouses and Data Lakes: Structure, Schema, and the Lakehouse | How Redshift, BigQuery, Snowflake, S3-based lakes, and the lakehouse pattern with Delta Lake, Iceberg, and Hudi actually fit together. |
| 4.3 | Stream vs Batch Processing: Lambda, Kappa, and the End of That Debate | Batch with Spark and Hadoop, streaming with Kafka Streams, Flink, and Spark Streaming, and how Lambda and Kappa architectures stack up. |
| 4.4 | Change Data Capture: Streaming the Database's Inner Monologue | How Debezium, Maxwell, and the outbox pattern turn WAL and binlog entries into reliable event streams, and when each approach is the right call. |
| 4.5 | Search Systems: Inverted Indexes, BM25, and Running Elasticsearch in Production | How Elasticsearch, OpenSearch, and Solr build inverted indexes, score with BM25, and handle faceting, relevance tuning, and sharding at scale. |
| 4.6 | Time-Series Databases: Metrics, Events, and Retention at Scale | How Prometheus, InfluxDB, TimescaleDB, and VictoriaMetrics handle write-heavy time-series workloads with downsampling and retention policies. |
| 4.7 | Graph Databases: Property Graphs, Cypher, and When Joins Are the Problem | How Neo4j, Amazon Neptune, and Dgraph model relationships, and when graph queries beat recursive SQL joins. |
| 4.8 | Vector Databases: Embeddings, ANN Indexes, and the Retrieval Layer for AI | How Pinecone, Weaviate, Milvus, and pgvector store and search embeddings using HNSW and IVF approximate nearest neighbor indexes. |
| 4.9 | Key-Value Stores: Redis, Memcached, DynamoDB, and Picking the Right Hash Table | How Redis, Memcached, and DynamoDB differ in durability, data model, and scaling, and when each is the right key-value store. |
Part 5 · Architecture Patterns
Level: Intermediate to advanced · For: Engineers making architecture-level decisions or leading service migrations.
The architectural shapes you choose between when you design anything bigger than a single service: monolith vs microservices, event-driven, CQRS, event sourcing, serverless, BFF, strangler fig, hexagonal/clean, multi-region, multi-tenancy, CRDT-based apps.
| # | Chapter | What it covers |
|---|---|---|
| 5.0 | Monolith vs Microservices: Team Topology, Conway's Law, and the Distributed System Tax | When a modular monolith beats microservices, how Conway's Law shapes architecture, and what the distributed system tax actually costs you. |
| 5.1 | Event-Driven Architecture: Notifications, State Transfer, and Choreography | The three flavors of events, how Kafka and event buses enable loose coupling, and when choreography beats orchestration. |
| 5.2 | CQRS: Separating Reads from Writes Without Losing Your Mind | Command Query Responsibility Segregation in practice: when to split read and write models, how to handle eventual consistency, and when CQRS is overkill. |
| 5.3 | Event Sourcing: Events as the Source of Truth | Storing state as an append-only log of events, with replay, projections, snapshots, and the ops reality of running event-sourced systems. |
| 5.4 | Serverless: Functions, Cold Starts, and When FaaS Actually Saves Money | AWS Lambda, Google Cloud Functions, and Azure Functions in practice: cold starts, concurrency models, and the honest economics of serverless. |
| 5.5 | Backend for Frontend: Per-Client API Aggregation Done Right | When one API cannot serve web, mobile, and partner clients well, the BFF pattern gives each client its own aggregation layer. |
| 5.6 | Strangler Fig: Incremental Migration Without a Big Bang | Martin Fowler's strangler fig pattern for replacing legacy systems incrementally, with routing, facades, and how teams actually execute multi-year migrations. |
| 5.7 | Hexagonal and Clean Architecture: Keeping Business Logic Independent | Ports and adapters, clean architecture, and onion architecture: how to keep domain logic testable and framework-independent. |
| 5.8 | Multi-Region Architecture: Active-Passive, Active-Active, and CRDTs | Designing systems that survive regional failure: DNS failover, active-passive replication, active-active with CRDTs, and Cloudflare's model. |
| 5.9 | Multi-Tenancy: Silo, Pool, and the SaaS Isolation Spectrum | Designing SaaS platforms that host many tenants on shared infrastructure: isolation levels, noisy-neighbor defenses, per-tenant metering, and when to graduate a whale. |
| 5.10 | CRDT Applications (Yjs, Automerge, Local-First Software) | Design local-first collaborative software with CRDTs: Yjs, Automerge, peer-to-peer sync, and the architectural shift away from authoritative central servers. |
Part 6 · Reliability & Operations
Level: Intermediate to advanced · For: Anyone on-call, anyone who signs SLAs, anyone paying a cloud bill.
The engineering that separates "it compiles" from "it runs reliably at 3 a.m. on a long weekend": observability, SLOs, resilience patterns, auto-scaling, deployments, chaos engineering, incident response, health checks, FinOps, platform engineering.
| # | Chapter | What it covers |
|---|---|---|
| 6.0 | Observability: Metrics, Logs, Traces, and the OpenTelemetry Standard | The three pillars of observability, USE vs RED methods, and how OpenTelemetry, Prometheus, Grafana, and Jaeger fit together in production. |
| 6.1 | SLI, SLO, SLA, and Error Budgets: Making Reliability Quantitative | The Google SRE framework for reliability: what to measure, what to target, what to promise, and how error budgets fund feature work vs reliability work. |
| 6.2 | Resilience Patterns: Timeouts, Retries, Circuit Breakers, and Bulkheads | The defensive patterns that keep distributed systems from cascading into total failure, from Hystrix to modern service mesh implementations. |
| 6.3 | Graceful Degradation: When Partial Service Beats No Service | Load shedding, feature flags, cached fallbacks, and the product-engineering decisions behind degrading one feature to save the system. |
| 6.4 | Auto-Scaling and Capacity Planning: From HPA to Predictive Scaling | Horizontal pod autoscalers, cluster autoscalers, predictive scaling, and the capacity planning math that keeps systems sized right without overspending. |
| 6.5 | Deployment Strategies: Blue-Green, Canary, Rolling, and Feature Flags | How to ship changes safely with blue-green, rolling, canary, and progressive delivery, plus the role of feature flags and LaunchDarkly-style tooling. |
| 6.6 | Chaos Engineering: Breaking Things on Purpose | Netflix's Chaos Monkey, the Principles of Chaos, and how to run game days and fault injection experiments without making your on-call call in sick. |
| 6.7 | Incident Management: From Detection to Blameless Postmortem | On-call, incident command, severity levels, communication, and how to run postmortems that actually change systems instead of blaming people. |
| 6.8 | Health Checks and Readiness: Telling the Truth About Whether You're Up | Liveness, readiness, startup probes, deep vs shallow health checks, and why bad health checks cause more outages than bad code. |
| 6.9 | Cost Optimization and FinOps | Apply FinOps to reduce cloud bills without sacrificing reliability: spot instances, reserved capacity, autoscaling, storage tiering, and unit-economics thinking. |
| 6.10 | Platform Engineering: IDPs, Golden Paths, and DX | Treat the platform as a product: build internal developer platforms with Backstage, golden paths, and DORA/SPACE metrics that move developer productivity. |
Part 7 · Security at Scale
Level: Intermediate to advanced · For: Senior/Staff engineers, platform teams, security-adjacent builders.
Security architecture for real systems, not a CISSP crib sheet: AuthN vs AuthZ, OAuth2/OIDC, JWT (and why you probably shouldn't), mTLS, secrets management, DDoS/WAF, compliance (GDPR/DPDP/CCPA), software supply chain, privacy-preserving systems, post-quantum cryptography.
| # | Chapter | What it covers |
|---|---|---|
| 7.0 | Authentication vs Authorization: Identity, Permissions, and Access Models | AuthN vs AuthZ, session vs token auth, and access control models: RBAC, ABAC, ReBAC with examples from SpiceDB, OpenFGA, and AWS IAM. |
| 7.1 | OAuth 2.0 and OpenID Connect: Delegated Authorization and Identity Done Right | The OAuth 2.0 authorization framework, OIDC identity layer, and the Authorization Code + PKCE flow that is the modern standard for web and mobile. |
| 7.2 | JWT Deep Dive: Signed Tokens, Claims, and the Revocation Problem | How JSON Web Tokens work: JWS signing, JWE encryption, claim validation, key rotation, and the trade-offs of stateless auth. |
| 7.3 | mTLS and Service-to-Service Authentication: SPIFFE, Service Mesh, and Zero Trust | How mutual TLS, SPIFFE/SPIRE, and service meshes like Istio and Linkerd authenticate services without long-lived credentials. |
| 7.4 | Secrets Management: Vault, KMS, and the End of Secrets in Config Files | Managing API keys, passwords, and certificates with Vault, AWS Secrets Manager, KMS envelope encryption, and dynamic secrets. |
| 7.5 | DDoS Protection and WAFs: Mitigating Volumetric and Application Attacks | Defending against L3/L4 and L7 DDoS with Cloudflare, AWS Shield, and WAFs; rate limiting, bot management, and the OWASP Top 10. |
| 7.6 | Data Residency and Compliance Architecture (GDPR, DPDP, CCPA, Right-to-Erasure) | Designing multi-jurisdictional systems for GDPR, DPDP, CCPA, and LGPD with data classification, regional silos, crypto-shredding, and auditable erasure. |
| 7.7 | Supply Chain Security: SBOM, SLSA, Sigstore, and Defending Against xz-utils | Protecting the software supply chain with SBOMs, SLSA provenance, Sigstore signing, admission policies, and lessons from xz-utils and SolarWinds. |
| 7.8 | Privacy-Preserving Systems (Differential Privacy, Federated Learning) | Design systems that protect user data by construction: differential privacy, federated learning, secure aggregation, and an introduction to homomorphic encryption. |
| 7.9 | Post-Quantum Cryptography: Migrating to ML-KEM, ML-DSA, and a Crypto-Agile Future | Why harvest-now-decrypt-later makes PQC urgent, what NIST standardized in 2024, and how to migrate production TLS and long-lived secrets to hybrid post-quantum cryptography. |
Part 8 · Case Studies
Level: Intermediate to advanced · For: Interview prep candidates, engineers building adjacent systems, anyone who learns best from worked examples.
End-to-end system designs, each following a consistent structure: requirements (functional + non-functional), back-of-envelope numbers, high-level architecture, data model, deep-dive components, scalability and reliability considerations, and real-world references. Grouped thematically below for easier navigation.
Core primitives
The interview classics. One building block per chapter, designed from scratch.
| # | Chapter | What it covers |
|---|---|---|
| 8.0 | Design a URL Shortener (TinyURL / bit.ly) | Capacity estimation, short-code generation, hot-key caching, and an analytics pipeline that never blocks the redirect. |
| 8.1 | Design a Pastebin (Paste Sharing Service) | Object storage split, TTL-based expiration pipelines, syntax highlighting placement, and abuse prevention. |
| 8.2 | Design a Distributed Rate Limiter | Algorithm choice, Redis Lua atomicity, two-tier local+global synchronization, and fail-open failure modes. |
| 8.3 | Design a Distributed Key-Value Store (Dynamo / Cassandra / Riak) | Design a distributed KV store with consistent hashing, quorum replication, gossip membership, hinted handoff, and Merkle-tree anti-entropy repair. |
| 8.4 | Design a Notification System (Push, SMS, Email at Scale) | Fan-out architecture, APNs/FCM integration, retry with dead-letter queues, and device-token lifecycle. |
| 8.5 | Design a Chat System (WhatsApp / Messenger / Signal) | Staff-level design for 1:1 and small-group chat at WhatsApp scale: 500M concurrent connections, message ordering, E2E encryption, and storage model trade-offs. |
| 8.6 | Design a Social Media Feed (Twitter / Instagram / LinkedIn) | Fan-out architecture, hybrid push/pull, ML ranking pipelines, and the celebrity problem at Twitter/X scale. |
| 8.7 | Design a Photo Sharing Service (Instagram) | Design Instagram-scale photo sharing: upload pipeline, transcoding, multi-resolution image serving, CDN with origin shielding, and news feed integration. |
| 8.8 | Design a Web Crawler (Googlebot-style) | Design a distributed web crawler with URL frontier, politeness policies, content deduplication, robots.txt compliance, and Bloom-filter-backed URL dedup at billion scale. |
| 8.9 | Design Search Autocomplete (Typeahead Suggestions) | Design a low-latency autocomplete system with tries, top-K precomputation, real-time trending overlays, and multi-tier caching at Google scale. |
| 8.16 | Design a Distributed Cache (Memcached / Redis Cluster) | Design a Memcached- or Redis-style distributed cache: consistent hashing, eviction, replication, client-side sharding, and hot-key mitigation. |
| 8.25 | Design a Proximity Service (Nearby Friends / Yelp) | Design a proximity service for 100M users with 1M concurrent location-sharing sessions: geohash/H3/S2 trade-offs, Redis geosets, bounding-box query fan-out, privacy, and hotspot handling during events. |
| 8.26 | Design a Real-Time Leaderboard | Design a real-time leaderboard for 10M players with 100K score updates/sec, tie-breaking, time-windowed views, friend boards, and approximate rank for the tail. |
| 8.27 | Design a Unique ID Generator (Snowflake, ULID, TSID, UUIDv7) | Design a distributed ID generator producing 10M 64-bit IDs/sec, monotonic-ish ordering, clock-skew resilience, and the four-way trade-off between Snowflake, ULID, TSID, and UUIDv7. |
| 8.29 | Design a Distributed Job Scheduler (Airflow / Temporal / Distributed Cron) | Design a scheduler for 100k registered jobs and 10k executions/sec with exactly-once execution, DAGs up to 10k nodes, late/missed run policies, and graceful scheduler upgrades. |
Consumer products
End-user products built from several building blocks.
| # | Chapter | What it covers |
|---|---|---|
| 8.10 | Design a Video Streaming Service (YouTube / Twitch / TikTok) | Design a UGC video platform from upload through adaptive bitrate streaming: transcode pipeline, HLS/DASH/CMAF packaging, CDN delivery with ISP peering, and live ingest architecture. |
| 8.11 | Design Netflix (End-to-End) | A whole-system walkthrough of Netflix's architecture: microservices, Open Connect CDN, per-title encoding, Cassandra + EVCache, resilience patterns, and chaos engineering. |
| 8.12 | Design a Ride-Hailing Service (Uber / Lyft) | H3 geospatial indexing, real-time location ingest, batched bipartite matching, surge pricing, and trip orchestration. |
| 8.13 | Design Google Maps (Routing and Tile Rendering) | Design planet-scale mapping: map tile rendering, shortest-path routing with contraction hierarchies, ETA prediction with GNNs, and offline maps. |
| 8.14 | Design a File Sync Service (Dropbox / Google Drive) | Design a Dropbox-style file sync service: block-level deduplication, delta sync, conflict resolution, versioning, and client-server reconciliation. |
| 8.15 | Design Collaborative Editing (Google Docs / Figma / Notion) | Staff-level design for real-time collaborative editing at 100K+ concurrent editors: OT vs CRDTs, presence broadcasting, offline sync, and version history. |
| 8.18 | Design a Ticketing System (BookMyShow / Ticketmaster) | Seat locking with Redis SETNX, saga-based payment, virtual waiting rooms, and anti-bot defenses at 500M tickets/year scale. |
| 8.21 | Design a Food Delivery Service (DoorDash / Swiggy) | Design a three-sided food delivery marketplace: dispatch with batching and reassignment, composite ETA prediction, and driver-merchant-customer coordination. |
| 8.28 | Design a Hotel Reservation System (Booking.com / Airbnb) | Staff-level design for hotel reservation: search/booking split, PostgreSQL exclusion constraints for date-range double-booking prevention, Temporal saga orchestration, and CDC-backed availability indexing at 85K QPS. |
| 8.40 | Design a Dating App (Tinder / Hinge / Bumble) | Design a dating app for 100M MAU handling 1.5B swipes/day with <50 ms card loads: two-tower recommendations, geospatial filtering, mutual-match detection, and safety-at-scale. |
| 8.43 | Design a Video Conferencing System (Zoom / Google Meet) | Design a video conferencing platform for 500K simultaneous meetings and 10M concurrent participants with <150 ms audio and <500 ms video: SFU vs MCU vs P2P, simulcast and SVC, bandwidth estimation, regional media routing, and real-time recording. |
| 8.44 | Design an Email Service at Gmail Scale (1.8B Users, 300B Messages/Day) | Design a global email service for 1.8B users and 300B messages/day: SMTP ingress, spam pipeline cascade, per-user sharded search, RFC 5322 threading, and exabyte-scale tiered storage with content-addressed attachment dedup. |
| 8.45 | Design Live Comments at Scale (FB Live / YouTube Live / Twitch Chat) | Design a live-comment system for 10M concurrent viewers and 100K commenters on one stream: delta-batched fan-out, pre-publish moderation, and the celebrity-stream hotspot. |
| 8.47 | Design a Fitness Tracking Service (Strava / MapMyRun) | Design a fitness tracking service for 195M+ users: GPS ingestion, two-stage segment matching with H3 pre-filter and DTW, Kafka-backed leaderboards, and privacy-safe planetary heatmaps. |
Financial systems
Systems where correctness, audit and regulation come first.
| # | Chapter | What it covers |
|---|---|---|
| 8.19 | Design a Payment System (Stripe / PayPal) | Design a payment system with a double-entry ledger, idempotency keys, saga-orchestrated cross-service flows, and the compliance constraints that shape every decision. |
| 8.20 | Design a Stock Exchange (Matching Engine) | Design a deterministic, low-latency matching engine: FIFO order book, price-time priority, multicast market data distribution, and co-location realities. |
| 8.41 | Design an Online Auction (eBay / Catawiki) | Design an online auction for 100M active listings and 10M concurrent bidders: Redis Lua CAS for atomic bids at 1M/sec peak, proxy bidding, sniping extensions, and WebSocket fan-out. |
| 8.46 | Design a Fraud Detection System (Stripe Radar / PayPal / Feedzai) | Design a real-time fraud detection service scoring millions of events per second under 100 ms p99 with a rules-ML cascade, online/offline feature store, graph ring detection, and analyst feedback loop. |
| 8.54 | Design a Brokerage Platform (Robinhood / E*TRADE / Interactive Brokers) | Design a retail brokerage for 30M users: order routing, symbol-channel quote fanout, fractional-share aggregation, tax-lot accounting, and seven-year regulatory audit. |
AI systems
Systems where inference, retrieval or agent behavior is the hard part.
| # | Chapter | What it covers |
|---|---|---|
| 8.17 | Design a Recommendation System (Netflix / YouTube / TikTok) | Design a two-stage recommendation system: candidate generation, ranking, collaborative filtering, content-based features, a feature store, and cold-start handling. |
| 8.30 | Design ChatGPT (Conversational AI at Scale) | Design ChatGPT for 900M weekly users: multi-tenant LLM serving, session-state architecture, streaming SSE, per-user memory, safety, and multi-region deployment. |
| 8.31 | Design an Enterprise RAG System | Design a multi-tenant enterprise RAG platform for 1k tenants with 10M documents each at 100 QPS/tenant: ingestion, hybrid retrieval, reranking, citation, access-control-aware retrieval, freshness, and tenant isolation. |
| 8.32 | Design a Coding Agent (Claude Code / GitHub Copilot / Cursor) | Design a coding agent serving 1M concurrent sessions across autocomplete, chat, and autonomous loop modes with repo indexing, sandboxed tool use, and streaming diff application. |
| 8.33 | Design Perplexity (AI Search with Citations) | Design an AI search engine for 50M MAU, 5k QPS peak, <2 s answer latency with inline citations: query rewriting, source retrieval, citation-grounding, streaming output, freshness, and fact-check post-processing. |
| 8.34 | Design a Voice Agent (Alexa / Siri-Class Realtime) | Design a realtime voice agent for 100M devices with 50k concurrent conversations and sub-700 ms turn latency: streaming ASR, LLM turn-taking, streaming TTS, WebRTC transport, and barge-in. |
| 8.35 | Design a Content Moderation System at Scale | Design moderation for 500M posts/day with <200 ms pre-publish latency, human-in-loop for 0.5% of traffic, multi-modal (text+image+video): classifier cascade, reviewer workflow, appeals, adversarial robustness. |
| 8.36 | Design a Semantic Cache for LLM Applications | Design an embedding-similarity cache for LLM prompts at 10k QPS, 70%+ hit rate, <10 ms lookup: similarity threshold calibration, invalidation on source change, per-tenant isolation, false-positive cost accounting. |
| 8.37 | Design a Model Router and Gateway (OpenRouter / LiteLLM) | Design a gateway routing 20k QPS across 50+ models and 10 providers with <30 ms routing overhead: cost/latency/quality routing strategies, provider failover, streaming pass-through, per-tenant quotas, cost attribution. |
Infrastructure platforms
Platforms other engineers build on.
| # | Chapter | What it covers |
|---|---|---|
| 8.22 | Design a Metrics Pipeline (Prometheus / InfluxDB / Thanos) | Design a time-series metrics pipeline: high-cardinality ingestion, aggregation across clusters with Thanos or Cortex, alerting, and downsampling for long-term retention. |
| 8.23 | Design Ad-Click Aggregation (Real-Time Stream Processing) | Design an ad-click aggregation system with exactly-once semantics on Kafka + Flink, real-time fraud detection, and low-latency dashboards. |
| 8.24 | Design a Logging Platform (ELK / Loki / Splunk) | Design a logging platform: ingestion at scale, index vs. label-based storage (Elastic vs Loki), retention tiering, and full-text search with BM25. |
| 8.38 | Design a Feature Flag Service (LaunchDarkly / Harness FME / Unleash) | Design a feature flag and experimentation platform for 20T evaluations/day with sub-millisecond SDK-side latency, streaming config distribution, and sub-60s kill-switch propagation. |
| 8.39 | Design a DNS Service (Cloudflare 1.1.1.1 / Google 8.8.8.8) | Design a public recursive DNS resolver serving trillions of queries/day globally with <20 ms p99 from 300+ anycast POPs: UDP/TCP/DoT/DoH/DoQ, DNSSEC validation, cache design, rate limiting, and DDoS survivability. |
| 8.42 | Design a Multi-Tenant SaaS Platform | Design a multi-tenant SaaS platform serving 50K tenants with per-tenant SLA tiers, metered billing, noisy-neighbor containment, and zero cross-tenant data leakage. |
| 8.48 | Design an Online Judge (LeetCode / Codeforces / HackerEarth) | Design an online judge for 1M users at 100K submissions/hour peak with <15s verdict p99: Firecracker sandboxes, priority queueing for contests, seccomp + cgroups isolation, and MOSS-style plagiarism detection. |
| 8.49 | Design a Price Tracking Service (CamelCamelCamel / Honey / Keepa) | Design a price-tracking service that watches 100M product URLs with priority-driven scraping, diff-based alerting to 10M subscribers, 2-year historical retention, and polite rotation through a proxy pool that retailers actively try to block. |
| 8.50 | Design an API Gateway at Scale (Kong / AWS API Gateway / Apigee / Envoy) | Design an API gateway that handles 100K RPS per instance with <5 ms p99 overhead across 10K upstream services: routing trie, local+global rate limiting, mTLS termination, hitless config reload, and circuit breaking. |
| 8.51 | Design a CI/CD Platform (GitHub Actions / GitLab CI / CircleCI) | Design a CI/CD platform for 100K orgs and 10M workflow runs/day: YAML DAG execution, ephemeral runner pools (Firecracker), content-addressed artifacts, dependency caches, secrets injection, and multi-tenant isolation at 40K concurrent runners. |
| 8.52 | Design an Observability Platform (Datadog / New Relic / Honeycomb) | Design a unified observability platform for 10M hosts and 1B events/sec: OTLP ingestion across metrics, logs, and traces, cardinality control, trace-log correlation, multi-tenant isolation, and query latency at 100K concurrent analysts. |
| 8.53 | Design a Search Engine (Google-Scale / Brave Search) | Design a web-scale search engine over 10B documents serving 100K queries/sec at <200 ms p99: sharded inverted index, BM25 + PageRank + neural re-ranking cascade, query understanding, and freshness pipelines. |
| 8.55 | Design Channel-Scale Chat (Discord / Slack) | Design channel-scale chat for 100K+ member channels with pub/sub fanout, RBAC on the hot path, presence aggregation, and workspace search. |
Part 9 · AI & ML System Design
Level: Intermediate to advanced · For: Anyone building with or around LLMs, agents, or production ML.
Modern AI-systems architecture, treated with the same rigor as Part 3: LLM serving, RAG, vector search, agent architectures, multi-agent orchestration, LLM evaluation, LLMOps, cost optimization, safety, ML fundamentals, feature stores, recommenders, real-time AI, multimodal, and the data infra underneath all of it.
| # | Chapter | What it covers |
|---|---|---|
| 9.0 | LLM Serving Architecture (vLLM, TGI, TensorRT-LLM) | Design a production LLM inference stack: continuous batching, paged attention, KV-cache management, and multi-tenant GPU scheduling. |
| 9.1 | RAG Pipelines (Retrieval-Augmented Generation) | Design production RAG: chunking, embedding models, hybrid dense-plus-sparse retrieval, reranking, and the eval loops that keep it honest. |
| 9.2 | Vector Search at Scale (HNSW, IVF-PQ, DiskANN) | Design billion-scale vector search: HNSW, IVF-PQ, and DiskANN indexes, product quantization, hybrid BM25-vector search, and sharding strategies. |
| 9.3 | AI Agent Architectures (ReAct, Reflection, Planning, Tool Use, Memory) | The canonical patterns for turning an LLM into an agent: ReAct's think-act-observe loop, reflection and self-critique, planner-executor decomposition, tool use and function calling, and how agents manage short- and long-term memory. |
| 9.4 | Multi-Agent Orchestration (LangGraph, OpenAI Agents SDK, AutoGen, Swarm) | Composing multiple agents into a reliable system: orchestrator-worker topologies, handoffs and delegation, shared memory, parallel fan-out, and the failure modes of agent graphs. |
| 9.5 | LLM Evaluation and Observability (Ragas, LangSmith, TruLens, LLM-as-Judge) | How to evaluate LLM systems before and after they ship: golden datasets, reference-free metrics, LLM-as-judge, continuous eval pipelines, and the observability stack for production LLMs. |
| 9.6 | LLMOps and Prompt Engineering (Versioning, Guardrails, Red-Teaming) | The operational side of shipping LLM features: prompt-as-code, versioning, rollback, A/B testing prompts, structured outputs, and red-teaming before launch. |
| 9.7 | LLM Cost Optimisation (Semantic Cache, Model Routing, Cascading, Prompt Caching) | The cost-engineering toolbox for production LLMs: semantic caching, model routing, cascade small-then-big, prompt caching (Anthropic, OpenAI), and the unit economics that decide per-request margin. |
| 9.8 | LLM Safety and Guardrails (OWASP LLM Top 10, Prompt Injection, PII, Jailbreaks) | The safety-engineering surface for LLM applications: OWASP LLM Top 10, prompt-injection defence, PII redaction, jailbreak containment, and the defence-in-depth model for public-facing agents. |
| 9.9 | ML System Design Fundamentals | The classic ML systems backbone every modern AI product sits on: candidate generation, ranking, two-tower embeddings, offline/online feature parity, and the training-serving skew problem. |
| 9.10 | Feature Stores and Model Serving (Feast, Tecton, KServe, BentoML, MLflow) | The infrastructure that makes ML shippable: online and offline feature stores, the model registry, model servers, shadow deploys, and the production lifecycle around a trained model. |
| 9.11 | Recommendation Systems Deep Dive (DLRM, Two-Tower, Embedding Retrieval, Cold Start) | How modern recommenders actually work end-to-end: candidate gen via ANN on embeddings, DLRM-style ranking, exploration-exploitation, cold-start handling, and the evaluation loop that keeps metrics honest. |
| 9.12 | Realtime AI and Voice Agents (Streaming Inference, WebRTC, LiveKit, Deepgram) | Designing sub-second voice agents: streaming ASR, low-latency LLM inference, streaming TTS, WebRTC transport, interruption handling, and the end-to-end latency budget. |
| 9.13 | Multimodal AI Systems (CLIP, Whisper, LayoutLM, Document AI) | Designing systems that ingest images, audio, video, and documents: CLIP-style embeddings for cross-modal retrieval, Whisper pipelines, OCR-plus-layout models, and the storage architecture for unstructured data. |
| 9.14 | Data Infrastructure for AI (Embedding Pipelines, Chunking, Unstructured ETL, MCP) | The data plane that feeds AI systems: source connectors, chunking strategies, embedding at scale, metadata schema, freshness, and the Model Context Protocol as a standard interface. |
Part 10 · Emerging Patterns
Level: Intermediate · For: Staff+ engineers and architects thinking past 2026.
Forward-looking topics that sit next to everything else in the book.
| # | Chapter | What it covers |
|---|---|---|
| 10.0 | Green Computing (Carbon-Aware Scheduling, PUE, Sustainable Systems) | Design systems that account for carbon: carbon-aware scheduling, PUE, renewable-energy datacenters, and the Green Software Foundation practices. |
Part 11 · Interview Framework
Level: Intermediate to advanced · For: Anyone preparing for or giving system-design interviews.
How to run a 45-minute system-design interview, from both sides of the whiteboard. Compares RESHADED / PEDALS / ADEPT frameworks, teaches requirements scoping, diagramming, trade-off articulation, company-specific flavors, and RFC/design-doc authoring for Staff-level work.
| # | Chapter | What it covers |
|---|---|---|
| 11.0 | Interview Frameworks Compared (RESHADED, PEDALS, ADEPT) | Compare the major system-design interview frameworks and pick the one you will use in every interview. |
| 11.1 | Requirements Scoping: Functional, Non-Functional, and MoSCoW | Master the first five minutes of a system design interview: functional vs non-functional requirements, MoSCoW prioritization, and time-boxing the scope. |
| 11.2 | Diagramming Skills for System Design Interviews | Build whiteboard and virtual diagrams that interviewers can read: consistent notation, flow direction, and the tools (Excalidraw, Miro) that the industry prefers. |
| 11.3 | Trade-off Articulation: Saying 'It Depends' Well | Learn to verbalize design trade-offs the way senior engineers do: name the axis, state the dependency, and commit to a choice. |
| 11.4 | Company-Specific Interview Flavors (Amazon, Google, Meta, Netflix) | How the same system design question looks different at Amazon, Google, Meta, and Netflix: leadership principles, scale emphasis, product sense, and simplicity. |
| 11.5 | Design Doc Authoring: RFCs, ADRs, and the Staff Engineer's Written Output | How to write ADRs, design docs, and RFCs that drive alignment, record decisions, and demonstrate Staff+ engineering judgment. |
Trade-offs Library
The design questions that come up again and again, each answered on a dedicated page with a decision flowchart, a comparison table, when to pick each side, real-world examples and citations. Chapters across the book link here.
Every trade-off page — consistency, storage, APIs, real-time, scaling, transactions, deployment
| # | Trade-off | How to decide |
|---|---|---|
| 1 | Strong vs Eventual Consistency | When to pick linearizable consistency, when eventual is enough, and the session-guarantees hybrid that most production systems actually run. |
| 2 | ACID vs BASE | When ACID transactions earn their coordination cost, when BASE is the only thing that scales, and why most systems run both. |
| 3 | SQL vs NoSQL | When relational wins, when non-relational wins, and why 'SQL does not scale' is almost always wrong in 2026. |
| 4 | Latency vs Throughput | When to optimize for the single request, when to optimize for the aggregate, and why batching has a non-obvious ceiling. |
| 5 | CAP and PACELC Applied | CP or AP under partition, and why PACELC's else-clause (latency vs consistency) is the choice you face on every request. |
| 6 | Cache Strategies: Cache-Aside vs Write-Through vs Write-Behind | The right cache-database coordination pattern: what you gain, what you lose, and why most systems use a hybrid. |
| 7 | Batch vs Stream Processing | Discrete job runs vs continuous flow, pinned to the freshness SLO that actually matters. |
| 8 | Load Balancer vs Reverse Proxy vs API Gateway | Between L4 load balancers, L7 reverse proxies, and API gateways based on your traffic layer, protocol, and policy needs. |
| 9 | REST vs gRPC vs GraphQL | The right API protocol based on caller identity, caching needs, and payload shape. |
| 10 | Polling vs Long-Polling vs SSE vs WebSockets vs Webhooks | The right real-time pattern. Five options, each right for a different niche; the wrong one means missed updates, wasted bandwidth, or operational pain. |
| 11 | Rate Limiting Algorithms: Token Bucket vs Sliding Window | The right rate-limiting algorithm. Token bucket tolerates bursts; sliding window enforces accuracy; the hybrid path layers both. |
| 12 | Optimistic vs Pessimistic Concurrency Control | Validate-at-commit vs lock-first concurrency. The answer depends on conflict rate, retry cost, and side effects. |
| 13 | Partitioning Schemes: Range, Hash, Consistent Hash, Directory | Four canonical partitioning strategies. Pick based on query pattern, rebalance cost, and hot-spot risk. |
| 14 | B-tree vs LSM-tree Storage | Between B-tree and LSM-tree storage engines based on read:write ratio, latency SLOs, and operational complexity. |
| 15 | Monolith vs Microservices | Architecture choice that mirrors your org chart. Team size and domain stability decide, not traffic. |
| 16 | Replication Topologies: Leader-Follower, Multi-Leader, Leaderless | How writes propagate: single-leader, multi-leader, leaderless, or per-range-leader hybrid. |
| 17 | Distributed Transactions: 2PC vs Saga vs TCC | Between two-phase commit, saga compensations, and try-confirm-cancel based on isolation needs, transaction duration, and participant control. |
| 18 | Push vs Pull (Fan-out, Messaging, Feed) | Fundamental data-propagation choice: push front-loads compute on writes, pull back-loads it on reads. The fan-out ratio decides. |
| 19 | Lambda vs Kappa Architecture | Two pipelines (batch + stream) vs one (stream-only with log replay) for analytics data systems. |
| 20 | Vertical vs Horizontal Scaling | Scaling up a single machine vs scaling out across many. Default: vertical first, horizontal only when measured bottlenecks demand it. |
| 21 | Normalization vs Denormalization | Between strict 3NF schemas and redundant pre-joined data, with the hybrid CDC-projection pattern most production systems actually run. |
| 22 | Single-Region vs Multi-Region Deployment | Deployment geography: single-region is the default, multi-region is the most expensive choice you can make, and regional pinning is the hybrid most teams actually need. |
The DSA Handbook
Data structures and algorithms, taught pattern by pattern.
Website · content/dsa/ · DSA style rules
The DSA Handbook builds from Big-O and recursion through linear structures, searching and sorting, and the array-walking patterns, then trees, graphs, dynamic programming and the advanced string algorithms. It finishes with designing data structures to an API contract and with the interview itself: recognizing the pattern, asking the right questions, and narrating your solution.
How a chapter is built. Each chapter opens with a cheat-sheet table, explains the structure or pattern in depth, then works through LeetCode problems as prompt cards, each with a worked example, a solution walkthrough and the common mistakes. The Python solution is inline. Java, C++ and Go solutions sit next to the chapter in lc-NNN/ folders (sol.py, sol.java, sol.cpp, sol.go), each with test cases.
DSA parts at a glance
Pick a part number to jump to its chapters, or open any part below.
| Part | What it covers | Level |
|---|---|---|
| 0 | Foundations — Big-O, recursion, bit ops, interview math, language idioms, choosing your language | Beginner |
| 1 | Linear Data Structures — arrays, dynamic-array internals, strings, hash maps, stacks, queues, matrices | Beginner to advanced |
| 2 | Search & Sort — linear/binary search, comparison & linear-time sorts, heap sort, quickselect | Beginner to intermediate |
| 3 | Two Pointers, Sliding Window, Prefix Sums — the array-walking patterns that turn O(n²) into O(n) | Beginner to intermediate |
| 4 | Stack & Queue Patterns — monotonic stack/deque, min/max stack, expression parsing, queue-from-stacks | Intermediate |
| 5 | Linked Lists — pointer rewiring, reversal, k-group reversal, Floyd's cycle, merging, LRU cache | Beginner to intermediate |
| 6 | Trees & Heaps — traversals, Morris, BFS, heaps, BST, AVL/RB, tries, tree DP, segment trees | Beginner to advanced |
| 7 | Recursion & Backtracking — recursion patterns, the template, subsets/perms, N-Queens, Sudoku, randomized algos | Intermediate to advanced |
| 8 | Graphs — BFS/DFS, components, topo, cycles, bipartite, union-find, Dijkstra, Bellman-Ford, MSTs | Beginner to advanced |
| 9 | Dynamic Programming — memo↔tab, 1D/grid/interval/tree/bitmask, knapsack, LCS, edit distance, LIS, palindromes | Intermediate to advanced |
| 10 | Greedy — when local choices win, intervals, activity selection, Huffman, jump games | Intermediate |
| 11 | Bit Manipulation — the bit-ops cookbook, XOR patterns, bitmask techniques, performance tricks | Intermediate to advanced |
| 12 | Strings & Pattern Matching — naive matching, Rabin-Karp, KMP, Z-array, Aho-Corasick, suffix arrays | Intermediate to advanced |
| 13 | Design the Data Structure — LRU/LFU, min stacks, hit counter, trie autocomplete, Twitter feed, game state | Intermediate to advanced |
| 14 | Interview Framework — pattern recognition, clarifying questions, communicating, complexity, mocks, per-company tracks | Intermediate |
Part 0 · Foundations
Level: Beginner · For: Anyone starting interview prep, or returning after a long pause.
The mental models and language fluency that everything else assumes. Big-O, the recursion mental model, bit-manipulation primer, the math you actually need for interviews, language idioms across Python / Java / C++ / Go, and how to pick which language to interview in.
| # | Chapter | What it covers |
|---|---|---|
| 0.0 | How to use this handbook | How to read this handbook: who it's for, what to skip, how to pick a language, and the four questions every DSA resource ducks. |
| 0.1 | Computational complexity and Big-O | Computational complexity, Big-O, and the asymptotic vocabulary every algorithm chapter assumes you have. The five Bachmann-Landau notations. |
| 0.2 | The recursion mental model | The mental model for recursion: base case, recursive case, and how to read tree-shaped recursion without losing your place. |
| 0.3 | Bit manipulation primer | Bit manipulation primer: AND, OR, XOR, NOT, shifts, popcount. The bit-level idioms that show up in interview problems. |
| 0.4 | Math for interviews | The math you actually need for technical interviews: modular arithmetic, GCD, primality, combinatorics, integer overflow. |
| 0.5 | Language idioms across Python, Java, C++, Go | Idiomatic patterns for Python, Java, C++, and Go: collections, iteration, sorting, comparators. The dialect each language wants you to write. |
| 0.6 | Choosing your interview language | How to pick a language for technical interviews: trade-offs, what each language costs you in problem-solving time, and a decision tree. |
Part 1 · Linear Data Structures
Level: Beginner to advanced · For: Everyone. These structures show up in most interview problems.
The contiguous-memory and bucket-based data structures: arrays (static / dynamic / multi-dimensional), the amortized-O(1) doubling rule that makes a vector work, strings as encoded byte arrays, hash maps and hash sets, the load-factor / collision math behind them, stacks and queues with the call-stack analogy, and matrix manipulation tricks (rotate-in-place, spiral, transpose).
| # | Chapter | What it covers |
|---|---|---|
| 1.0 | Arrays: static, dynamic, multi-dimensional | Arrays: contiguous memory, O(1) indexing, and the operations that differ between fixed-size arrays and dynamic arrays. |
| 1.1 | Dynamic array internals | How dynamic arrays grow: amortised O(1) append, the doubling trick, capacity vs length, and what each language calls them. |
| 1.2 | Strings: encoding, immutability, builders | Strings as character arrays and beyond: immutability, encoding, concatenation cost, and the per-language trade-offs that catch interviews out. |
| 1.3 | Hash maps and hash sets | Hash maps from first principles: hash functions, buckets, average vs worst-case complexity, and the standard library implementations. |
| 1.4 | Hash collisions and the load factor | Hash collisions: separate chaining, open addressing, load factor, rehashing, and why hash maps degrade to O(n) under adversarial keys. |
| 1.5 | Stacks and the call stack analogy | Stacks as data structures and algorithmic primitives: LIFO, function-call stacks, and the interview problems that scream 'stack'. |
| 1.6 | Queues, deques, and circular buffers | Queues and deques: FIFO, double-ended, ring buffers, and the BFS / sliding-window problems where the right primitive is a deque. |
| 1.7 | Matrix manipulation | 2D arrays and matrix manipulation: in-place rotation, transposition, spiral traversal, and indexing without off-by-one bugs. |
Part 2 · Search & Sort
Level: Beginner to intermediate · For: Every interviewee. Binary search alone shows up again and again.
How to find things and how to order things. Linear search and when it's actually the right answer; the canonical binary search written without off-by-one bugs; the lower_bound / upper_bound / peak / rotated-array variants; the comparison-sort family (insertion, merge, quicksort with the production hybrids like Timsort and Introsort); heap sort and why n log n is the comparison-sort lower bound; the linear-time sorts (counting, radix, bucket); and quickselect for the top-k problems.
| # | Chapter | What it covers |
|---|---|---|
| 2.0 | Linear search and what it's good for | Linear search: when O(n) is the right answer, and the problems where the trick is recognising you don't need anything cleverer. |
| 2.1 | Binary search: the canonical version | Binary search done right: the canonical template, off-by-one pitfalls, and the invariant you need to articulate before writing the loop. |
| 2.2 | Binary search variants: lower_bound, upper_bound, peaks, and rotated arrays | Binary search beyond sorted arrays: lower_bound, upper_bound, first-true, last-true, and binary search on the answer space. |
| 2.3 | Comparison sorts I: insertion sort and merge sort | Insertion, selection, and bubble sort: O(n^2) sorts, when each wins on real input, and the constant-factor lessons that hide inside them. |
| 2.4 | Comparison sorts II: quicksort, partition, and the production hybrids | Merge sort and quicksort: divide-and-conquer, partitioning, stability, and why production library sorts are hybrid algorithms. |
| 2.5 | Heap sort and the n log n lower bound | Heap sort and the binary heap: heapify, sift-up, sift-down, and why a heap is the right tool for k-way merges and priority queues. |
| 2.6 | Linear-time sorts: counting, radix, bucket | Counting sort, radix sort, bucket sort: O(n) sorts that beat the comparison-sort lower bound when the input has structure. |
| 2.7 | Quickselect: linear-time selection | Quickselect: O(n) average kth-smallest, partitioning, and the problems where you can dodge a full sort by selecting only the part you need. |
Part 3 · Two Pointers, Sliding Window, Prefix Sums
Level: Beginner to intermediate · For: Anyone whose nested-loop solutions keep timing out.
Three closely related patterns that all amount to "walk the array smarter": opposite-ends two pointers (Container With Most Water, 3Sum), same-direction two pointers, fixed and variable sliding windows, prefix sums and difference arrays, and the prefix-sum + hash-map combo for "subarray sum equals K"-shaped problems.
| # | Chapter | What it covers |
|---|---|---|
| 3.0 | Two pointers: opposite ends | Two pointers, opposite ends: the inward sweep, sorted-array invariants, and the canonical 'sum to target' / 'pair under constraint' patterns. |
| 3.1 | Two pointers: same direction | Two pointers, same direction: fast-slow pointers, in-place filtering, and the array problems that disguise this pattern. |
| 3.2 | Sliding window: fixed size | Fixed-size sliding windows: maintaining a running aggregate in O(1) per step, and the problems whose constraint is window length. |
| 3.3 | Sliding window: variable size | Variable-size sliding windows: shrinking when the invariant breaks, and the longest-substring / minimum-window problem family. |
| 3.4 | Prefix sums and difference arrays | Prefix sums: O(1) range-sum queries, 2D extensions, and the subarray-sum problems that simplify once the right precomputation is in place. |
| 3.5 | The prefix-sum + hash-map combo | Prefix sum + hash map: counting subarrays with a target sum, the canonical 'subarray sum equals K' problem family, and modulo extensions. |
Part 4 · Stack & Queue Patterns
Level: Intermediate · For: Anyone struggling with Next-Greater-Element and sliding-window-maximum problems.
Stack and queue as algorithmic patterns, not just data structures. Monotonic stacks (Daily Temperatures, Largest Rectangle in Histogram), monotonic deques (Sliding Window Maximum), min/max stacks (O(1) min query under push/pop), expression parsing (Shunting-Yard / RPN), and the queue-from-stacks amortization argument.
| # | Chapter | What it covers |
|---|---|---|
| 4.0 | Monotonic stack | Push indices, pop while the incoming value violates a monotone order. The data structure designed for the intersection of nearest-greater queries and one-pass linear scans. |
| 4.1 | Monotonic deque | Pop from both ends to maintain a windowed running max or min in O(1) amortized per slide. The structure that makes sliding-window-extremum problems linear instead of n log k. |
| 4.2 | Min and max stacks | Augment a stack with an O(1) aggregate query by pinning a parallel auxiliary stack to it; scale the technique from running min to lazy bulk-update to frequency tracking. |
| 4.3 | Expression evaluation and parsing | Stacks suspend operators until their right operand exists. The shunting-yard rhythm and the LeetCode 224/227/772 family where the order characters arrive in is not the order arithmetic should happen. |
| 4.4 | Queue from stacks | Implement a queue using only stack primitives. The two-stack lazy-transfer trick, amortized O(1) on every operation, and why the LIFO-from-FIFO inverse has no symmetric construction. |
Part 5 · Linked Lists
Level: Beginner to intermediate · For: Anyone who's drawn boxes-and-arrows on a whiteboard and gotten lost.
Linked lists are pointer surgery. Sentinel-node patterns, the canonical iterative reversal (and the recursive cousin), reverse-in-groups-of-k, Floyd's tortoise-and-hare cycle detection (and why the cycle-start formula works), merging sorted lists, and the LRU cache as the canonical hash-map + doubly-linked-list combo.
| # | Chapter | What it covers |
|---|---|---|
| 5.0 | Linked list fundamentals: sentinels, pointer rewiring, doubly-linked design | Sentinel and dummy nodes erase the boundary branching that special-cases head and tail. The pointer-rewiring discipline and the doubly-linked design every later chapter in Part 5 assumes. |
| 5.1 | Reversal patterns | Reverse a singly-linked list in place with prev, curr, next. The snapshot-then-clobber rule, plus the iterative and recursive forms that show up as a primitive in every later linked-list chapter. |
| 5.2 | Reverse in groups of k | Three mechanical phases stacked on single-list reversal solve LeetCode 25 in O(1) extra memory, with the seam between groups handled cleanly. |
| 5.3 | Cycle detection (Floyd's tortoise and hare) | Two pointers, one stepping twice as fast as the other, locate a cycle's entry node in O(n) time and O(1) space. The modular-arithmetic three-line proof of why the second-phase reset works. |
| 5.4 | Merging linked lists | Merge sorted linked lists in place. The dummy-head trick that erases the first-node special case, two-list and k-list versions, and the heap-based and divide-and-conquer extensions to LC 23. |
| 5.5 | LRU cache: hash map plus doubly linked list | Build the data structure behind LeetCode 146 from a doubly-linked list and a hash map. O(1) get and put with explicit list management, no shortcut through Python's OrderedDict. |
Part 6 · Trees & Heaps
Level: Beginner to advanced · For: Anyone past the linear-data-structure phase of prep.
The hierarchical structures and the priority queue. Binary tree fundamentals, the three depth-first traversals (pre/in/post — both recursive and iterative), Morris traversal for O(1) space, level-order BFS, heaps and priority queues (heapify in O(n)), binary search trees, AVL rotations, a red-black overview, tries, the tree-DP primer (post-order with side state), and an introduction to segment trees for range queries.
| # | Chapter | What it covers |
|---|---|---|
| 6.0 | Binary tree fundamentals | Tree terminology, height vs depth, the two physical representations, and the on-disk vocabulary every later Part 6 chapter assumes you have pinned down. |
| 6.1 | Tree traversals: pre, in, post | One recursive skeleton has three positions for the visit() call. The pre, in, and post placements solve different problem families on the same scaffolding. |
| 6.2 | Morris traversal: O(1)-space inorder by threading | Walk a binary tree in inorder with no recursion stack and no auxiliary memory by threading temporary right-pointers from each subtree's rightmost descendant back to its successor. |
| 6.3 | Level-order traversal: BFS on trees | BFS on trees, with the level_size = len(queue) snapshot that turns 'visit every node' into 'visit every node grouped by depth' with the boundaries preserved. |
| 6.4 | Heaps and priority queues | Sift-up and sift-down, Floyd's O(n) bottom-up build vs O(n log n) repeated insert, and the language-by-language API for the priority-queue primitive. |
| 6.5 | Binary search trees | The BST invariant, search/insert/delete operations, and why every shipping standard library uses a balanced variant instead of a plain BST. |
| 6.6 | AVL trees and rotations | Self-balancing BSTs from first principles: the AVL invariant, the four rotation cases, the 1.44 log(n+2) height bound, and why every production ordered map descends from this 1962 paper. |
| 6.7 | Red-black trees: an overview | The balancing scheme behind TreeMap, std::map, and the Linux scheduler. Five invariants, the rotation cases at a high level, and what an interview can reasonably ask about them. |
| 6.8 | Tries | Children-map-plus-end-flag nodes give prefix walks in O(L) on query length. The autocomplete and IP-routing problem family where prefix structure is the whole point. |
| 6.9 | Tree DP primer: post-order with side state | Post-order helpers thread side state down through arguments, return aggregates up the call stack, and use a global to track diameter-style through-this-node optima. |
| 6.10 | Segment trees | O(log n) point updates and O(log n) range queries on the same array. The recursive build and the lazy-propagation extension for range updates. |
Part 7 · Recursion & Backtracking
Level: Intermediate to advanced · For: Anyone whose subset/permutation/combination solutions feel like guesswork.
Backtracking is just DFS with state-restoration discipline. The recursion patterns (linear, tree, divide-and-conquer); the backtracking template you can adapt to any constraint problem; subsets, combinations, and permutations; N-Queens with pruning; Sudoku with constraint propagation and forward checking; word search on a grid; and Fisher-Yates, reservoir sampling, and rejection sampling for randomized algorithms.
| # | Chapter | What it covers |
|---|---|---|
| 7.0 | Recursion patterns: linear, tree, and divide-and-conquer | Three call-tree shapes — linear, tree, divide-and-conquer — and how to read the shape from the recursive case so you know whether you need memoization, an accumulator, or neither. |
| 7.1 | The backtracking template | Choose, recurse, unchoose, with prune-on-partial-information as the move that turns exponential search into something that finishes. |
| 7.2 | Subsets, combinations, permutations | One recursion with three knobs (when to snapshot the path, what to skip, when to allow repeats) covers subsets (LC 78), permutations (LC 46), and combination sum (LC 39). |
| 7.3 | N-Queens: pruning and constraint propagation | Column and diagonal occupancy bitsets give O(1) attack checks. Symmetry pruning and the constraint-propagation idea that generalizes to Sudoku and beyond. |
| 7.4 | Sudoku solver: constraint propagation and forward checking | Row, column, and box bitmasks combined with MRV cell selection and a forward-checking loop solve a 9x9 in milliseconds, despite 4 × 10^38 candidate fillings. |
| 7.5 | Word search and grid backtracking | Grid DFS with mark-and-restore: the in-place visited trick that turns a 2D backtracking problem into one clean recursion. |
| 7.6 | Randomized algorithms: Fisher-Yates, reservoir sampling, rejection sampling | Three randomized recipes — Fisher-Yates shuffle, reservoir sampling, rejection sampling — whose proofs of uniform correctness are the actual lesson, not the code. |
Part 8 · Graphs
Level: Beginner to advanced · For: Anyone preparing for FAANG-tier interviews — graph problems are the differentiator.
The graph chapters are interview-grade end-to-end. Adjacency-list vs adjacency-matrix representations; BFS and DFS as orthogonal traversal templates; connected components and flood fill (Number of Islands); topological sort via Kahn's queue and via DFS post-order reverse; cycle detection on directed and undirected graphs; bipartite checking; union-find with path compression and union-by-rank; Dijkstra's algorithm; Bellman-Ford and negative cycles; and minimum spanning trees via both Kruskal and Prim.
| # | Chapter | What it covers |
|---|---|---|
| 8.0 | Graph representation | Three ways to store a graph (adjacency list, adjacency matrix, edge list), the memory math that decides between them, and the default every interview assumes. |
| 8.1 | Breadth-first search | Queue, visited set, and the discipline of never enqueuing the same vertex twice. The shortest-path-on-unweighted-edges algorithm, plus its multi-source and grid variants. |
| 8.2 | Depth-first search | Five lines that visit on entry and recurse on neighbors, plus the customization knobs (entry hook, exit hook, edge classification) every advanced graph algorithm later in Part 8 turns. |
| 8.3 | Connected components and flood fill | Counting and measuring components in a graph or grid: the outer scan that turns plain BFS or DFS into the algorithm. |
| 8.4 | Topological sort: Kahn's algorithm | Indegree-driven, queue-based, iterative. Kahn's algorithm flags a cycle by failing to consume every vertex. |
| 8.5 | Topological sort: DFS post-order reverse | DFS-based topological sort: three-color recursion, post-order emission, and the algorithms that fall out of the same skeleton — Tarjan's bridges, Hierholzer's Eulerian path, cycle-length detection. |
| 8.6 | Cycle detection in graphs | Three-state DFS coloring for directed cycles, parent-aware single-state DFS for undirected, and the bug both halves share when the wrong one is used. |
| 8.7 | Bipartite check | Two-color a graph by BFS or DFS. The odd-cycle obstruction, the linear-time check, and the problem family that disguises this question as 'split into two groups'. |
| 8.8 | Union-Find: parent forests, path compression, and union by rank | Parent forests, union by rank, path compression, and the inverse-Ackermann amortized bound. The cycle-detection and connected-components problem family it owns. |
| 8.9 | Dijkstra's shortest-path algorithm | Single-source shortest paths on weighted graphs with non-negative edges: the priority-queue mechanics, the lazy-deletion idiom, and the min-max-path and 0-1 BFS specializations. |
| 8.10 | Bellman-Ford and negative cycles | V-1 edge relaxations on every edge, an extra Vth pass to detect negative cycles, and the algorithm that handles the negative-edge case Dijkstra silently mis-reports. |
| 8.11 | Minimum spanning tree: Kruskal's algorithm | Kruskal's algorithm: sort edges by weight, accept each one whose endpoints sit in different components, halt at n-1 edges. The cycle check is union-find; the cost is the sort. |
| 8.12 | Minimum spanning trees: Prim's algorithm | Prim's algorithm grows a minimum spanning tree from a single start vertex by absorbing the cheapest crossing edge. Same MST as Kruskal, different path; better choice on dense and implicit graphs. |
Part 9 · Dynamic Programming
Level: Intermediate to advanced · For: The part most candidates fear most. Read this if "DP problems just don't click."
The most demanding part of the handbook. Build DP up from recursion (top-down memoization) and re-derive the bottom-up tabulation; 1D-state DPs (Climbing Stairs, House Robber, decision DP); the string-prefix decision DPs (Decode Ways, Word Break); 0/1 and unbounded knapsacks; longest-common-subsequence and edit distance; LIS in O(n²) and the patience-sort O(n log n) variant; palindrome DP; interval DP (matrix chain, burst balloons); grid DP; tree DP; and the bitmask DP family for "all subsets" problems.
| # | Chapter | What it covers |
|---|---|---|
| 9.0 | Dynamic Programming: From Recursion to Memoization | When a recursion's call tree carries redundancy, an eight-character cache drops Fibonacci from O(phi^n) to O(n). The systematic move from naive recursion to memoized recursion to bottom-up tabulation. |
| 9.1 | DP: bottom-up tabulation | Convert memoized recursion to an iterative table fill: dependency DAG, topological order, loop, array. Plus the rolling-pair O(1) compression. |
| 9.2 | Dynamic programming on a 1D state | 1D-state DP: when the answer at index i depends on a small fixed window of earlier indices. Climbing stairs, house robber, min cost climbing stairs, and the rolling-scalars space collapse. |
| 9.3 | Decode Ways and Word Break: string-prefix decision DP | Two string-prefix decision DPs whose recurrences look different but run on the same dp[i] = OR-over-valid-splits skeleton. LC 91 Decode Ways and LC 139 Word Break. |
| 9.4 | 0/1 knapsack | 0/1 knapsack: take-or-skip per item, the 1D table fill, why the inner loop sweeps right-to-left, and the family of subset-sum reformulations (LC 416, 494, 474, 879, 1049). |
| 9.5 | Unbounded knapsack: when items can be picked over and over | One inner-loop direction reversed from 0/1 knapsack unlocks the coin-change family. How 'minimum coins', 'count of ways', and 'minimum cost' all fit one recurrence. |
| 9.6 | Longest common subsequence | The O(n*m) 2D DP for longest common subsequence, parent-pointer recovery for the actual subsequence, and the edit-distance and shortest-common-supersequence variants that live on the same table. |
| 9.7 | Edit distance | Wagner-Fischer's three-way recurrence for the minimum number of insertions, deletions, and replacements that turn one string into another. The canonical 2D string DP. |
| 9.8 | Longest Increasing Subsequence: the quadratic DP | Per-index dp[i] = max-over-smaller-predecessors gives the O(n^2) LIS. Parent-pointer recovery and the variants (LIS count, LIS with k-tolerance) that stay quadratic. |
| 9.9 | LIS: patience sort | From 9.8's O(n^2) DP to O(n log n): the patience-sort framing, the tails-array invariant, binary search by tail value, and the LC 354 sort-then-LIS reduction. |
| 9.10 | Palindrome DP | Filling a 2D table whose recurrence reads dp[i+1][j-1] forces a diagonal fill order. The longest-palindromic-substring and min-cuts family that lives on it. |
| 9.11 | Interval DP: matrix chain and burst balloons | State is dp[l][r], and the recurrence picks the LAST operation in the range. Burst Balloons (LC 312) and Matrix Chain Multiplication (LC 1039) are the canonical specimens. |
| 9.12 | Grid DP: forward fills, backward survives | Top-down forward fills (Unique Paths, Min Path Sum) and bottom-up backward survives (Dungeon Game). The direction is picked by whether the constraint applies at start or finish. |
| 9.13 | Tree DP: states that travel up the call stack | Post-order helpers that return more than one number to the parent — (rob, skip), (diameter, depth) — centered on LC 337 House Robber III and LC 124 Max Path Sum. |
| 9.14 | Bitmask DP | A subset of a small ground set encoded as one integer, dp[mask] = ..., and the assignment / TSP / shortest-path-visiting-all family where this state is the only one that fits. |
Part 10 · Greedy
Level: Intermediate · For: Anyone who's been burned by a greedy that "looked right" and got Wrong Answer.
When local choices yield global optima, and how to prove it. Greedy thinking framed against DP; interval scheduling (the sorting comparator is the algorithm); activity selection and the task-scheduler family; Huffman encoding; and Jump Games / Gas Station as canonical "scan once, maintain a running invariant" problems.
| # | Chapter | What it covers |
|---|---|---|
| 10.0 | Greedy thinking: when local choices win, and when they don't | When the locally-best choice provably aggregates to the globally-best answer. The exchange-argument proof technique and the failure modes where greedy looks right and isn't. |
| 10.1 | Interval scheduling: the comparator is the algorithm | Sort by end time and you've picked the maximum non-overlapping subset. The comparator (not the DP, not the heap) is the entire algorithm. |
| 10.2 | Activity selection and the task-scheduler family | A max-heap of remaining tasks paired with a cooldown queue. The same skeleton solves LC 621 Task Scheduler, room booking, and conference assignment. |
| 10.3 | Huffman encoding | Build the optimal prefix-free code bottom-up by repeatedly merging the two least-frequent symbols. The optimality proof and why this construction wins where top-down construction fails. |
| 10.4 | Jump games and gas station | Two array problems that look O(n^2), both solved by a single linear pass that maintains one running quantity. LC 55 Jump Game and LC 134 Gas Station. |
Part 11 · Bit Manipulation
Level: Intermediate to advanced · For: Anyone preparing for low-level / performance-oriented interviews (HFT, embedded, kernel, GPU).
The bit-ops cookbook (set/clear/toggle, lowest-set-bit, popcount); XOR patterns (Single Number I/II/III, Missing Number); bitmask techniques as compact subset state; and bit-level performance tricks for the "your code is correct, just make it 10× faster" interview round.
| # | Chapter | What it covers |
|---|---|---|
| 11.0 | Bit operations cookbook | The two identities the rest of Part 11 stands on: x & -x for the lowest set bit, x & (x-1) to clear it. Plus popcount, set/clear/flip/test, and subset iteration. |
| 11.1 | XOR patterns | XOR patterns: pair-cancellation as a bit-vector group law, and the family of LC problems it solves in O(n) time and O(1) space. |
| 11.2 | Bitmask techniques | Encode a small set as an integer; iterate every subset; walk the submasks of a mask. The substrate behind bitmask DP. |
| 11.3 | Bit tricks for performance | A toolkit of bit-pattern identities — Brian Kernighan's loop, x & -x, SWAR popcount, de Bruijn bit-scan — and the hardware intrinsics that have made most of them obsolete in production. |
Part 12 · Strings & Pattern Matching
Level: Intermediate to advanced · For: Anyone interviewing where strings are a focus area (search infra, NLP infra, IDEs, compiler tooling).
Substring search beyond the naive O(n·m) baseline. Rabin-Karp with rolling hashes; KMP and the failure function (and why it generalizes the prefix-function); the Z-algorithm; Aho-Corasick for matching many patterns in one pass; and an introduction to suffix arrays for "all substring" queries.
| # | Chapter | What it covers |
|---|---|---|
| 12.0 | Naive string matching | The O(nm) double loop hidden inside str.find and str.indexOf. Average-case behavior on real text, and the adversarial inputs that motivate KMP and Rabin-Karp. |
| 12.1 | Rabin-Karp and rolling hashes | Rolling hashes give O(1)-per-slide hash maintenance for fixed-length windows. Double hashing defeats adversarial collisions and unlocks the duplicate-substring problem family. |
| 12.2 | KMP and the failure function | Knuth-Morris-Pratt: deterministic O(n+m) substring search via the failure function, and the prefix-suffix table that solves a small family of problems on its own. |
| 12.3 | Z-algorithm | Z-array as the prefix-match table on a string; the [l, r) window invariant that makes it linear; how it compares with KMP for exact pattern matching. |
| 12.4 | Aho-Corasick: many patterns, one pass | A trie with failure links: how Aho-Corasick scans a text once and reports every occurrence of every pattern in a fixed dictionary in O(n + m + z) time. |
| 12.5 | Suffix arrays: a sorted index of every suffix | A sorted index of every suffix in roughly 4n bytes, plus the LCP array. The substring-search, longest-repeated-substring, and BWT applications built on these two arrays. |
Part 13 · Design the Data Structure
Level: Intermediate to advanced · For: SDE2+ candidates — "design X" is the staple senior-coding-round question type.
The bridge between DSA and HLD: how to compose primitives into APIs that meet a per-operation complexity contract. The full LRU treatment with concurrency and multi-tier framing; LFU via frequency-bucketed doubly-linked lists; min stacks and max-frequency stacks; hit counters and rate limiters; trie-backed autocomplete; Twitter-feed design; and a game-state design vignette.
| # | Chapter | What it covers |
|---|---|---|
| 13.0 | LRU cache: design framing, concurrency, and multi-tier deployment | Pointer rewiring is the warm-up for LeetCode 146. Thread-safety, multi-tier deployment, and Caffeine-style admission policies are the actual interview. |
| 13.1 | LFU cache: hash map plus frequency-bucketed doubly linked lists | A hash map keyed by frequency, each value a doubly-linked list of equally-frequent entries, plus a min-frequency tracker. The construction that earns LeetCode 460 its Hard rating. |
| 13.2 | Min stack and max-frequency stack | Two design problems, one technique. Pin a parallel auxiliary to a stack and the augmented operation collapses to a peek; the auxiliary's shape tracks the contract. |
| 13.3 | Hit counter and rate limiter | Fixed-window, sliding-window-log, and token-bucket variants of LC 362 Design Hit Counter, with the precision-and-memory trade-offs that production systems (Cloudflare, Stripe, AWS) pick from. |
| 13.4 | Trie autocomplete | Per-node ranked top-k cache, persistent suggestions across keystrokes, and the design moves that take a vanilla trie from O(L + answers) to single-digit-microsecond typeahead. |
| 13.5 | Twitter feed design | LC 355 Design Twitter as a mechanics-driven design class: monotonic timestamps, per-user append-only logs, and a k-way merge through a heap of author cursors for the news feed. |
| 13.6 | Game state design | Store the answer the board would give, not the board itself. Per-row, per-column, per-diagonal counters give LC 348 Tic-Tac-Toe O(1) per move and O(n) memory total. |
Part 14 · Interview Framework
Level: Intermediate · For: Anyone within a month of an actual interview window.
The meta-skills that turn a correct solution into a passing one. Pattern-recognition drills; the first-five-minutes clarifying-questions script; how to narrate while you code; how to discuss complexity convincingly; running productive mock interviews; the most common pitfalls; Amazon Leadership Principles (brief and narration); the Meta AI-assisted round (format, prompting tactics, common failures); and the per-company tracks index that points at company-specific reading lists.
| # | Chapter | What it covers |
|---|---|---|
| 14.0 | Pattern recognition: the fastest skill to develop | The twenty patterns that cover ~95% of new-grad FAANG coding rounds, the top five that cover half on their own, and the recognition rhythm that names the pattern in the first 90 seconds. |
| 14.1 | The first five minutes: clarifying questions | What to ask in the first five minutes. The questions interviewers grade you on, the prompts that signal seniority, and the failure mode that costs the most candidates the round. |
| 14.2 | Communicating during the interview | Thinking aloud, narrating trade-offs, and the interviewing.io data showing the 4-4-2 candidate beats the 3-3-4 candidate on outcomes. |
| 14.3 | Complexity discussions | How to answer 'what's the time complexity?' in one sentence: derive vs memorize, time alongside space, the right qualifier (worst/average/amortized), all four signals at once. |
| 14.4 | The mock interview process | When to start mocking, which platform to use, how many mocks you actually need, and how to run a debrief that converts a session into signal. |
| 14.5 | Common pitfalls | The five highest-leverage failure modes at FAANG-tier loops: jumping to code, silent solving, missed clarifications, unstructured complexity answers, and the signal failures that look like skill failures. |
| 14.6 | Amazon Leadership Principles, briefly | Which Leadership Principles surface most in coding rounds, why the chat at minute 5 and minute 50 is part of the rubric, and the rounds where 'I'll just be excellent at the algorithm' fails. |
| 14.7 | Amazon Leadership Principles narration | STAR-format micro-narrations for the technical rounds, plus the eight to twelve full stories the behavioral and Bar Raiser rounds expect candidates to walk in carrying. |
| 14.8 | Meta's AI round: the format | What Meta's AI-assisted coding round actually is in 2026: 60 minutes, three phases, a model menu, and a rubric that grades how you use the AI more than what the AI produces. |
| 14.9 | Meta's AI round: prompting tactics | Prompting tactics for an AI-assisted coding round. The three-tier hierarchy (orchestrator, spot-checker, typist) that produces the behavior the rubric scores. |
| 14.10 | Meta's AI round: common failures | Candidates who treat the assistant as a solver, candidates who can't explain their own code, and the system-prompt hardening that breaks any prep built on 'AI will catch the bug'. |
| 14.11 | Per-company tracks: index and how to use | When to open a per-company track, how to layer it on Parts 0-13, and the three signals that tell you it's time to move from pattern practice to company-specific calibration. |
Pattern decision pages
When a problem could be solved two ways (recursion or iteration, BFS or DFS, sliding window or prefix sums), a decision page compares them. Each one has a decision tree, a "pick A or pick B" table, typical problems for each side, and references.
Every pattern decision page
Long-form editorials
Classic interview problems treated as full essays: every approach from brute force to optimal, the proof of correctness, edge cases, and follow-up variants.
Every editorial
| LeetCode | Editorial | Step-through widget spec |
|---|---|---|
| 1 | Two Sum | Optimal one-pass hash map |
| 3 | Longest Substring Without Repeating Characters | Last-index jump |
| 5 | Longest Palindromic Substring | Expand around centers |
| 11 | Container With Most Water | Greedy two-pointer shrink |
| 15 | 3Sum | Sort + anchor + opposite-ends with duplicate-skip |
Interactive widget specs
Key DSA chapters come with step-through animations, such as sliding windows, monotonic stacks and Dijkstra. Each one is described in a YAML spec in content/dsa/widgets/, and indexed in _widget-registry.yml. On GitHub, the chapter callouts link to the spec.
The editorial widgets are listed with their editorials above.
Every pattern widget — and the chapters that use it
The AI Engineering Handbook
How to build and run production AI products on top of model APIs.
Website · content/ai-eng/ · Book guide · AI Engineering style rules
An AI engineer builds products on top of foundation models; they don't train them. This book stays on the product side of the model API. It covers how models behave, how to call them reliably, how to write and version prompts, how to evaluate output, how to assemble context, how to retrieve, how to build agents, and how to observe, secure and pay for all of it in production.
Read it in order the first time. Part 0 sets out the escalation ladder the whole book follows: prompt, then context, then retrieval, then tools, then an agent, and fine-tuning last. Part 4, on evals, comes before retrieval and agents on purpose, because everything after it assumes you can measure whether a change helped.
How a chapter is built. There's no fixed template. Most chapters open with a real incident or a failing example, explain the mechanism, and end with something you can apply: a checklist, a decision rule, or a runnable snippet. Code is Python. Figures sit in each part's images/ folder. Prices, model names and benchmark scores carry an "as of" date and a source.
How it relates to HLD Part 9. HLD Part 9 is the whiteboard view: how to design an AI system at scale. This book is the editor view: how to build and operate one. The two books link to each other.
AI Engineering parts at a glance
Pick a part number to jump to its chapters, or open any part below.
| Part | What it covers | Level |
|---|---|---|
| 0 | Start Here — what an AI engineer is, the software baseline, probabilistic systems, the escalation ladder | Beginner |
| 1 | How Models Behave — model tiers, tokens, sampling, embeddings, reasoning models, the cost-quality-latency triangle | Beginner to intermediate |
| 2 | Working with Model APIs — streaming, structured outputs, tool calling, retries, gateways, prompt caching | Beginner to intermediate |
| 3 | Prompt Engineering — prompt anatomy, few-shot, chain-of-thought, templates, versioning | Beginner to intermediate |
| 4 | Eval Fundamentals — look at your data, your first eval set, assertions in CI | Beginner |
| 5 | Context Engineering — context assembly, compression, memory, tool metadata, context testing | Intermediate |
| 6 | Retrieval (RAG) — chunking, vector + hybrid search, reranking, citations, retrieval evals, production indexing | Intermediate to advanced |
| 7 | Agent Engineering — workflows vs agents, tool design, MCP, memory, HITL, multi-agent, voice, frameworks | Intermediate to advanced |
| 8 | Evaluation and Observability — LLM-as-judge, judge bias, RAG/agent evals, CI gates, A/B tests, tracing, dashboards | Intermediate |
| 9 | Security and Governance — prompt injection, the lethal trifecta, guardrails, abuse, PII, compliance, red-teaming | Intermediate to advanced |
| 10 | Production AI — hosted vs self-hosted, fine-tuning decisions, cost and latency engineering, rollouts, SLOs | Intermediate |
| 11 | AI Product Engineering — AI UX, failure recovery, product metrics, experimentation, pricing, feedback loops | Intermediate to advanced |
Part 0 · Start Here
Level: Beginner · For: Everyone, including experienced engineers new to building on LLMs.
What an AI engineer is, the software baseline, thinking in probabilistic systems, and the escalation ladder the whole book follows: prompt, context, retrieval, tools, agent, fine-tune.
| # | Chapter | What it covers |
|---|---|---|
| 0.0 | What an AI engineer is (and isn't) | AI engineer vs ML engineer vs researcher: the API line, the three roles, and exactly what this handbook teaches and skips. |
| 0.1 | The software baseline | The seven engineering skills this book assumes (Python, HTTP, JSON, async, Git, Docker, Postgres), why each one matters for AI work, and where to refresh it. |
| 0.2 | Thinking in probabilistic systems | Why the same LLM call returns different answers even at temperature 0, the five failure modes, and why graceful degradation is the default posture. |
| 0.3 | The escalation ladder | The priority order the whole book runs on: prompt, context, retrieval, tools, agent, fine-tune. Climb the cheapest rung that fixes the failure. |
Part 1 · How Models Behave
Level: Beginner to intermediate · For: Anyone who calls a model API and wants to predict its bill, latency, and failure modes.
The model landscape, tokens and context windows, sampling, embeddings, reasoning models, the cost-quality-latency triangle, and just enough ML to make good system decisions.
| # | Chapter | What it covers |
|---|---|---|
| 1.0 | The model landscape | Place any model into a tier, and know what each tier is for: frontier, mid, fast, and local, plus open-weight vs hosted and chat vs reasoning vs multimodal. |
| 1.1 | Tokens and context windows | Tokens are the unit every LLM bill, limit, and prompt is measured in. How to count them in Python before you send, and why non-Latin text costs more. |
| 1.2 | Sampling and temperature | How temperature and top-p reshape a model's probability distribution, how to pick them per task, and why temperature 0 is not a determinism guarantee. |
| 1.3 | Embeddings | What embeddings are, why cosine similarity and dot product agree on normalized vectors, and the four engineering patterns built on them: search, memory, routing, clustering. |
| 1.4 | Reasoning models | What test-time compute is, the effort and budget knobs across providers, why you pay for hidden thinking tokens, and when reasoning earns its cost. |
| 1.5 | The cost-quality-latency triangle | The book's recurring mental model: cost, quality, and latency are three axes you can't max at once. Name the one you sacrifice, then learn the levers that cheat it. |
| 1.6 | Just enough ML | The three ML ideas an AI engineer who never trains a model still needs: the data split, overfitting, and distribution shift, framed as eval decisions. |
Part 2 · Working with Model APIs
Level: Beginner to intermediate · For: Engineers wiring their first LLM feature into a real service.
Calling models reliably: streaming, structured outputs, tool calling, errors and fallbacks, model selection, gateways and routing, and prompt caching economics.
| # | Chapter | What it covers |
|---|---|---|
| 2.0 | Calling models | What happens when you POST a chat completion: messages, roles, the system prompt, and the three provider shapes you need to know side by side. |
| 2.1 | Streaming | How token-by-token streaming wins on perceived latency, why it breaks output validation, and the four ways to get both. |
| 2.2 | Structured outputs | Why schema-enforced JSON, not free text, is the contract between an LLM and the code that consumes its output, and how to wire it up with Pydantic. |
| 2.3 | Function and tool calling | The model proposes a tool call, you execute it, the model continues: how to define tool schemas, run the loop, parallelize, and return errors the model can act on. |
| 2.4 | Errors, retries, fallbacks | How to handle the timeouts, rate limits, and overloaded responses every LLM API throws at you, with the right backoff, fallback, and idempotency rules. |
| 2.5 | Choosing models and reading benchmarks | Public leaderboards don't predict your product's quality. Shortlist by tier, test on your own eval set, decide. That's the whole workflow. |
| 2.6 | Gateways and routing | One API in front of many providers, cheap-then-expensive cascades, provider failover, and the rule for when a gateway earns its operational cost. |
| 2.7 | Prompt caching | The single biggest cost lever in API-native LLM products. A 50k-token agent over 10 turns drops from $1.53 to $0.47 with one config change. |
Part 3 · Prompt Engineering
Level: Beginner to intermediate · For: Anyone who owns a production prompt.
Production prompts: anatomy, few-shot, chain-of-thought and the reasoning-model inversion, templates and chaining, and prompt versioning with rollback.
| # | Chapter | What it covers |
|---|---|---|
| 3.0 | Anatomy of a production prompt | The five sections every production system prompt has, why monolithic god-prompts fail, and how to wire defensive instructions against prompt injection. |
| 3.1 | Zero-shot and few-shot | When examples earn their tokens and when they don't. The decision rule, the over-prompting cliff, and how prompt caching rewrites the math. |
| 3.2 | Chain-of-thought, ReAct, self-consistency | The three techniques that survived the 2023 prompting literature, and the reasoning-model inversion that flips the rules: when to use each, and when to delete them. |
| 3.3 | Templates and chaining | Treating prompts as typed code, and the call you make every week: one big prompt or several small ones in a chain. |
| 3.4 | Prompt versioning | Treat a prompt change like a code change: registry, version pinning, rollback, and review, with a minimal setup you can build in a week. |
Part 4 · Eval Fundamentals
Level: Beginner · For: Everyone. If you read one part, read this one.
The minimum eval loop, taught before RAG and agents on purpose: look at your data, build your first eval set, and wire assertions into CI. Nothing after this part ships without evals.
| # | Chapter | What it covers |
|---|---|---|
| 4.0 | Why you can't ship without evals | The vibes-driven failure mode, evals as the AI engineer's CI, and the maturity ladder that gets you off the whack-a-mole loop. |
| 4.1 | Look at your data | The single highest-ROI habit in LLM evaluation: read your traces by hand and build a failure taxonomy before automating anything. |
| 4.2 | Your first eval set | Bootstrap a 50-example eval set in a week: real or realistic inputs, binary pass/fail labels, versioned in git, growing from production failures. |
| 4.3 | Assertions and unit tests for LLM output | The cheap, deterministic checks that should gate every LLM commit before any judge model runs: schema, contains, regex, code-runs, SQL-parses, wired into pytest and CI. |
Part 5 · Context Engineering
Level: Intermediate · For: Engineers whose prompts have grown into pipelines.
Building the full world the model sees: context assembly and routing, compression and budgets, memory and state, tool context, and testing what was actually assembled.
| # | Chapter | What it covers |
|---|---|---|
| 5.0 | Context is more than the prompt | The six things that go into a context window every turn, why prompt engineering only covers one of them, and what the discipline of context engineering actually owns. |
| 5.1 | Context assembly and routing | Why a 1M-token window doesn't make context free, and the route-then-assemble pipeline that decides what the model actually sees. |
| 5.2 | Compression and context budgets | More context isn't better context. How lost-in-the-middle and context rot degrade long prompts, and when to trim, summarize, or re-retrieve. |
| 5.3 | Memory and state | What an LLM remembers between turns, between sessions, and across years, and the techniques that make each scope work without crowding the context window. |
| 5.4 | Tool context and metadata | Models have no clock, no role awareness, and no sense of locale. The metadata you inject and the way you describe tools prevent whole classes of confidently wrong answers. |
| 5.5 | Testing and observing context | Snapshot the assembled context, regression-test the assembly logic, and capture traces that can answer why the model saw what it saw. |
Part 6 · Retrieval (RAG)
Level: Intermediate to advanced · For: Anyone building search or question answering over their own documents.
Retrieval done right: when you actually need RAG, chunking, vector and hybrid search, reranking, query understanding, citations, retrieval evaluation, and production indexing.
| # | Chapter | What it covers |
|---|---|---|
| 6.0 | When you actually need RAG | RAG vs long context vs fine-tune as a cost decision: long context pays per query, RAG pays once to index. The default rule, the exceptions, and when RAG is the wrong answer. |
| 6.1 | Document processing and chunking | How parsing and chunk boundaries set your retrieval ceiling, why overlap and chunk size are eval questions, and the defaults that survive contact with real corpora. |
| 6.2 | Embeddings and vector search | How to pick an embedding model on your own data, why pgvector is the default store, what HNSW and IVFFlat actually do, and the honest threshold where a dedicated vector DB earns its keep. |
| 6.3 | Hybrid search and reranking | Why BM25 still beats vector search on exact terms, how to fuse them with RRF, and when a reranker earns its latency. |
| 6.4 | Query understanding | Rewriting, multi-query, decomposition, and routing: closing the gap between what users type and what your retriever can match. |
| 6.5 | Citations and grounding | Make RAG answers verifiable: span-level citations, refusal on empty retrieval, and the faithfulness vs fluency tension that decides both. |
| 6.6 | Advanced retrieval | Three patterns that beat vanilla RAG on specific queries: agentic retrieval, GraphRAG, and vision-native PDF search. When each earns its complexity, and when it doesn't. |
| 6.7 | Evaluating retrieval | RAG eval is mostly retrieval eval. Recall@k and MRR in plain terms, building an eval set from real queries, and the 2x2 that separates retrieval failure from generation failure. |
| 6.8 | Production RAG | The five operational concerns that turn a RAG prototype into a system you can run: incremental indexing, the reindex tax, multi-tenant isolation, metadata filtering, and per-stage latency budgets. |
Part 7 · Agent Engineering
Level: Intermediate to advanced · For: Engineers deciding whether they need an agent, and building one when they do.
Workflows versus agents, tool design, MCP and its security model, memory, human-in-the-loop, long-running agents, multi-agent systems, agent archetypes, voice agents, and choosing a framework.
| # | Chapter | What it covers |
|---|---|---|
| 7.0 | Workflow vs agent | If you can write the control flow in Python, it's a workflow. If the model decides at runtime, it's an agent. Most production wins are workflows. |
| 7.1 | The five workflow patterns | Chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer: each with code, a use case, and the failure mode that bites in production. |
| 7.2 | The agent loop | Think, act, observe, and the part nobody talks about: how the loop ends. Stop conditions, reflection that actually works, and why production agents look nothing like the demo. |
| 7.3 | Tool design | The agent-engineering skill: schemas that make invalid calls impossible, descriptions the model can't misread, errors it can recover from, and the right number of tools. |
| 7.4 | MCP: Model Context Protocol | How to expose tools, data, and prompts to any AI host through one open protocol; build a server and client end-to-end. |
| 7.5 | MCP security | The four attack classes MCP creates: tool poisoning, cross-server shadowing, rug pulls, and injection via tool results, and the architectural defenses that actually stop them. |
| 7.6 | Agent memory and task state | The four places an agent can put information, why most teams use the wrong one, and how to design state that survives a pod restart mid-task. |
| 7.7 | Human-in-the-loop | Approval gates as tool calls, confidence-based escalation, and handoff design: the three independent things you have to engineer for selective human oversight to actually work. |
| 7.8 | Long-running agents | Budgets, kill switches, checkpoints, replay, and the sync vs async choice: the harness work that keeps a multi-minute agent from burning a month's API spend. |
| 7.9 | Multi-agent systems | When multi-agent topology earns its 15x token cost, when it doesn't, and the single-writer pattern that handles most production work. |
| 7.10 | Agent archetypes | Research, Coding, Browser, and Computer Use agents differ in one thing that cascades into everything else: what the model sees at each step. |
| 7.11 | Voice agents | The 800ms budget that defines voice agents, the cascaded vs native trade-off, and why barge-in is the hardest correctness problem in the stack. |
| 7.12 | Choosing a framework | Frameworks buy state, retries, and tracing. Most teams don't need them. The decision rule for plain SDK, light structure, and full graph runtime. |
Part 8 · Evaluation and Observability
Level: Intermediate · For: Teams past their first eval set who need evals they can trust in CI and production.
The deep spine: LLM-as-judge and its failure modes, component evals for RAG and agents, regression gates in CI, online evaluation, tracing, monitoring, and the data flywheel.
| # | Chapter | What it covers |
|---|---|---|
| 8.0 | The eval taxonomy | Four axes that decide which kind of evaluation answers your question: offline vs online, component vs end-to-end, reference-based vs reference-free, automatic vs judge vs human. |
| 8.1 | LLM-as-judge | Build a second-LLM judge you can trust: binary pass/fail over Likert, prompt patterns, and the human-agreement loop you must run before deploying it. |
| 8.2 | Judge failure modes | Position bias, length bias, self-preference, and style bias in LLM-as-judge pipelines, with the numbers and the mitigations that actually work in production. |
| 8.3 | Evaluating RAG and agents | Component evals, tool-choice accuracy, trajectory evaluation, and the weakest-link pattern that tells you which piece of a compound system to fix. |
| 8.4 | Regression suites and CI gates | Wiring evals into CI as a real merge gate: two-tier golden sets, differential thresholds over absolute floors, and how to keep flaky probabilistic tests trustworthy. |
| 8.5 | Online evaluation and A/B testing | Why your offline eval lied about a 3-point lift, the implicit signals that don't, and the sample sizes LLM A/B tests actually need. |
| 8.6 | Tracing | Spans for LLM calls, retrieval, and agent loops; the gen_ai.* OpenTelemetry conventions; why vendor-proprietary tracing locks you in. |
| 8.7 | Monitoring and dashboards | Why LLM systems need cost, latency, quality, and usage on one screen; how to alert on quality regressions and cost spikes; and which observability platform to pick in 2026. |
| 8.8 | Feedback & the data flywheel | How production traffic compounds into better evals and a better product, instead of becoming a treadmill of sprint-by-sprint bug fixes. |
Part 9 · Security and Governance
Level: Intermediate to advanced · For: Anyone shipping an LLM feature that touches user data or tools.
Prompt injection, the lethal trifecta and agent security, guardrails, abuse prevention, PII and privacy, compliance, and red-teaming your own system.
| # | Chapter | What it covers |
|---|---|---|
| 9.0 | Prompt injection | Why prompt injection has no general fix, the difference between direct and indirect attacks, and the defense-in-depth posture you ship with. |
| 9.1 | Agent security and the lethal trifecta | The three-leg threat model for agentic exfiltration, why all three together is game-over, and how to cut at least one leg before you ship. |
| 9.2 | Guardrails | Input filters, output validators, content moderation models, and the streaming-versus-validation problem nobody warns you about. |
| 9.3 | Abuse prevention | Rate limits, spend caps, per-tenant budgets, and the behavioral signals that catch automated abuse before it shows up on the bill. |
| 9.4 | PII and privacy | Detect and redact before the model call, navigate the controller-processor-subprocessor chain, and pick the right retention and residency knobs. |
| 9.5 | Compliance and audit | What engineers actually build for SOC 2 and the EU AI Act: structured audit trails, tamper-evident retention, and the model documentation regulators look for. |
| 9.6 | Red-teaming | Automated probe suites, manual protocols, and continuous red-teaming in CI: how to attack your own AI system before someone else does. |
Part 10 · Production AI
Level: Intermediate · For: Engineers who own an AI feature's bill, latency, and on-call.
Operating AI in production: hosted versus self-hosted, the customization menu, cost and latency engineering, eval-gated rollouts, SLOs, incident response, and AI infrastructure patterns.
| # | Chapter | What it covers |
|---|---|---|
| 10.0 | Hosted vs self-hosted | The four-line TCO model that decides when self-hosting beats per-token billing, why GPU utilization is the silent multiplier, and the 'start hosted, migrate the hot path' default for 2026. |
| 10.1 | Self-hosting essentials | What you actually need to know to run an open-weight model competently: vLLM as the default server, KV cache as the resource constraint, continuous batching, and how to size GPUs before you spend. |
| 10.2 | The customization menu | Fine-tuning, LoRA, and distillation as decisions, not techniques: when each is the right answer, what it costs, and the contamination trap that makes broken systems look healthy. |
| 10.3 | Cost engineering | Five orthogonal levers (caching, batching, routing, quantization, distillation) that compound multiplicatively to cut a five-figure monthly bill by ~80% without changing model quality. |
| 10.4 | Latency engineering | Why LLM latency isn't a single number: the waterfall, TTFT vs total time, parallel tool calls, prefix caching, and the perceived-latency tricks that close the gap UX-side. |
| 10.5 | Shipping changes | Prompt and model changes are deployments. Eval-gated promotion, shadow traffic, canary rollout, and instant rollback as the discipline that turns 'just edit the prompt' into safe production change. |
| 10.6 | SLOs and incident response | AI failures return HTTP 200 with garbage. The four AI incident classes (quality regression, injection exploit, cost runaway, hallucination at scale), the semantic SLIs that detect them, and the runbooks that contain them. |
| 10.7 | AI infrastructure patterns | The four AI-specific infrastructure components: vector stores in production, semantic caching, durable agent job queues, and embedding pipelines. Everything generic cross-links to HLD. |
Part 11 · AI Product Engineering
Level: Intermediate to advanced · For: Engineers and PMs deciding what an AI feature should do and whether it's working.
AI UX, failure recovery, product metrics beyond accuracy, experimentation, cost modeling and pricing, and feedback loops that compound.
| # | Chapter | What it covers |
|---|---|---|
| 11.0 | AI UX | Streaming as a trust signal, not a transport detail. The three failure modes (blank screen, mid-stream stall, unverifiable claim) and what to build for each. |
| 11.1 | Failure recovery UX | AI failures aren't edge cases. Designing the fallback cascade, retry affordances, and human handoffs so the failure you can't prevent doesn't destroy trust. |
| 11.2 | AI product metrics | Beyond accuracy. Task success, deflection vs. containment vs. resolution, escalation as a quality signal, time-to-completion, and AI-feature retention. |
| 11.3 | Experimentation | A/B testing AI features when variance is 2-5x higher than deterministic features, the treatment can drift mid-experiment, and 'no significant effect' usually means underpowered. |
| 11.4 | Cost modeling and pricing | Why marginal cost matters again. Cost-per-task (not per-token), the four pricing architectures, and the math that says when a feature is too expensive to ship. |
| 11.5 | Feedback and growth loops | Most teams have a log file, not a flywheel. The three preconditions for a working data loop, and why the loop itself (not the data) is the durable advantage. |
Study plans
You don't need a plan. Open any chapter and start reading. These routes help when you have a deadline or a specific gap to fill.
| Plan | For | Length |
|---|---|---|
| Interview prep: SDE1 to SDE2 | Passing a mid-level system design round | 6 weeks |
| Deep dive: SDE2 to Senior | Designing and owning cross-team architecture | 3 months |
| AI Engineering track | Shipping AI features on model APIs | 6 weeks |
| AI systems design track | Designing AI systems at scale | 4 weeks |
| Interview triage | A system design loop on Monday | 1 weekend |
| The full curriculum | Staff+ preparation | Months |
Interview prep: SDE1 to SDE2 — 6 weeks
Goal: pass a 45–60 minute system design round at mid-to-senior level. Plan on 8–10 hours of reading a week.
| Week | Focus | Read |
|---|---|---|
| 1 | Foundations | HLD Part 0 and Part 1 |
| 2 | Building blocks I | HLD Part 2, first half: load balancers, proxies, CDNs, caching, SQL, NoSQL, partitioning, replication |
| 3 | Building blocks II | HLD Part 2, second half: queues, pub/sub, real-time, rate limiting, service mesh, blob storage, geo, edge |
| 4 | Core case studies | The core primitives case studies: URL shortener, rate limiter, chat, news feed, web crawler, autocomplete |
| 5 | Your target company | More case studies, chosen with Company-specific flavors |
| 6 | Interview mechanics | HLD Part 11 and the Trade-offs Library |
Running the coding round too? Read DSA Parts 0 to 9 alongside.
Deep dive: SDE2 to Senior — 3 months
Goal: design at Senior level, own cross-team architecture, and pass Senior+ loops.
| Phase | Focus | Read | Time |
|---|---|---|---|
| 1 | Foundations and building blocks | HLD Parts 0, 1 and 2 | 3 weeks |
| 2 | Distributed theory, data, architecture | HLD Parts 3, 4 and 5 | 4 weeks |
| 3 | Every case study | HLD Part 8 | 4 weeks |
| 4 | Reliability, security, AI, interview | HLD Parts 6, 7, 9, 10 and 11, and the Trade-offs Library | 2 weeks |
AI Engineering track — 6 weeks
Goal: ship AI features that are reliable, measurable, secure and affordable. Plan on 4–5 hours of reading a week, plus time to run the snippets.
| Week | Focus | Read |
|---|---|---|
| 1 | Mental model and model behavior | Part 0 and Part 1 |
| 2 | APIs and prompts | Part 2 and Part 3 |
| 3 | Evals and context | Part 4 and Part 5 |
| 4 | Retrieval | Part 6 |
| 5 | Agents | Part 7 |
| 6 | Running it in production | Parts 8, 9, 10 and 11. Skim now, and come back as each problem shows up. |
AI systems design track — 4 weeks
Goal: design AI systems on the whiteboard. Assumes you know the HLD fundamentals.
| Week | Focus | Read |
|---|---|---|
| 1 | LLM serving and RAG | The first chapters of HLD Part 9: LLM serving, RAG pipelines, vector search |
| 2 | Agents and evaluation | HLD Part 9: agent architectures, multi-agent orchestration, LLM evaluation, LLMOps |
| 3 | AI case studies | The AI systems case studies: ChatGPT, enterprise RAG, coding agent, AI search, voice assistant, moderation, semantic cache, model router |
| 4 | ML fundamentals | The rest of HLD Part 9, and the Recommendation system case study |
Pair it with the AI Engineering track when you also build the system.
Interview triage — one weekend
A system design loop on Monday:
| When | Read |
|---|---|
| Saturday morning | How to approach a design question, Back-of-the-envelope estimation, Requirements scoping, Diagramming skills |
| Saturday afternoon | Three case studies in your domain |
| Sunday morning | Three more case studies, and Trade-off articulation |
| Sunday evening | Company-specific flavors for your target company |
The full curriculum — Staff+ preparation
Read each book front to back, in order. A chapter a day is a sustainable pace, and it leaves room to re-read the hard ones. HLD chapters end with an exercise and flashcards, so use them for active recall.
How the books are written
The writing rules. Every book follows the style guide:
- Teach the reasoning, not just the facts. A reader should come away knowing how to decide.
- Pick a recommendation and justify it. "It depends" must say what it depends on.
- Be concrete. A measured number with a source beats "very fast".
- Be honest about difficulty. Say when something is hard, and why.
- Write plainly: short sentences, one idea per paragraph, jargon defined the first time it appears.
The automated checks. Every pull request runs these in CI (content-ci.yml):
| Check | What it catches |
|---|---|
| markdownlint | Broken Markdown structure and style |
| typos | Spelling mistakes, with an allowlist for technical terms |
| Citation integrity | Footnotes that are used but never defined, or defined but never used |
| Frontmatter validation | Missing or malformed chapter metadata, per book |
| Mermaid validation | Diagrams that would fail to render |
| Vale | Passive voice, weasel words and banned phrases |
| lychee | Dead links, so citations keep working |
The human review. Beyond the checks, reviewers look for consistent terminology, a difficulty level that matches the chapter's audience, diagrams that are captioned and accessible, and citations that point to primary sources.
Contributing
Contributions of every size are welcome, from a typo to a full chapter. Read CONTRIBUTING.md for the full workflow.
Ways to help
| Time | What you can do | Open an issue first? |
|---|---|---|
| 5 minutes | Fix a typo or a dead link | No |
| 15 minutes | Add a missing citation, or update an out-of-date number with its source | No |
| 30 minutes | Clarify a confusing paragraph, or add a real-world example | No |
| An hour | Add a diagram to an existing chapter | Optional |
| A few hours | Review a chapter for technical accuracy | Yes |
| A weekend | Write a new chapter | Yes |
| Ongoing | Translate chapters into your language | Yes |
How to contribute
- Read the style guide. It covers voice, structure, diagrams and citations, and how each book's chapters differ.
- Open an issue first for anything over half an hour of work, so nobody duplicates effort. Use the issue templates.
- Fork, branch and edit. Use a descriptive branch name, such as
fix/raft-quorum-mathoradd/mcp-security-chapter. - Run the checks with
npm run check:all, or let CI run them on your pull request. - Open a pull request using the PR template. A one-line description is fine for small fixes. For a new chapter, describe your approach and list your sources.
- Respond to review. A maintainer reviews the pull request and may ask for changes.
What makes a great contribution
- Correct. Cite the primary source for every number and every claimed property.
- Clear. Write for the difficulty level in the chapter's frontmatter.
- Argued. If you think a chapter should recommend something else, make the case with sources.
- Well structured. Match the chapter shape of the book you're editing.
Reviewers wanted. If you've operated a system covered in the case studies, such as payments, chat, feeds or video, your review is worth more than a month of solo research. Open an issue with your area of expertise.
Repository structure
engineering-handbook/
├── content/ The three books (CC BY-SA 4.0)
│ ├── hld/ HLD Handbook
│ │ ├── part-0-prerequisites/ … part-11-interview-framework/
│ │ └── trade-offs/ Trade-offs Library
│ ├── dsa/ DSA Handbook
│ │ ├── part-0-foundations/ … part-14-interview-framework/
│ │ │ └── <chapter>/lc-NNN/ sol.py, and for most problems sol.java · sol.cpp · sol.go
│ │ ├── patterns/ Pattern decision pages
│ │ ├── editorials/ Long-form editorials
│ │ ├── widgets/ Interactive widget specs (YAML)
│ │ ├── _problem-registry.yml Every LeetCode problem the book uses
│ │ └── _widget-registry.yml Every widget
│ └── ai-eng/ AI Engineering Handbook
│ ├── README.md How to read the book
│ └── part-0-start-here/ … part-11-ai-product/
│ └── images/ Chapter figures
├── writing-guides/ Templates for case studies and trade-off pages
├── scripts/ The content checks CI runs
├── .github/ CI workflows, issue and PR templates, CODEOWNERS
├── STYLE_GUIDE.md How we write
├── CONTRIBUTING.md How to contribute
├── CODE_OF_CONDUCT.md Contributor Covenant
├── SECURITY.md How to report a security issue
├── CITATION.cff Citation metadata
└── LICENSE CC BY-SA 4.0
Development setup
You don't need to install anything to contribute. Edit Markdown, open a pull request, and CI checks it. To run the checks locally first:
You'll need Node.js 20+ (the .nvmrc file pins the version) and npm. typos, lychee and Vale are optional.
git clone https://github.com/handbook-academy/engineering-handbook.git
cd engineering-handbook
nvm use # the Node version from .nvmrc
npm install # markdownlint, Mermaid and the other check tools
npm run check:all # everything CI runs
npm run lint # Markdown style
npm run check:frontmatter # chapter metadata
npm run check:citations # footnotes are defined and used
npm run check:mermaid # diagrams parse
npm run check:typos # spelling
npm run check:links # dead links (slow)
npm run prose # Vale prose style (needs Vale)
Editing in the browser. Markdownlab (source) is a Markdown editor with live preview, Mermaid rendering and the same callouts and footnotes these books use. Put https://markdownlab.vercel.app/ in front of any chapter's GitHub URL to open it there:
https://markdownlab.vercel.app/https://github.com/handbook-academy/engineering-handbook/blob/main/content/hld/part-1-core-fundamentals/00-scalability.md
The repo also ships .editorconfig, .markdownlint.json, .vale.ini and .typos.toml, so most editors pick up the project settings on their own.
FAQ
Is it really free?
Yes. Every chapter in this repository is free to read for anyone, always, on GitHub and at handbook.academy, with no sign-in needed.
The license guarantees it. Everything here is CC BY-SA 4.0, so anyone can copy, share and adapt the text, as long as adaptations keep the same license. Nobody, including us, can take it back or make it exclusive.
How are decisions made?
The project is led by its founder and maintainer, @invincible04, who decides what the books cover and gives the final approval on every change.
The books are researched, drafted and reviewed with the help of the most capable AI models available today. They're used for the heavy lifting: gathering sources, drafting and redrafting chapters, checking claims against the cited sources, and reviewing for accuracy and clarity. They don't have the final say. @invincible04 decides what ships, and anything the sources don't support is rewritten or cut.
How each kind of change is decided:
- Typos, dead links and factual corrections: any maintainer can merge them.
- A new chapter or a major rewrite: needs an issue explaining the idea, and maintainer approval.
- A change to the curriculum (a new, renamed or reordered part): needs a Discussion that stays open for at least a week before merging.
- The license: CC BY-SA 4.0 is a permanent commitment, and changing it would need every contributor's consent.
People who contribute well over several months may be invited to become maintainers, with merge rights in their area and a vote on curriculum decisions. CODEOWNERS shows who reviews what.
Can I use it to build a paid course?
Yes. CC BY-SA 4.0 allows commercial use, as long as you:
- Credit the original: "Adapted from The Engineering Handbook, CC BY-SA 4.0, https://github.com/handbook-academy/engineering-handbook".
- License your version under the same CC BY-SA 4.0 terms.
- Say what you changed.
You can teach courses, run bootcamps, make videos or publish books based on this content. You can't remove the credit or relicense the text as proprietary.
Can I translate it?
Please do. Open an issue saying which language and which chapters you'll start with. Translations can live in parallel folders in this repo, such as content-hi/ for Hindi, or in a linked sister repo.
How is the HLD book different from system-design-primer or Alex Xu's books?
system-design-primer is a great index of other people's articles and talks. The HLD Handbook teaches every topic on the page instead, so the two work well together: the primer for breadth of resources, this book for depth.
Alex Xu's System Design Interview books are excellent, and the case studies here cite them often. The HLD Handbook adds the foundational chapters behind the case studies, covers newer topics (LLMs, RAG, agents, CRDTs, post-quantum crypto, MCP), is free, and takes pull requests.
How is the DSA book different from NeetCode, LeetCode editorials or Cracking the Coding Interview?
- Organized by pattern, not by problem. Each chapter teaches a structure or pattern, and the LeetCode problems are worked examples inside it.
- Four languages side by side. Read the chapter in Python, then open the Java, C++ or Go solution for your interview language.
- Decision pages. When two approaches both fit, a pattern decision page tells you which to reach for first.
- Step-through animations. Key chapters come with widget specs that animate the algorithm.
- Open. It's free and takes pull requests.
How does the AI Engineering book relate to HLD Part 9 and to other AI books?
HLD Part 9 answers "how would I design this AI system at scale?". The AI Engineering Handbook answers "how do I build and operate it?": the prompt, the eval set, the retrieval pipeline, the agent loop, the trace, the bill. The two books link to each other.
Chip Huyen's AI Engineering is the field's most complete reference, and the book cites it. The AI Engineering Handbook is free, takes pull requests so a stale price or a renamed API parameter can be fixed quickly, picks defaults (a workflow before an agent, pgvector before a dedicated vector database), and teaches evals before RAG and agents.
Is GitHub the same content as the websites?
Yes. The websites publish the same text as this repository.
Why isn't there an "awesome list" of external resources?
Sources are cited inline where they matter. A separate list would repeat that work and go stale faster. If a resource is worth reading, a chapter cites it.
I want to write a chapter on a new topic. How?
Open an issue with the writing template covering:
- Which book and part the chapter belongs in.
- Why it belongs: what's missing, or what's new.
- A one- or two-paragraph outline.
- Your primary sources.
A maintainer replies with feedback on scope. Once it's approved, fork, draft and open a pull request. Case studies use writing-guides/case-study-template.md, trade-off pages use writing-guides/trade-off-template.md, and every other chapter follows the style guide.
License
Everything in this repository (the three books, the writing guides, the style guide, the check scripts, the templates and the configuration) is licensed under Creative Commons Attribution-ShareAlike 4.0 International.
| You can | You must |
|---|---|
| Read, share, print and screenshot it, forever | Credit the original, with a link to this repo |
| Build courses, bootcamps, videos or books on it | Release your version under the same CC BY-SA 4.0 license |
| Translate it into any language | Not relicense it as proprietary or add restrictions |
| Use it commercially |
Because anyone can copy and share it, nobody can take the text back or make it exclusive. Every chapter is free to read for anyone, always, on GitHub and at handbook.academy, with no sign-in needed.
Citation
If you reference this project in a paper, post, book or course:
@misc{engineering-handbook,
author = {Soni, Aayush},
title = {The Engineering Handbook: Open-Source Engineering Curricula (HLD + DSA + AI Engineering)},
year = {2026},
publisher = {GitHub},
url = {https://github.com/handbook-academy/engineering-handbook},
note = {CC BY-SA 4.0}
}
"The Engineering Handbook (HLD + DSA + AI Engineering)" by Aayush Soni, https://github.com/handbook-academy/engineering-handbook, CC BY-SA 4.0.
GitHub's Cite this repository button, Zenodo, Zotero and other reference managers read CITATION.cff directly.
Acknowledgments
These books stand on the work of many people, and the chapters cite them throughout. The ones that shaped the books most:
System design
- Martin Kleppmann: Designing Data-Intensive Applications underpins the distributed systems and data parts.
- Alex Xu: the System Design Interview books defined the interview case-study format the HLD case studies build on.
- Chip Huyen: Designing Machine Learning Systems shapes HLD Part 9.
- Betsy Beyer et al. (Google): Site Reliability Engineering and The Site Reliability Workbook are behind the reliability part.
- Mark Richards and Neal Ford: Fundamentals of Software Architecture and Software Architecture: The Hard Parts inform the architecture patterns.
Data structures and algorithms
- Cormen, Leiserson, Rivest and Stein: Introduction to Algorithms for proofs and complexity arguments.
- Robert Sedgewick and Kevin Wayne: Algorithms for how the data structures are explained.
- Jon Bentley: Programming Pearls, the spirit behind the prompt cards.
- Steven and Felix Halim: Competitive Programming for contest techniques.
- Aziz, Lee and Prakash: Elements of Programming Interviews, and Gayle Laakmann McDowell: Cracking the Coding Interview, for setting the bar on interview explanations.
- NeetCode and the LeetCode community for the practice ladder and the problem set.
AI engineering
- Chip Huyen: AI Engineering frames the line between AI engineering and ML engineering.
- Shawn Wang (swyx): "The Rise of the AI Engineer" named the role and drew the API line the book is organized around.
- Hamel Husain and Shreya Shankar: their writing on evals and error analysis shapes the eval parts.
- Simon Willison: his work on prompt injection and the "lethal trifecta" underpins the security part.
- Anthropic: "Building effective agents" is the source of the workflow-versus-agent split.
Everyone else
- system-design-primer by Donne Martin, the Kubernetes, CNCF and OpenTelemetry communities, and the Apache projects.
- The authors of SIGMOD, VLDB, OSDI, SOSP and NSDI papers, and the IETF, W3C and IANA standards.
- Every engineer who has written a public postmortem. Real outages taught us the most about graceful degradation, blast radius and the limits of testing.
We teach these ideas in our own words, with our own diagrams, and cite the originals.
Community
- GitHub Discussions: questions, feedback and ideas
- GitHub Issues: corrections, chapter requests and proposals
- Email [email protected]: private or sensitive matters, including code of conduct and licensing questions
- Security advisories: security issues in the scripts or CI (policy)
- Maintainer: @invincible04
If the books help you, star the repo. Stars help new readers and contributors find the project.
Start reading
HLD: Networking fundamentals · Scalability · URL shortener · Trade-offs Library
DSA: Arrays · Two pointers · Sliding window · Pattern decision pages
AI Engineering: What an AI engineer is · The escalation ladder · Your first eval set · Workflow vs agent
Licensed CC BY-SA 4.0 · handbook.academy
Explore projetos relacionados
Carregando…