Build Node.js native addons in Zig. Cross-compile every platform from one machine. Publish to npm with one command.
const napi = @import("napi-zig");
comptime { napi.module(@This()); }
pub fn add(a: i32, b: i32) i32 {
return a + b;
}import addon from "./my-addon.js";
addon.add(2, 3); // 5npx napi-zig@latest new my-addoncd my-addon
node test.mjsThat's it. You have a working native Node.js addon written in Zig.
Full guides, API reference, and the publish pipeline:
- Introduction
- Quick start
- Functions, classes, and types
- Async (workers, threadsafe, promises)
- Cross-compiling and publishing
- API reference
MIT