Build Your Own X From Scratch Books

Level up your coding skills. By recreating tech from scratch. With step-by-step guides.

Redis Database Compiler Interpreter Web Server

The What & Why of “Build Your Own X From Scratch”

Pick a tool or software that you know, and try to recreate it by coding it from scratch. “From scratch” means not just glueing components together, but taking the time to understand how stuff works.

Why take on challenges like this? The benefits?

  • You are a student who has just learned programming, but has no real project experience. A build-your-own-X project will exercise what you learned in school. Without such practice, people will quickly forget what they learned and build suboptimal solutions in their future careers. It is also a nice thing to put on your resume.
  • You are a working software developer who seeks to level up your skills, but you are not sure what to focus on. A “From scratch” project will grant you the understanding of how things actually work. This kind of knowledge lasts much longer than “how to do X in framework/language Y”, which is becoming increasingly devalued as AI advances.
  • You are a hobbyist who likes to code. You probably also like learning how stuff works. Projects like this are very flexible, you can explore whatever topics interest you, or extend the project by adding bells and whistles.
  • With the advances in AI tools, producing code is not the problem; making the code work is! The people who excel at software development will be the people who excel at debugging, i.e. the people who understand how things work in detail. This may be your chance to survive and thrive in the AI revolution.

Build Your Own Redis with C/C++

Network programming, data structures and low-level C/C++.

  • Why build Redis? Data structures and systems programming are what application developers lack. Redis is a perfect medium to acquire the knowledge & experience.
  • Start from scratch? A quote from Feynman: “What I cannot create, I do not understand”. Learn by doing instead of reading.
  • Why C? C was, is, and will be widely used for infrastructure or low-level software. Learn C today instead of chasing fads, and you'll appreciate it in the future.
  • Why a book? The real Redis is a large code base with lots of details. We'll only touch on the essentials via small steps.
  • Free-to-read web version and C++ sources.
  • PDF/EPUB and paperback Editions.
  • Get notified of the 2nd edition (WIP).

Build Your Own Database From Scratch

Learn databases from the bottom up by coding your own, in small steps, and with simple Go code (language agnostic).

  • Atomicity & durability. A DB is more than files!
    • Persist data with fsync.
    • Crash recovery.
  • KV store based on B-tree.
    • Disk-based data structures.
    • Space management with a free list.
  • Relational DB on top of KV.
    • Learn how tables and indexes are related to B-trees.
    • SQL-like query language; parser & interpreter.
  • Concurrent transactions with copy-on-write data structures.
  • Free-to-read part I on basic KV.
  • PDF/EPUB and paperback Editions.
  • Get notified of the 2nd edition (planned).

From Source Code To Machine Code

Build a compiler to learn how programming languages work. Use low-level assembly to learn how computers work.

Walks through a minimal yet complete compiler. Compiles a static-typed language into x64 ELF executables.

Step by step Python code (language agnostic):

  1. Simple interpreter. Get your own language up and running.
  2. Bytecode compiler. Virtual computer within real computer.
  3. x64 assembly & instruction encoding. Learn the real machine.
  4. Translate bytecode to x64 code. Bridge virtual and real.
  5. Generate binary executables. Put it all together.
  • Free-to-read interpreter chapters.
  • PDF/EPUB and paperback Editions.
  • Get notified of my future books.

Build Your Own Web Server From Scratch In Node.JS

Learn network programming and HTTP by coding a web server.

  • Network programming.
    • Socket API and the event loop in Node.JS.
    • Protocol design and implementation.
    • Promises and async/await.
  • HTTP in detail. Semantics and syntax.
  • Beyond coding exercises.
    • Discusses the gap between toys and production.
    • Overlooked tech, backpressure, resource management, etc.
  • WebSocket extension.
    • Message-based protocol; another paradigm.
    • Introduction to concurrent programming.
  • Free-to-read part I on basic HTTP server.
  • PDF/EPUB and paperback Editions.
  • Get notified of my future books.
Reddit
Telegram