The Guide
241 chapters in four tracks. They read in this order, and the arrows at the foot of every page follow it, so you can start at the top and never choose again. Each track also stands on its own if you already know the language.
Start with Installation → or pick a reading path for where you are coming from.
Foundations
The language and the library it ships with. Start here.
- Getting StartedInstall a Zig master build, compile and run your first program, run tests, and catch up on what changed since the last tagged release.
- LanguageZig language chapters you can run: integers, floats, pointers, slices, optionals, error unions, structs, unions, enums, switch, loops, comptime and vectors.
- Standard LibraryZig std by example: allocators, ArrayList, hash maps, JSON, the Io interface, readers and writers, crypto, formatting and sorting.
- Data StructuresBuilding containers in Zig: a growable array and the doubling that makes append cheap, a linked list with an allocator you own, generic containers as comptime type functions, the intrusive lists std actually ships, a binary search tree, AVL rotations, and a hash map with open addressing.
- ConcurrencyConcurrency in Zig through std.Io: async and Future, Group, cancellation, Select, bounded queues, locks, atomics and memory ordering, OS threads, what happened to std.Thread, where the Io comes from, and a complete batch job runner putting it together.
Groundwork
What the machine is doing, from zero. No C and no prior systems work assumed.
- Systems from ScratchLearn what a systems programmer knows, starting from nothing: bytes and types, integer sizes and overflow, addresses, the stack, who owns memory, bounds and build modes, strings as bytes, struct layout and padding, errors as values, and the system call boundary. Every idea has one complete program you can run in the page.
Systems
Zig against the world outside the process: networks, builds, C, wasm, and pixels.
- Operating SystemTalking to the operating system from Zig: file descriptors, the standard streams, the environment, spawning a child process, pipes, signal handlers, and what exit does to your defers.
- NetworkingNetwork programming in Zig from the socket up: message framing, short reads, text and binary protocols, byte order, serving many clients through std.Io, TCP, UDP and HTTP.
- Build Systembuild.zig by example: build modes, cross-compilation, declaring dependencies in build.zig.zon, and generating documentation.
- Working with CCalling C from Zig and exposing Zig to C: translate-c, C pointer types, C primitive types, and the C ABI.
- WebAssemblyCompiling Zig to WebAssembly: freestanding modules, calling Zig from JavaScript, passing data across the boundary, loading wasm in the browser, and building a WASI command.
- GraphicsSoftware rendering and image processing in Zig with no graphics library: framebuffers, rasterizing lines, circles and triangles, alpha blending, antialiasing, brightness and contrast, gaussian blur, Sobel edges, colour matrices, histogram equalization, median filters, and image scaling.
Cookbook
Task-shaped recipes, each a complete program CI compiled and ran.
- How-ToA Zig cookbook of runnable recipes: JSON, SQLite, the PostgreSQL wire protocol, Redis RESP, threads and atomics, SIMD, compression and binary formats.
From Scratch
Rebuild the tools you use every day, one program at a time, using nothing you did not write.
- Survive the TerminalBuild the primitives a shell needs before it can exist: string length, comparison, copying and trimming written out by hand, a command-line tokenizer, and the read-eval-print loop itself.
- Unix ToolsRebuild the standard Unix toolbox in Zig, one complete program per chapter: cat, wc, grep, sort, cut, printf and make. Each one runs in the page, and each explains the technique it exists to teach.
- Tiny LanguageBuild a small language from nothing: a lexer, a recursive descent parser, a tree-walking interpreter, call frames, a bytecode compiler and the virtual machine that runs it. Every stage runs in the page.
- Web ServerParse an HTTP request by hand, format a response, and serve it over a real socket. The protocol is text, the framing is a blank line, and none of it needs a framework.
- Data and StorageHow storage engines actually work: an append-only record log, the lost update two writers cause, indexes that turn a scan into a lookup, and a write-ahead log that survives a crash.
- The BrowserThe pipeline behind every page: an HTML parser that cannot fail, a CSS parser and selector matcher, a layout engine that turns a tree into boxes, and a renderer that turns boxes into pixels.
Projects
One library at a time, designed in the open, one decision per chapter.
- An Ecto-Style ORMAn Ecto-style ORM in Zig: schemas as types, a typed query builder, migrations as data, transactions with errdefer, and an adapter seam over SQLite and PostgreSQL.
- A URL ShortenerA CRUD web service in Zig with no framework and no database driver: the PostgreSQL wire protocol spoken directly, base62 slugs, HTTP handlers that take bytes and return bytes, and one file that runs against a real database.
- Lane DodgerA complete hyper casual game in Zig and raylib, playable in the page. Vendoring raylib's C so a dependency cannot break your build, a fixed timestep loop, an entity pool with generational handles, a difficulty curve derived from what is possible rather than guessed at, and sound effects synthesised in code. Fifty-five tests, none of which opens a window.
Practice
The algorithms a contest problem assumes you already have, each one printing the steps it took.
- Competitive ProgrammingContest algorithms written in Zig, one complete program per chapter, each printing the steps it took. Binary search and the off-by-one that stops the loop ending, the converging two-pointer walk and the comparison that dictates its next move, and the sliding window that costs one addition and one subtraction per step.