https://github.com/yuku-toolchain/napi-zig
The simplest way to write cross-platform Node.js native addons in Zig.
https://github.com/yuku-toolchain/napi-zig
napi native-addon nodejs zig
Last synced: 18 days ago
JSON representation
The simplest way to write cross-platform Node.js native addons in Zig.
- Host: GitHub
- URL: https://github.com/yuku-toolchain/napi-zig
- Owner: yuku-toolchain
- Created: 2026-04-05T08:47:56.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-06-11T18:21:47.000Z (about 2 months ago)
- Last Synced: 2026-06-11T20:10:59.854Z (about 2 months ago)
- Topics: napi, native-addon, nodejs, zig
- Language: TypeScript
- Homepage: https://napi-zig.dev
- Size: 9.51 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# napi-zig
Build [Node.js native addons](https://nodejs.org/api/n-api.html) in Zig. Cross-compile every platform from one machine. Publish to npm with one command.
```zig
const napi = @import("napi-zig");
comptime { napi.module(@This()); }
pub fn add(a: i32, b: i32) i32 {
return a + b;
}
```
```js
import addon from "./my-addon.js";
addon.add(2, 3); // 5
```
## Quick start
```sh
npx napi-zig@latest new my-addon
```
```sh
cd my-addon
node test.mjs
```
That's it. You have a working native Node.js addon written in Zig.
## Documentation
Full guides, API reference, and the publish pipeline:
**[napi-zig.dev](https://napi-zig.dev)**
- [Introduction](https://napi-zig.dev/)
- [Quick start](https://napi-zig.dev/quick-start)
- [Functions, classes, and types](https://napi-zig.dev/functions)
- [Async (workers, threadsafe, promises)](https://napi-zig.dev/async/workers)
- [Cross-compiling and publishing](https://napi-zig.dev/cross-compiling)
- [API reference](https://napi-zig.dev/reference/env)
## License
MIT