Build Your Own X From Scratch: Redis, Databases, Compilers, and Web Servers

⬅️ Back to Tutorials

🔧 Build Your Own X From Scratch by James Smith


There are a lot of “build your own X” tutorials on the internet. Most of them are shallow. They show you how to glue libraries together and call it a day.

James Smith’s books are not that.

Four projects, four languages, one philosophy: recreate real technology from the ground up, in small steps, and understand how it actually works.

Build Your Own Redis (C/C++)

Network programming. Data structures. Low-level C. The real Redis is a large codebase with years of accumulated detail. This book strips it to essentials and rebuilds it incrementally — socket handling, the event loop, the Redis protocol, data structures, persistence. Each chapter is small enough to digest in one sitting.

The full book and C++ code are free on the web. Buy the eBook or paperback if you want to support the work.

Build Your Own Database (Go)

Databases from the bottom up. Starts with a key-value store backed by a B-tree on disk, with crash recovery via fsync. Then builds a free list for space management, adds a relational layer on top of the KV store, implements a SQL-like query language with a parser and interpreter, and finishes with concurrent transactions using copy-on-write data structures.

Part I (basic KV store) is free. The full book covers B-trees, relational tables, indexes, and concurrency.

Build Your Own Compiler (Python)

From source code to machine code. Four stages: a simple interpreter to get your language running, a bytecode compiler (a virtual computer inside your real computer), x64 assembly and instruction encoding (learn the actual machine), and finally translating bytecode to x64 ELF binaries.

Part I on interpreters is free. The full book covers bytecode, assembly, and binary generation.

Build Your Own Web Server (Node.js)

Socket programming, the event loop, promises and async/await, HTTP semantics and syntax. Goes beyond coding exercises to cover backpressure, resource management, and the gap between toys and production systems. Includes a WebSocket extension and an introduction to concurrent programming.

Part I on basic HTTP servers is free.

Why These Books Are Different

James Smith is a working programmer who wrote the books he wanted to read. The prose is direct. The examples compile. The scope is deliberate — each book covers exactly enough to understand the core concept without getting lost in production complexity.

The “why” section on the site summarizes the philosophy well: project-based learning fills the gap between CS theory and practice. Master fundamentals because framework knowledge is devalued by AI. Prepare for technical, system-level work. And computers are fun because you can study, understand, and recreate almost any software.

If you have ever wanted to understand how Redis actually stores data, what a B-tree looks like in code, how your compiler turns source into machine instructions, or what happens inside an HTTP server — start here.

Crepi il lupo! 🐺