Skip to main content
Build-your-own-X series

Build your own Redis in 6 languages

Six standalone free courses. Each rebuilds Redis from scratch in idiomatic Python, Go, Node.js, Rust, Ruby, or Elixir. Same architecture, different runtimes. Every line lives in your own GitHub.

Ten modules, same shape, six languages

Each course follows the same ten-step architectural progression. The architectural lessons (RESP framing, atomic writes, fan-out, graceful lifecycle) transfer 1:1 across runtimes. The idioms differ.

Module 01

TCP echo

One listener, one task per connection. Multi-client from day one.

Module 02

RESP parser

Wire format with the language's native sum-type story.

Module 03

GET / SET

Shared map plus the language's idiomatic concurrency primitive.

Module 04

Expiry

Time-based TTLs with lazy delete. Monotonic clocks where available.

Module 05

AOF persistence

Append-only log with crash-safe replay.

Module 06

RDB snapshots

Atomic file rename. Clone-under-lock instead of fork.

Module 07

Pub/Sub

Fan-out via channels, queues, broadcast, or Registry.

Module 08

Replication

Master and replica over the same RESP wire your clients speak.

Module 09

Graceful shutdown

Signal handlers, drain in-flight work, persist before exit.

Module 10

Capstone benchmark

p50/p95/p99 latency comparison vs real Redis.

Taught by Param. Every line ends up in your own GitHub. Same architecture across all six runtimes, verified against real Redis on p50, p95, and p99 latency.

Pick your language

Each course is free, self-contained, and ships with a public workshop repo on GitHub. Start with the one you know; finish with one you do not.

Python

Build your own Redis in Python

Reference language. Threads, selectors, dict + lock, dataclasses for the RESP sum type.

Idiom: Threads + selectors

Go

Build your own Redis in Go

Goroutines, sync.RWMutex, channel-based pub/sub, context.Context graceful shutdown.

Idiom: Goroutines + channels

Node.js

Build your own Redis in Node.js

Single-threaded event loop. net.createServer, Buffer cursor, Map without locks.

Idiom: Event loop + Map

Rust

Build your own Redis in Rust

Async tokio, enum sum types, Arc<Mutex<HashMap>>, broadcast channels, watch shutdown.

Idiom: tokio tasks + enum

Ruby

Build your own Redis in Ruby

TCPServer + Thread per conn, Queue + write-pump for pub/sub, Signal.trap shutdown.

Idiom: Threads + Queue

Elixir

Build your own Redis in Elixir

Process per conn, binary pattern matching, Registry pub/sub, OTP terminate/2 shutdown.

Idiom: Process + Registry

How the languages compare

Same architecture across all six. The constant factors differ. Real Redis (hand-tuned C) is the throughput target; each language closes a different fraction of the gap with idiomatic code.

ConceptPythonGoNodeRustRubyElixir
ConcurrencyThreads / selectorsGoroutinesEvent looptokio tasksThreads / FibersProcesses
Shared statedict + lockRWMutexMap (no lock)Arc<Mutex<..>>Hash + MutexGenServer state
Pub/Sub fan-outList + lockBuffered chanSet<conn>broadcast channelQueue per subRegistry + send/2
Sum typeduck typinginterface{}discriminated objectsenumtagged arraytagged tuple
Typical throughput10-50k ops/s40-100k20-60k50-150k10-30k30-100k

Questions before you start

Are these courses really free?
Yes. All six are standalone free courses. No upsell, no paywall on later modules. The capstone benchmark vs real Redis is in the free tier of every course.
Do I need to take them in order?
No. Each course is self-contained. Start with the language you know best to see how the architecture lands in familiar syntax, then pick a contrast language (e.g., Python first, then Elixir) to feel the differences.
How long does each course take?
About 8 to 9 hours of focused work per language. The Python course is the longest because it is the reference and we spend more time on the architecture explanation; the others are tighter because they assume the architectural concepts from the README.
What if I find a bug?
Every workshop repo is on GitHub. Open an issue or a pull request. Each course also has 4 exercises per module that intentionally surface different real-world hardening problems (fsync, partial writes, backpressure, etc.).