# Introduction to Zig: a project-based book you can read online or build yourself

> Pedro Duarte Faria's book teaches Zig through small projects, and the repository doubles as a Quarto, R and Nix build pipeline. It suits readers who want to compile every example, not skim a PDF.

**pedropark99/zig-book** — An open, technical and introductory book for the Zig programming language 📚📖

- Repository: https://github.com/pedropark99/zig-book
- Website: https://pedropark99.github.io/zig-book/
- Stars: 2,697 · Forks: 170
- Language: Zig
- License: NOASSERTION
- Published: 2026-09-28 · Updated: 2026-09-28 · Language: en
- Canonical page: https://hysenlabs.com/projects/pedropark99-zig-book

## What Introduction to Zig is, and who it is written for

This is the official repository for "Introduction to Zig: a project-based book" by Pedro Duarte Faria, published under the pedropark99/zig-book name. The README describes it as "an open (i.e., open-source), technical and introductory book for the Zig programming language", aimed at both beginners and experienced developers. The teaching method is stated plainly: small, simple projects in the style of Eric Matthes's Python Crash Course, among them a Base64 encoder/decoder, an HTTP server and an image filter.

The topic list is the real scope statement. Syntax and how it compares to C, C++ and Rust. Data structures, memory allocators, filesystem and I/O. Optionals as a way to handle nullability. Testing and debugging a Zig application. Errors as values. The build system embedded in the language, including building C and Zig code. Zig interoperability with C. Threads and SIMD. That is a broad sweep for an introductory text, and the project-based framing is what keeps it from becoming a syntax tour.

Who it is for: someone who already programs and wants Zig's memory model, error handling and build system explained with runnable code. Who it is not for: someone who wants a language-agnostic introduction to programming, or a reference they can pin for years. The book is a moving target by design.

## The build pipeline: Quarto, R and a Zig engine

The book is not plain Markdown. According to the README, the core content is built with the Quarto publishing system together with a small amount of R code in `zig_engine.R`, which is "responsible for calling the Zig compiler to compile and run the Zig code examples". That is the interesting architectural choice: the examples are executed during the build, and their results are collected back into the book text.

Quarto handles internal links, references, the chapter structure and the HTML output, using Pandoc with Quarto's own extensions. The repository layout matches this: `Chapters/` holds the prose, `ZigExamples/` holds the code, `Scripts/` holds supporting scripts, `_quarto.yml` configures the site, and `docs/` is the built output served at the homepage. A `_freeze/` directory is present, which is Quarto's mechanism for caching computed results so a rebuild does not re-execute everything.

The consequence for a reader is that the code in the book is not hand-copied into the text. It is compiled as part of producing the page. That reduces the chance of a snippet that never ran, though it does not guarantee the snippet still compiles against whatever Zig version you have installed locally.

## Reading it online versus building the book locally

The fastest path needs no installation at all. The README points to the current version in a browser at https://pedropark99.github.io/zig-book/. If your goal is to learn Zig, start there. The build instructions exist for people who want the PDF, want to contribute, or want to run the examples against their own compiler.

If you do build it, the README names three dependencies: the Zig compiler, the R programming language (with `knitr` and `rmarkdown`), and Quarto. It offers two strategies: install the three manually, or use the Nix Flake declared in `flake.nix` to create a reproducible environment that already comes with them installed. The Nix route is the one that removes version drift between the three tools.

The manual route continues with installing R packages, which the README covers under its own heading and which the truncated text does not spell out. The repository does carry a `dependencies.R` file, so that is where the R package list lives.

A minimal Nix-based start looks like this. The README states the flake provides an environment with Zig, R and Quarto already installed, so the render command is what you run inside it.

```bash
nix develop
quarto render
```

After `quarto render`, Quarto writes the built book to the output directory configured in `_quarto.yml`; the repository's `docs/` directory is the published copy, and `.nojekyll` sits at the top level so GitHub Pages serves it as-is.

## Where the book stops being the right tool

The clearest limitation is version coupling. Zig is a young language, and the README's own pipeline compiles the examples at build time. When Zig changes, examples can stop compiling, and the fix has to be made in `ZigExamples/` and re-rendered. The release history shows the book is versioned deliberately (v1.6.0 on 2026-03-01, v1.7.0 on 2026-05-01, v1.7.1 on 2026-07-25), which is a sign of maintenance rather than a guarantee of currency against any given compiler build.

Second, it is a book, not a library. There is no package to install, no API to call, no runtime to evaluate. If what you need is a reference implementation of a Zig HTTP server or a Base64 codec for production, the book's versions are teaching artifacts, not hardened code. The README describes them as "small and simple projects".

