Build your own Redis
An in-memory key-value server that speaks the Redis protocol, so redis-cli can talk to it, with key expiry and persistence.
- Intermediate
- About 15–30 h
- 5 checkpoints
- 4 tutorials · C++, Go, Python
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Redis combines a network protocol, an event loop, data structures and durability in one small server. Rebuilding it shows how a cache behaves under load, expiry and restarts.
You will be able to
- Parse and serialise the RESP protocol.
- Serve many clients with an event loop or async I/O.
- Implement key expiry and explain lazy versus active expiration.
- Persist data with an append-only file and recover after a crash.
Skills it exercises
Recommended on Backend Engineer and System Design.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
PING
Done when:
redis-cli -p 6380 PINGreturns PONG from your server. - Checkpoint 2Self-check
GET and SET under load
Done when: GET, SET and DEL work, and redis-benchmark with 50 parallel clients runs without errors.
- Checkpoint 3Self-check
Expiry
Done when:
SET k v PX 100disappears after 100 ms, both when it is read and when it is never read again. - Checkpoint 4Self-check
Persistence
Done when: After
kill -9and a restart, data written before the crash is restored from an append-only file. - Checkpoint 5Self-check
Data structures
Done when: LPUSH and LRANGE, or ZADD and ZRANGE, return the same results as real Redis for the same commands.
Stretch goals
- Replication to a second instance.
- Benchmark against real Redis and explain the difference.
Step-by-step guides
Pick one in a language you know (tutorial languages: C++, Go, Python, Rust). They open on the author’s site.
- C++
Build Your Own Redis from Scratch(external site)
C and C++ book: event loop, hash tables, sorted sets with AVL trees, and TTLs with a heap.
- Go
Build Your Own Redis from Scratch(external site)
Go: RESP parser, command handlers and AOF persistence.
- Rust
Build your own Redis client and server(external site)
Rust: the official Tokio tutorial builds a Redis client and server.
- Python
Write your own miniature Redis with Python(external site)
Python: a miniature version with gevent.
Where to go next
- Build your own Database
Advanced · 30–60 h
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.