Skip to content

What is This?

Battle-Tested Patterns collects programming patterns that are:

  1. Production-proven — used in top-tier projects like React, Linux kernel, Go runtime, and Chromium
  2. Interactive — every pattern has a hands-on SVG visualization you can click, drag, and experiment with
  3. Cross-language — idiomatic implementations in TypeScript, Rust, Go, and Python
  4. Code-level — concrete techniques you can apply today, not abstract architecture concepts

Why This Exists

There are plenty of "design patterns" books and "algorithms" repositories. But there's a gap:

Existing ResourcesWhat They Miss
Design Patterns (GoF)Too abstract, too OOP-centric
Algorithm repositoriesDisconnected from engineering practice
System Design guidesArchitecture-level, not code-level
"Awesome" listsLink collections, no teaching
Interactive tutorialsUsually one-off, not a systematic collection

This project fills the gap: code-level techniques extracted from production source code, with interactive visualizations and precise references you can verify yourself.

What Makes a Pattern "Battle-Tested"?

Every pattern in this collection must have:

  • ≥ 2 production proofs — precise GitHub links (to exact line numbers) showing the pattern in use
  • Multi-language implementations — idiomatic code in TypeScript + at least one other language
  • Runnable exercises — progressive difficulty levels with test suites

We never fabricate source links. If we can't find a verifiable reference, we don't include the pattern.

Pick a path based on your background — or just browse freely.

Frontend Developer

Start with patterns you already use (possibly without realizing it):

  1. Diff / Patch — React's virtual DOM reconciliation
  2. Bitmask — React fiber flags
  3. Cooperative Scheduling — why React yields every 5ms
  4. Observer — Redux, EventEmitter
  5. Double Buffering — React Fiber's current / workInProgress

Then see them compose: Patterns from React · Quick reference: Cheat Sheet

Backend / Systems Developer

Start with patterns that appear in databases and distributed systems:

  1. Write-Ahead Log — crash recovery in PostgreSQL, etcd
  2. MVCC — how readers never block writers
  3. Circuit Breaker — fail fast in microservices
  4. Rate Limiter — token bucket for throughput control
  5. Consistent Hashing — distribute keys across nodes

Then see the full picture: Patterns from Distributed Systems · Quick reference: Cheat Sheet

Performance / Low-Level Engineer

Start with memory and concurrency patterns:

  1. Arena Allocator — bump allocate, free all at once
  2. Object Pool — avoid GC pressure
  3. Free List — O(1) alloc/free
  4. Work Stealing — Go runtime, Tokio scheduler
  5. Ring Buffer — lock-free queues

Then see how they compose: Patterns from Go Runtime · Patterns from Linux · Quick reference: Cheat Sheet

How to Use This

  • Play with visualizations — each pattern page has an interactive SVG visualization — click, drag, and build intuition
  • Browse patterns — read the concept, study the production proof, then try the exercises
  • Run exercises locallypnpm test:exercises for TypeScript, cargo test for Rust, go test for Go
  • Try it online — copy any code example into an official playground: TypeScript · Go · Rust · Python
  • Contribute — see How to Contribute

Released under the MIT License.