Loading...
Loading...
Redis feels like a black box until you build a tiny version yourself. You start with a program that just listens on a port. By the end, the same program speaks the real Redis language, remembers data after a restart, and a backup machine quietly mirrors it. Pure standard library Node. No frameworks. No magic.
Engineers are learning here from
Build your own Redis in Node.js, one short .mjs file at a time. You will write a tiny server that listens on a port, then teach it the same language real Redis clients speak, then give it memory, then teach it to remember after a restart, then let many readers subscribe to one writer. By the end you will have a working stand-in for Redis you understand line by line. Node's single-threaded event loop replaces the threads and locks you would write in other languages, so the code stays small and easy to read.
Write your own Redis in Node.js, one short .mjs at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Pure standard library.
What you'll ship
What you'll learn
Curriculum
Network and protocol
net.createServer + Buffer-based RESP parser.
Store and expiry
Map + dispatch (no locks). Date.now TTLs with active sweep.
Durability: AOF and RDB in Node
fs.createWriteStream for AOF, fs.writeFile + fs.rename for RDB. Async fire-and-forget BGSAVE.
Messaging and replication
Map<channel, Set<conn>> pub/sub and SYNC + write streaming.
Scaling: Graceful shutdown and benchmark
process.on(SIGTERM) + server.close + drain loop. Then async worker-pool benchmark.
Who it's for
You write API handlers and middleware. You want a project that exercises net, fs, Buffer, async, and signal handling in one stack.
You know another language. You want to see how Node\u2019s single-threaded event-loop model compares on the same problem.
You only know Node through Express and frameworks. You want raw stdlib mastery.
FAQ
No. The workshop uses plain .mjs files. The exercises in step 2 walk through a TypeScript port if you want types.
Same architecture, different idioms. Node is single-threaded with an event loop; Python uses threads or selectors; Go uses goroutines. The course README compares all three.
No. Node typically lands between Python and Go for this kind of workload. Real Redis is hand-tuned C. The capstone step explains where the remaining gap comes from.
None. Pure stdlib. Just Node 20+ for the node: import scheme and parseArgs.
Write your own Redis in Node.js, one short .mjs at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Pure standard library.