Open-source project
pedropark99/zig-book avatar
pedropark99/zig-book

zig-book compiles and runs every Zig listing at render time, through R and Quarto

An open, technical and introductory book for the Zig programming language 📚📖

2,733 stars172 forksZigNOASSERTION

At a glance

What is it?
Introduction to Zig by Pedro Duarte Faria is free to read in a browser and also sold as a PDF, an eBook and a paper copy. Building it locally needs three tools plus a fourth underneath, and the section explaining how the R code finds the Zig compiler stops mid-sentence.
Who is it for?
zig-book suits a reader who wants Zig explained through small finished programs and intends to type the listings out rather than read them, and it does not suit someone wanting a language reference or a critical assessment.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly Zig, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • pedropark99/zig-book2,733 ★ · +28
Star history
Repository2026-10-042026-11-24
pedropark99/zig-book2.7k2.7k

28 Stars in the last 51 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The book is free to read and also for sale, and the sales pitch comes first

The opening screen settles money before content. The repository is presented as the official home of Introduction to Zig, a project-based book by Pedro Duarte Faria, readable in full in a browser at pedropark99.github.io/zig-book/, and the next section offers a PDF, eBook or physical copy through an Amazon listing and a Leanpub page. Direct donations to the author are a third route, sitting beside the two shops. So there are three prices for one artefact and only one of them is zero. The About section then calls the book open and glosses that as open-source, which sets up the question the rest of the repository never answers, namely under what terms the prose itself may be reused. Nothing there mentions redistribution, adaptation or attribution for the text or for the sample code.

R drives the Zig compiler, and the section on finding it stops mid-sentence

Every Zig listing in the book is executed rather than transcribed. One R script, zig_engine.R, collects the code examples found across the chapters, sends them to the Zig compiler so they can be compiled and run, and gathers the output back for inclusion. knitr and rmarkdown do the collecting and the result capture. That arrangement means the toolchain has to be located from inside an R session, and the section covering it, headed How the Zig compiler is found, ends partway through its second paragraph on the words this R code needs to find the Zig. Nothing beyond that point names an environment variable, a path setting or a search order, so the exact mechanism a reader needs in order to point the build at a non-standard install is the part that stops.

Both build routes end in the same command, and only one of them pins anything

Two routes are offered and they diverge for exactly one step. The manual route asks you to install the Zig compiler, R and Quarto yourself, then run the R script that installs the packages the book uses:

bash
Rscript dependencies.R

followed by the render command the other route also ends on:

bash
quarto render

The Nix route replaces that first step with an environment that arrives with the dependencies already inside it:

bash
nix develop

after which quarto render is run again inside the shell Nix opens. The platform note also lives on the manual script: on Linux and macOS every dependency is built from source and the command will probably take some time, while on Windows pre-built binaries are usually available. The Nix route ships flake.nix and flake.lock together, so its versions are pinned, whereas the manual route resolves them fresh on each machine.

Four tools in the pipeline against a stated count of three

The text calls the requirement set three pieces of software: the Zig compiler for the examples, R for knitr and rmarkdown, and Quarto for compiling the book. Quarto's own paragraph then explains that it produces the chapter structure, internal links, references and the HTML by driving Pandoc with extra features Quarto implements. Pandoc therefore sits underneath as a fourth component that the count of three does not include, and Nix is a fifth name used for the environment rather than the pipeline. The badge row at the top names Zig, Quarto, R, knitr and Pandoc plus Nix, six links for what the prose calls three dependencies. No version is stated for any of them anywhere in this text, and the only pinning anywhere in the project is the Nix lock file.

Chapters/, ZigExamples/ and a frozen computation cache sit side by side

Content and machinery are separated by directory. Chapters/ holds the chapter sources, ZigExamples/ the Zig code, Figures/ and Assets/ the images, Cover/ the artwork, and index.qmd at the root is the landing page source that becomes the site. Alongside them sit _quarto.yml for project configuration, zig_engine.R and dependencies.R for the R side, and Scripts/ for whatever else the build needs. Two entries describe publishing rather than writing: _freeze/ is where Quarto keeps frozen computation results so they are not recomputed, and docs/ with the neighbouring .nojekyll is the published site, that marker existing to stop GitHub Pages from processing it. .devcontainer/ sits at the top for editor parity. No script that moves render output into docs/ is named in the text present here.

