@teakit/napi

@teakit/napi is a Zig toolkit for building Node-API addons. The Zig package and import name is napi; the npm CLI package, executable, and command name is napikit.

Minimal module

const napi = @import("napi");

comptime {
    napi.module(@This());
}

pub fn add(a: i32, b: i32) i32 {
    return a + b;
}

Public contract

  • Runtime entry: src/root.zig.
  • Build entry: build.zig, especially addLib, LibOptions, NpmConfig, Dts, Import, and Platform.
  • CLI entry: napikit new, build, bump, publish, and npm-init.
  • Generated addons use .node binaries, JavaScript bindings, and optional declarations.
  • .dts = .none emits no declaration, types field, or index.d.ts package entry; a release rebuild removes the stale build-owned declaration when switching to .none.
  • Toolchain baseline: Zig 0.16.0, Bun 1.3.14 for this repository, and Node.js >=20.19.0 for the published napikit CLI.
  • Public docs: https://napi.teakit.org.
  • Source repository: https://github.com/teakit/napi.

Reference map

Repository commands

bun install --frozen-lockfile
bun run check
bun run typecheck
bun run test
bun run build
bun run docs:build

Use teakit-napi/SKILL.md for task workflow, guardrails, and complete reference routing.

For repository maintenance, .github/workflows/quality.yml defines the five canonical checks and .github/workflows/publish-to-npm.yml releases the CLI. The addon scaffolder writes a separate .github/workflows/publish.yml into generated projects.