Pack a Node.js program into a single executable. No separate Node.js, Bun, or npm install is needed to run it.
English | 简体中文
On macOS or Linux, run this in a new directory:
curl -fsSL https://raw.githubusercontent.com/thinpack-js/thinpack.js/main/scripts/install.sh | sh
printf '%s\n' 'console.log("Hello from Thinpack!")' > hello.js
"$HOME/.local/bin/thinpack" pack hello.js -o hello
./helloOn Windows x64, extract the matching release archive, then run this in the extracted directory:
'console.log("Hello from Thinpack!")' | Set-Content -Encoding Ascii hello.js
.\thinpack.exe pack hello.js -o hello.exe
.\hello.exeBoth print Hello from Thinpack!. Replace hello.js with your app's entry point. Pack for the target OS and architecture. Keep thinpack and its runtime template together on the build machine; ship just the output executable.
A single-line console.log("hello") packs to 4.03 MiB (4,230,361 bytes) on Linux x64 CI with QuickJS and --rebuild. This is the standalone executable, including the runtime.
In a Linux x64 benchmark, tsc packed to 9.0 MiB with Thinpack and 109.6 MiB with Bun --compile. Thinpack used QuickJS with --rebuild to link only the needed built-ins. The prebuilt template is larger, and QuickJS can trade startup speed for size.
Thinpack supports many Node.js APIs, but it is not a drop-in replacement for Node.js. It does not load native Node addons. Use --include <path> to package extra files or computed local imports; paths are relative to the project root. A config file that selects a package, such as Babel's .babelrc, must be included too; the packed copy lives under /app, not in the working directory. See the Babel example. Verify important commands on every platform you ship.
