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.

Quick Start: Pack any Node.js entry in seconds
macOS / Linux (QuickJS prebuilt release)
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

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

Backend Core (no built-ins) All modules Notes
QuickJS (default) 5.20 MiB (2.22 gz) 11.61 MiB (5.51 gz) Smallest footprint; static musl build available via THINPACK_STATIC=1.
V8 (THINPACK_BACKEND=v8) 45.82 MiB (16.84 gz) 52.25 MiB (20.15 gz) Full V8 JIT speed when compute/startup latency matters more than binary size (glibc Linux / macOS / Windows).
JavaScriptCore (macOS jsc) System framework System framework Uses macOS JavaScriptCore.framework instead of bundling an engine; see docs/gaps.md for ESM/SAB limits.

Vercel pkg Alternative

vercel/pkg is archived. Compare Thinpack.js against @yao-pkg/pkg, Node SEA, Bun, and Deno by binary footprint, ESM support, and CI setup.

Thinpack vs Bun --compile

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.

Thinpack vs Node.js SEA

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:

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.