MIT Open Source · v0.3.1 · Rust + QuickJS / V8 / JSC
Pack Node.js apps into a 4 MiB single executable.
Instead of shipping a 104–158 MiB full runtime alongside a 50 KB CLI, Thinpack.js traces your module graph with Oxc, links only the Node.js built-ins your code touches, and compiles to a standalone binary with QuickJS, V8, or macOS JavaScriptCore.
4.03 MiB
Hello World on Linux x64 CI (--rebuild) vs 104.1 MiB Bun
6.5–9.0 MiB
Real TypeScript compiler (tsc) vs 109.6 MiB Bun & 149.8 MiB SEA
3 Backends
QuickJS default, V8 when speed wins, macOS jsc
Zero Deps
End users need no Node.js, Bun, or npm install
Interactive Benchmark Explorer (Linux x86_64)
Every number below is measured on real unmodified npm CLIs in docs/benchmarks.md and regression-checked on every commit in tests/apps/baseline.toml. Click an app to inspect both raw binary sizes and compressed transfer sizes.
Thinpack (QuickJS)
9.00 MiB
Bun 1.4.4 --compile
109.63 MiB
Node 26.8.1 SEA
149.82 MiB
typescript@5.9.3 (uncompressed binary): Thinpack 9.00 MiB · 12.2x smaller than Bun · 16.6x smaller than Node SEA · startup 578 ms cold / 347 ms warm
Thinpack runs tsc as shipped (--include for lib). Bun needs bin/tsc copied to *.js. Node SEA prints --version but fails to compile.
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
./hello
'console.log("Hello from Thinpack!")' | Set-Content -Encoding Ascii hello.js
.\thinpack.exe pack hello.js -o hello.exe
.\hello.exe
- uses: thinpack-js/thinpack.js@main
id: pack
with:
version: v0.3.1
entry: src/cli.js
name: my-cli
git clone https://github.com/thinpack-js/thinpack.js.git
thinpack pack hello.js -o hello --rebuild --source ./thinpack.js
ls -lh hello # ~4.03 MiB on Linux x64
Why Single-File Node Binaries Usually Bloat Past 100 MiB
Both Node.js Single Executable Applications (SEA) and bun build --compile work by attaching your application bundle to a fixed copy of the full runtime binary. Because V8, ICU, llhttp, OpenSSL/BoringSSL, and every built-in module stay linked inside that base executable, even a ten-line script inherits more than 100 MiB of runtime before your own code is counted. On top of that, Node SEA relies on a CJS injection workflow that currently breaks packages depending on import.meta.url or dynamic import().
Thinpack.js reverses the architecture: build the runtime around the app, not the app around the runtime. A Rust static analyzer built on oxc walks your CommonJS and ESM imports, evaluates static path.join(__dirname, ...) data reads, detects global references like fetch or WebSocket, and computes a minimal capability closure from capabilities.toml. When packing with --rebuild, Cargo compiles a stripped runtime template containing only those linked crates/node/* capabilities and appends your brotli-compressed JavaScript sources and virtual filesystem payload under /app.
Choose the Right Backend per Workload
vercel/pkg is archived. Compare Thinpack.js against @yao-pkg/pkg, Node SEA, Bun, and Deno by binary footprint, ESM support, and CI setup.
See where 6.5–12.4 MiB binaries beat 104–115 MiB Bun executables—and where Bun's 4x faster startup makes Bun the better choice.
Why Node SEA failed on 4 of 6 benchmarked CLIs (tsc, eslint, prettier, pi) while Thinpack ran all six, plus node:sea asset compatibility.
Honest Engineering Trade-Offs & Compatibility Limits
No silver bullets: Thinpack is built for shipping small, portable Node.js CLIs and developer tools—not for replacing a full V8 production server. Before adopting it, check these verified limits from docs/reference.md and docs/gaps.md:
- Cold startup latency on QuickJS: QuickJS parses JS slower than V8 or JavaScriptCore. On
tsc --version, Thinpack takes 578 ms cold / 347 ms warm versus 77 ms for Node SEA; on pi --help, Thinpack takes 777 ms versus 192 ms for Bun. Switch to --backend v8 whenever latency beats download size.
- No native N-API addons:
.node native C++ addons are not loaded. Code requiring native libraries must use node:ffi instead.
- QuickJS 16-bit lexical scope IDs: QuickJS encodes lexical scope IDs in 16 bits, so generated single-function validators exceeding 65,535 scopes (such as huge AJV standalone schemas) fail unless run on the V8 backend.
- Fail-loud Node parity: Unsupported Node built-in behaviors throw
ERR_NOT_IMPLEMENTED rather than returning fake stub values. No full ICU Intl data, Temporal, or inspector protocol is bundled.
- Linux glibc floor: Prebuilt Linux glibc binaries from
v0.3.1 require glibc 2.39+ (Ubuntu 24.04). For older Linux distros, install with THINPACK_STATIC=1 to pull the musl static archive.
Frequently Asked Questions
How does Thinpack.js pack Node.js apps to 4–9 MiB instead of 100–150 MiB?
Node SEA and Bun embed a full V8 or JavaScriptCore runtime plus the complete built-in library. Thinpack uses QuickJS by default, analyzes your module graph with Oxc, and links only the required Node built-in capability crates while compressing embedded JS sources with brotli.
What is the trade-off of using QuickJS instead of V8?
Startup and parser speed. On Linux x64 benchmarks, QuickJS cold start is roughly 4–8x slower than Node SEA or Bun (for example, tsc --version is 578 ms cold / 347 ms warm vs 77 ms on SEA, and pi --help is 777 ms vs Bun 192 ms). When throughput or startup speed matters more than size, pass --backend v8 or set THINPACK_BACKEND=v8.
Can Thinpack.js replace Node.js 100% or load native .node addons?
No. Thinpack implements many Node.js APIs and follows a fail-loud rule (behaving like Node or throwing ERR_NOT_IMPLEMENTED), but it does not load N-API or native C++ addons. Code needing native bindings goes through node:ffi.
Does Thinpack support TypeScript and ESM out of the box?
Yes. Thinpack runs Node’s strip-only TypeScript pass at pack time for .ts, .mts, and .cts files, erases type-only imports before analysis, and supports ESM, CommonJS, import.meta, and vendored Node undici fetch/WebSocket.
Shipping smaller Node.js CLIs? Star thinpack.js on GitHub
thinpack.js is 100% MIT-licensed and actively developed in Rust + JavaScript. If you ship Node.js CLIs and want 4–12 MiB binaries instead of 104–158 MiB runtimes, starring the repository helps other developers discover it and prioritizes new Node compatibility fixtures.