{"id":15392625,"url":"https://github.com/jackdbd/zig-nodeapi-example","last_synced_at":"2026-04-22T01:05:21.115Z","repository":{"id":199728760,"uuid":"703559050","full_name":"jackdbd/zig-nodeapi-example","owner":"jackdbd","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-19T11:21:32.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T12:51:47.999Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackdbd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-11T13:20:29.000Z","updated_at":"2024-01-06T01:06:40.000Z","dependencies_parsed_at":"2024-10-19T00:15:51.085Z","dependency_job_id":"83b0a8c5-5487-441d-86f8-600f7be8c25b","html_url":"https://github.com/jackdbd/zig-nodeapi-example","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"552c91b51a7e8ae1547679255b9bb5e5fbfbe3a1"},"previous_names":["jackdbd/zig-nodeapi-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jackdbd/zig-nodeapi-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-nodeapi-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-nodeapi-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-nodeapi-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-nodeapi-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdbd","download_url":"https://codeload.github.com/jackdbd/zig-nodeapi-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-nodeapi-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32116514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"ssl_error","status_checked_at":"2026-04-22T00:30:22.894Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T15:15:25.483Z","updated_at":"2026-04-22T01:05:21.082Z","avatar_url":"https://github.com/jackdbd.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig Node-API example\n\n[![Node-API - 9](https://img.shields.io/static/v1?label=Node-API\u0026message=9\u0026color=2ea44f)](https://nodejs.org/api/n-api.html)\n[![CI Linux](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-linux.yaml/badge.svg)](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-linux.yaml)\n[![CI MacOS](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-macos.yaml/badge.svg)](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-macos.yaml)\n[![CI Windows](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-windows.yaml/badge.svg)](https://github.com/jackdbd/zig-nodeapi-example/actions/workflows/ci-windows.yaml)\n\n\u003c!-- Node-API badge generated here: https://michaelcurrin.github.io/badge-generator/#/ --\u003e\n\nMinimal repo to show how to create a Node.js native addon using Zig and the [Node-API](https://nodejs.org/api/n-api.html#node-api).\n\n## Instructions\n\nUse [zigup](https://github.com/marler8997/zigup) to download and fetch the latest Zig compiler:\n\n```sh\nzigup fetch master\nzigup default master\n```\n\nDouble check your Zig version:\n\n```sh\nzig version\n```\n\nHave a look at the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) and decide which version of the Node-API you want to target, and what is the minimum Node.js version that uses that version of the Node-API. For example, Node-API version 9 is supported in Node.js v18.17.0+, 20.3.0+, 21.0.0 and all later versions.\n\n\u003e :warning: Node-API versions are additive and versioned independently from Node.js.\n\nFor example, let's say you want to target Node-API version 9. The minimum Node.js version that supports Node-API version 9 is 18.17.0. So, be sure to use Node.js when building and testing this native addon.\n\n```sh\nnvm install 18.17.0\nnvm use 18.17.0\n```\n\nDouble check your Node.js version:\n\n```sh\nnode -v\n```\n\n## Compile for Linux\n\nDownload the Node-API headers:\n\n```sh\n./download-node-headers.sh\n# or zig build download-node-headers\n```\n\nBuild the native addon using `zig build-lib` (both in [Debug](https://ziglang.org/documentation/master/#Debug) mode and in [ReleaseFast](ReleaseFast) mode):\n\n```sh\nnpm run build\n```\n\nIn alternative, you can build the native addon using `build.zig`:\n\n```sh\nzig build\nmkdir -p dist/debug \u0026\u0026 mv zig-out/lib/libaddon.so dist/debug/addon.node\n\nzig build -Doptimize=ReleaseFast\nmkdir -p dist/release \u0026\u0026 mv zig-out/lib/libaddon.so dist/release/addon.node\n```\n\nRun all tests:\n\n```sh\nnpm test\n```\n\nTry a few examples:\n\n```sh\nnpm run example:bare-minimum\nnpm run example:greet\n```\n\n## Compile for Windows\n\nDownload the Node-API headers (if you haven't already) and both `node.exe` and `node.lib`:\n\n```sh\n./download-node-headers.sh\n./download-node-exe-and-lib.sh\n```\n\nCompile for Windows x86_64:\n\n```sh\nzig build --build-file build-windows-x86-64.zig\n```\n\nTry a few examples:\n\n```sh\nNODE_SKIP_PLATFORM_CHECK=1 wine deps/node-v18.17.0/win-x64/node.exe examples/bare-minimum-win.cjs\n\nNODE_SKIP_PLATFORM_CHECK=1 wine deps/node-v18.17.0/win-x64/node.exe examples/greet-win.cjs\n```\n\n\u003e :warning: You need to set `NODE_SKIP_PLATFORM_CHECK=1` otherwise a Node.js check immediately stops the script execution.\n\n## Credits\n\n- [zig-nodejs-example](https://github.com/staltz/zig-nodejs-example)\n- [tigerbeetle-node](https://github.com/tigerbeetle/tigerbeetle/tree/main/src/clients/node)\n- [Cross compiling a Node.js addon for windows / macOS (ziggit.dev)](https://ziggit.dev/t/cross-compiling-a-node-js-addon-for-windows-macos/1935)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzig-nodeapi-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdbd%2Fzig-nodeapi-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzig-nodeapi-example/lists"}