Build your own Redis in Go, one short main.go at a time
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 Go. No frameworks. No magic.
Still deciding? Ask first.
Message a mentor about fit, prerequisites, or where to start. Replies come on WhatsApp, usually within a day.
- Curriculum fit, prerequisites, or where to start
- Honest answer, no pressure to enroll
Taught by an engineer who has shipped this
ISO 27001
Led the engineering work behind the certification of a regulated EU platform.
Series A platform
Architected the case-management product that became the business a €11.6M round was raised on.
3x faster deploys
Cut time-to-deploy by migrating to Kubernetes on GCP with deploy-on-merge.
Build your own Redis in Go, one short main.go at a time. You will write a small 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. The Go idioms (goroutines, channels, sync.RWMutex, context) replace Python's threads and selectors while keeping the same shape.
Write your own Redis in Go, one short main.go at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Pure standard library.
What you'll ship
Real projects, not toy demos.
- A TCP server using net.Listen + per-connection goroutines, multi-client from day one
- A RESP parser built on bufio.Reader with recursive array decoding
- A KV store with sync.RWMutex and a map[string]Handler dispatch table
- EXPIRE / TTL / PERSIST with time.Time TTLs and lazy delete
- AOF persistence with serialised appends and a crash-safe replay loop
- RDB snapshots using Snapshot-then-save (no fork) plus atomic rename
- SUBSCRIBE / UNSUBSCRIBE / PUBLISH using buffered channels and write-pump goroutines
- Master/replica replication via SYNC + write streaming over the same RESP wire
- Graceful shutdown with context.Context, signal.NotifyContext, and sync.WaitGroup drain
- A benchmark harness comparing your Go server against real Redis
What you'll learn
You finish able to:
- Build a concurrent TCP server with net.Listen and per-connection goroutines
- Parse the Redis wire format using bufio.Reader and a recursive decoder
- Coordinate shared state with sync.RWMutex versus sync.Map, knowing which to pick
- Snapshot in-memory state under a lock and save it from a goroutine (Go cannot fork)
- Design pub/sub fan-out using buffered channels with non-blocking select sends
- Stream replication writes to multiple replica sockets from one master
- Wire context.Context + signal.NotifyContext + sync.WaitGroup for graceful shutdown
Curriculum
From net.Listen to your own Redis.
- 013 lessons
Network and protocol
Open a TCP port with net.Listen, accept per-connection goroutines, parse RESP with bufio.Reader.
- 023 lessons
Store and expiry
sync.RWMutex around map[string]string, then time.Time TTLs with lazy delete.
- 033 lessons
Durability: AOF and RDB in Go
Append-only file with serialised writes, then RDB snapshots that copy-then-save because Go cannot fork.
- 043 lessons
Messaging and replication
Channel-based pub/sub and master/replica log shipping. Same shape as Python, channel idioms instead of locks.
- 053 lessons
Scaling: Graceful shutdown and benchmark
The Go-shaped equivalent of Python\u2019s event-loop step is graceful shutdown via context. Then measure your server.
Who it's for
Is this for you?
Go developers
You write Go every day. You want a project that exercises net, sync, bufio, context, and channels in one cohesive build.
Backend engineers exploring Go
You know another language. You want to see Go idioms in a system that actually has hard requirements (concurrency, persistence, networking).
Engineers building Redis clients
You wrote a Redis client and want to know what the server is doing on the other side of every wire byte.
FAQ
Common questions.
Do I need to know Redis internals already?
No. Each step starts from scratch and adds one architectural idea. By step 10 you understand the full shape.
How does it compare to the Python sibling course?
Same architecture, different idioms. Python uses threads, GIL-protected dicts, and selectors. Go uses goroutines, sync.RWMutex, and graceful shutdown. The course README compares the two side by side.
Will my Go server beat real Redis?
No, but it closes most of the gap. Real Redis is hand-tuned C. Our Go version typically lands 2-3x slower than real Redis, depending on workload. The capstone benchmark step explains where the remaining gap comes from.
Do I need Docker or any deps?
No. Pure standard library. Just Go 1.22+.
Pricing
Practice what you read with Pro.
Every lesson is free to read. Pro adds quizzes, flashcards, coding practice, certificates, notes and review on every course.
Unlock with Pro
Cancel anytime.
- Quizzes and practice for this course
- Practice, notes and certificates on every course
- New releases the day they ship
Still deciding?
Confidence comes from rebuilding it yourself.
Write your own Redis in Go, one short main.go at a time. Sockets, the wire language, the store, expiry, persistence, fan-out, and a backup machine. Pure standard library.