Running Node.js Apps on QuickJS (With 43 Modular Built-Ins)
Stock QuickJS is tiny, but it lacks Node’s standard library, module resolution, networking stack, and async runtime. Thinpack.js bridges that gap with 43 granular Rust capability crates so real npm CLIs work on QuickJS at 4–12 MiB.
Why 150 MiB shrinks to 4–12 MiB: 43 built-ins trimmed on demand
Switch apps in the benchmark card above to see which of the 43 capabilities.toml modules get linked while unused ones stay out.
hello.js: --rebuild links minimal console/process only (1 file)
Modular crates/node/* + capabilities.toml: Each built-in capability—from fs, path, crypto, and child_process to worker_threads, sqlite, test, and sea—is generated into isolated Cargo features via cargo xtask gen.
Real Node undici for fetch & WebSocket: Global fetch, Headers, Request, Response, and FormData are vendored byte-for-byte from Node’s deps/undici/undici.js. Meanwhile, HTTP-only apps omit that 16-module undici bundle and embed only the extracted llhttp Wasm parser inside node:http.
Brotli-compressed Node JS glue: Built-in JavaScript sources live brotli-compressed inside thinpack_js::js!—2.0 MB of JavaScript costs only 0.43 MB in the compiled binary.
WebAssembly & FFI: WebAssembly is always available via WAMR (~217 KB on QuickJS), and native C calls go through node:ffi.
Strict Fail-Loud Parity & Honest QuickJS Limits
From docs/gaps.md and docs/reference.md, Thinpack follows a strict rule: an API either behaves like Node or throws ERR_NOT_IMPLEMENTED—it never silently fabricates stub return values.
16-bit lexical scope ID limit: QuickJS stores lexical scope IDs in 16 bits. Huge generated single-function code (such as large AJV standalone validators exceeding 65,535 scopes) fails on QuickJS and requires --backend v8.
Crypto key coverage: Covers RSA/RSA-PSS, EC (P-256/P-384/P-521/secp256k1), Ed25519, X25519, and createSecretKey for HMAC/ciphers/HKDF (DSA, DH, Ed448, X448, and encrypted PKCS#1/SEC1 PEM are rejected).
Omitted globals: No full ICU Intl data (Intl.Segmenter is a lazy fallback on QuickJS), no Temporal, no inspector protocol, and no EventSource.
Swap to V8 anytime: Because Thinpack runs on an engine-agnostic embedding layer (thinpack-js/v8x), passing --backend v8 switches the exact same app to V8 without rewriting imports.
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.
Frequently Asked Questions
How many Node.js built-in modules does Thinpack support on QuickJS?
capabilities.toml defines 43 modular crates under crates/node/* (covering fs, http, https, http2, fetch, crypto, zlib, stream, buffer, worker_threads, child_process, sea, test, sqlite, ffi, and more), with Node’s JS glue brotli-compressed inside the template.
Is QuickJS in Thinpack a full drop-in replacement for Node.js?
No. Every API follows a strict fail-loud rule: it behaves like Node or throws ERR_NOT_IMPLEMENTED rather than returning fabricated values. Native .node N-API addons are unsupported (use node:ffi), and full ICU Intl data, Temporal, and inspector are omitted.
Why do huge generated schemas like AJV standalone validators hit a QuickJS limit?
QuickJS stores lexical scope IDs in 16 bits, so a single generated function creating more than 65,535 lexical scopes fails on QuickJS. Switch that workload to --backend v8.
How much RAM and binary overhead does QuickJS add compared to V8?
A stripped Linux x86_64 QuickJS template with zero built-ins is 5.20 MiB (2.22 MiB gzip) vs 45.82 MiB for V8 Core, and WebAssembly support via WAMR adds about 217 KB. On 2,377-module pi-coding-agent, QuickJS peak RSS is 104 MB.
Why /app file boundaries let real ESM & TypeScript CLIs run.
Ship 4–12 MB Node.js binaries. Star thinpack.js on GitHub.
thinpack.js is 100% MIT-licensed and actively developed in Rust + JavaScript. Star the repository to follow releases or request compatibility fixtures for your favorite CLI.