Third, the build path assumes a Unix-like environment. The README lists Nix and manual installation of Zig, R and Quarto; a `.devcontainer/` directory exists in the repository, which suggests container-based development is supported, but the README does not document a Windows-native workflow.

Finally, the licence is recorded as NOASSERTION, and a `LICENSE` file is present at the top level without a recognised SPDX identifier in the repository metadata. That matters if you plan to reuse chapters or examples in your own material. Read the file itself rather than assuming a permissive default.

## Alternatives: the language reference and the standard library source

The obvious alternative is Zig's own documentation at ziglang.org, which the README links for compiler downloads. The difference in approach is stark. The official material is a language reference and a standard library reference: it defines syntax and APIs, and it assumes you already know what you want to build. It does not walk you through a Base64 encoder from an empty file.

Introduction to Zig inverts that. It starts from a project, and the language features arrive as needed to finish it. Memory allocators show up because a project needs to allocate; errors as values show up because a project needs to fail cleanly; C interoperability shows up because a project needs to call C. That ordering suits a reader who learns by doing and stalls on reference documentation read front to back.

The cost of the inversion is coverage discipline. A project-based book can only teach what its projects require, so topics outside the project set get less attention than a reference would give them. The README's topic list is long, but a reference manual will still be the place you go when you need the full signature of something the book used once.

A third option is reading the standard library source directly, which is idiomatic for Zig. It is also the least forgiving starting point, since the source assumes you already read Zig fluently.

## Maintenance, releases and what the licence leaves open

The repository is not archived, and the last push was on 2026-09-23. Three releases landed in 2026: v1.6.0 on 2026-03-01, v1.7.0 on 2026-05-01 and v1.7.1 on 2026-07-25, with the release tags matching the version strings. The cadence is roughly every two months, which is consistent with a book that follows a language still in flux.

Upgrade cost for a reader is low, because reading the online book costs nothing and a new release mainly means re-reading changed chapters. Upgrade cost for a contributor or a forker is higher: the build pulls in Zig, R, Quarto, Pandoc and `knitr`, and the `flake.lock` file pins the Nix inputs. If you fork and stop updating, expect the pinned Zig version in the lock file to age faster than the prose.

The licence situation deserves a direct statement. The repository metadata reports NOASSERTION, which means no recognised licence identifier was detected. A `LICENSE` file exists at the top level. Whether that file permits redistribution of the text, the figures in `Figures/` and `Cover/`, or the code in `ZigExamples/` is something you have to read for yourself. The README separately offers the book for sale on Amazon and Leanpub, and accepts donations through PayPal and Revolut, which tells you the author treats the paid editions as the support channel. Treat the repository as source for the book rather than as a permissively licensed corpus until the LICENSE file says otherwise.

## Conclusion

Adopt it if you learn by compiling and running small projects (a Base64 encoder, an HTTP server, an image filter) and you want the source and the prose in one repository. Skip it if you want a stable printed reference: the book tracks Zig, and the repository's own example engine calls the compiler, so a Zig release that changes syntax can break examples until the author updates them. Before committing, open https://pedropark99.github.io/zig-book/ and check whether the chapter you need already exists, then look at the v1.7.1 tag from 2026-07-25 to see how recently the text moved.

## FAQ

### Where can I read Introduction to Zig online?

The README points to the current version of the book in a web browser at https://pedropark99.github.io/zig-book/. That is the same content the repository builds from the `Chapters/` directory.

### Can I buy Introduction to Zig as a PDF or printed book?

Yes. The README says you can buy a PDF, eBook or physical copy at Amazon or at Leanpub, and lists both store links. The repository also accepts direct donations via PayPal and Revolut.

### What is Zig used for, according to Introduction to Zig?

The README describes Zig as a new general purpose, low-level programming language for building optimal and robust software, and the book's projects include a Base64 encoder/decoder, an HTTP server and an image filter. It also covers C interoperability, threads and SIMD.

### What are Zig's disadvantages according to Introduction to Zig?

The README does not list disadvantages of the language. It only states that Zig is a new general purpose, low-level language and that the book compares its syntax to C, C++ and Rust.

## Sources

- [Issues](https://github.com/pedropark99/zig-book/issues)
- [pedropark99/zig-book on GitHub](https://github.com/pedropark99/zig-book)
- [Project website](https://pedropark99.github.io/zig-book/)
- [README](https://github.com/pedropark99/zig-book/blob/main/README.md)
- [Releases](https://github.com/pedropark99/zig-book/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/pedropark99-zig-book
