zigcc/zig-cookbook

Simple Zig programs that demonstrate good practices to accomplish common programming tasks.

Zig

1,184

146 commits

updated Oct 1, 2026

See the code

README

Zig Cookbook

中文

Zig Cookbook Logo

Zig cookbook is a collection of simple Zig programs that demonstrate good practices to accomplish common programming tasks.

  • Main branch tracks Zig 0.16.x, and is tested on Linux and macOS via GitHub actions.
  • Earlier Zig support could be found in other branches.

How to use

The website is generated by zine-ssg, a static site generator for Zig. zine will start a server at http://localhost:1990 for preview.

Each recipe is accompanied by an illustrative example named after its title. These examples can be executed using the command zig build run-{title}, or zig build run-all to execute all.

Note

Some recipes may depend on system libraries

  • Use make install-deps to install client libraries, and
  • docker-compose up -d to start required databases.

Contributing

This cookbook is a work in progress, and we welcome contributions from the community. If you have a favorite recipe that you'd like to share, please submit a pull request.

Localization

Create corresponding recipe in the language folder, localize it, and submit a pull request.

Acknowledgment

Zig Cookbook was inspired by several other similar projects. We would like to thank the following projects, thanks for their awesome work.

Star History

Star History Chart

License

The markdown files are licensed under CC BY-NC-ND 4.0 DEED, and zig files are under MIT.

zig
ziglang

zigcc/zig-cookbook

Simple Zig programs that demonstrate good practices to accomplish common programming tasks.

Zig

1,184

146 commits

updated Oct 1, 2026

See the code

README

Zig Cookbook

中文

Zig Cookbook Logo

Zig cookbook is a collection of simple Zig programs that demonstrate good practices to accomplish common programming tasks.

  • Main branch tracks Zig 0.16.x, and is tested on Linux and macOS via GitHub actions.
  • Earlier Zig support could be found in other branches.

How to use

The website is generated by zine-ssg, a static site generator for Zig. zine will start a server at http://localhost:1990 for preview.

Each recipe is accompanied by an illustrative example named after its title. These examples can be executed using the command zig build run-{title}, or zig build run-all to execute all.

Note

Some recipes may depend on system libraries

  • Use make install-deps to install client libraries, and
  • docker-compose up -d to start required databases.

Contributing

This cookbook is a work in progress, and we welcome contributions from the community. If you have a favorite recipe that you'd like to share, please submit a pull request.

Localization

Create corresponding recipe in the language folder, localize it, and submit a pull request.

Acknowledgment

Zig Cookbook was inspired by several other similar projects. We would like to thank the following projects, thanks for their awesome work.

Star History

Star History Chart

License

The markdown files are licensed under CC BY-NC-ND 4.0 DEED, and zig files are under MIT.

zig
ziglang

Significant stargazers

Robert Nagy

477 followers · starred Jan 2024

chansuke

95 followers · starred Nov 2024

Alex Langford

47 followers · starred Jan 2024

Troy Connor

149 followers · starred Jan 2025