← All books

The cover: a basil leaf whose veins are circuit board traces, growing from a small circuit board, on dark green (Coming soon)

Hardware Design as Code

Hermetic, Tested CAD Builds with Bazel

by Filip Filmar

Most hardware is still made by hand in graphical editors, and the files that go to the board factory are whatever was exported last. This book shows how to build a physical product the way software is built. You describe it as text files: its circuit, its board, its enclosure and the toolpath that mills its front panel. Bazel turns them into everything a factory takes, and runs tests that fail when the design is wrong.

The book writes the circuit in Python with SKiDL, and checks the board with KiCad against the factory’s own design rules and against the circuit. It models the enclosure with build123d and tests that the board fits, and it makes and checks the G-code that FreeCAD writes for the front panel. It ends with a JLCPCB assembly package that is the same, byte for byte, on every build.

One design runs through the whole book: a USB-C temperature and humidity sensor, on a two-layer board in a 3D-printed enclosure with a milled aluminium front panel. Every listing and picture in the book is built from that design, which is on GitHub.

It is a companion to Hardware Development with Bazel. That book teaches how to write Bazel rules for hardware tools; this one shows how to use a set of them to design and ship a product.

Planned for 1 December 2026, in paperback and as an ebook.

Notify me when it's out