Tags stop two months behind the branch, and two of them land on the first

Three tags are visible and their dates have a shape. v1.6.0 was published on 2026-03-01 and v1.7.0 on 2026-05-01, both on the first day of a month and two months apart, followed by v1.7.1 on 2026-07-25, a patch release that breaks the pattern. The repository is not archived and its last push is dated 2026-09-23, roughly two months after the newest tag, so the branch has moved well past the last version number without a new one appearing. Nothing in the visible text says whether a tag tracks a finished chapter set, a particular Zig release, or a rebuild of the published site. For a reader who builds from a tag and then follows main, that difference is the entire gap.

An open-source book with a LICENSE file and no license asserted

The book presents itself as open and spells out that it means open-source, then never names a license. No license is asserted for the repository as a whole, and a LICENSE file sits in the root directory next to README.md and CONTRIBUTING.md. The same root also carries a .gitignore, so the line between what is shared and what is kept back is drawn by directory rather than by license text. For the sample Zig code that matters less, because a reader can see each listing executed with its output inside the pages. For the prose it matters more, since a translation, an excerpt or a derived course has no stated terms to follow. The commercial editions and the free web version are the same text, which leaves the reuse question sitting right next to the sales pitch.

C, C++ and Rust are the comparison points, Python Crash Course the shape

Scope is declared twice, once in a comparison line and once in a topic list. The language is introduced as general purpose and low level, and the book compares its syntax against C, C++ and Rust. Three sample projects are named, a Base64 encoder and decoder, an HTTP server and an image filter, described as small and simple, in a style compared to Python Crash Course by Eric Matthes. The topic list runs from syntax and data structures through memory allocators, filesystem and I/O, optionals as a paradigm for nullability, testing and debugging, errors as values, the build system embedded in the language, interoperability with C, and parallelism with threads and SIMD. The audience line claims beginners and experienced developers at the same time, which sets a single pace for two very different starting points.

Editorial conclusion

zig-book suits a reader who wants Zig explained through small finished programs and intends to type the listings out rather than read them, and it does not suit someone wanting a language reference or a critical assessment. Before you start, settle three things: how the R session locates your Zig install, since the section on that ends partway through a sentence; whether your machine can afford building every R dependency from source, which is what the manual route does on Linux and macOS; and what the LICENSE file at the root actually grants, because no license is asserted for the repository. If you only want to read, the browser version needs none of this.

Frequently asked questions

Where can I buy a Zigbook?

A PDF, an eBook and a physical copy of Introduction to Zig are sold through an Amazon listing and a Leanpub page, and direct donations to the author are accepted as a third option. The full text is readable free in a browser at pedropark99.github.io/zig-book/.

Where can I learn Zig?

This repository is one such place. The book is readable in full at pedropark99.github.io/zig-book/ and covers syntax compared to C, C++ and Rust, data structures, memory allocators, filesystem and I/O, optionals, testing and debugging, errors as values, the embedded build system, C interoperability, and threads and SIMD.

What are Zig's disadvantages?

This repository does not answer that. It is a teaching book, and the only thing it states about the language is scope: general purpose and low level, with syntax compared against C, C++ and Rust. No drawbacks, trade-offs or criticism of the language appear anywhere in it.

What is Zig used for?

The book introduces the language as general purpose and low level and demonstrates it through three small projects: a Base64 encoder and decoder, an HTTP server and an image filter. No industry deployments or production use cases are described.

Do I need Nix to build the zig-book site locally?

No. The manual route installs the Zig compiler, R and Quarto yourself, then runs Rscript dependencies.R followed by quarto render. The Nix route runs nix develop and then quarto render inside the shell it opens, with versions pinned by flake.lock.

Official sources

  1. Issues
  2. pedropark99/zig-book on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pedropark99-zig-book.svg)](https://hysenlabs.com/projects/pedropark99-zig-book)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/pedropark99-zig-book.svg)](https://hysenlabs.com/projects/pedropark99-zig-book)

Was this useful?