Nub Brings Bun's Best DX to Stock Node.js
A new Rust-powered toolkit wraps real Node.js to deliver fast TypeScript execution, package management, and environment loading without runtime risk.
We have all stared at a terminal waiting for npm install to stall, or wrestled with a convoluted mix of tsconfig.json paths, dotenv, nodemon, and tsx just to run a simple TypeScript file in development.
When Bun arrived, it promised to sweep away this fragmented toolchain by offering an all-in-one runtime, package manager, and bundler. Yet, despite the massive hype and impressive benchmarks, swapping your runtime in production is a terrifying prospect. Years after their respective launches, neither Bun nor Deno has fully broken Node's production monopoly on major cloud platforms like AWS, GCP, or Azure.
Enter Nub, a new Rust-powered toolkit that takes a completely different approach. Instead of trying to replace Node.js, Nub wraps it. It brings Bun-style ergonomics and speed to your local development workflow while executing your code on the stock Node.js runtime.
The Runtime Replacement Trap
Let's be honest about why we are still using Node.js. It is not because we love configuring Babel, ts-node, or managing multiple Node versions with nvm. It is because Node is the battle-tested standard.
Reimplementing Node's massive API surface from scratch is an incredibly difficult task. On Deno's own cross-runtime Node-compatibility test suite, the gaps are clear. Deno passes 77.4% of the suite, while Bun trails at 40.5%. Nub, by contrast, hits 98.8% compatibility. Why? Because Nub does not run a custom engine. It executes your code on the exact version of stock Node.js your project specifies.
xychart-beta
title "Node.js Compatibility Score (%)"
x-axis [Bun, Deno, Nub]
y-axis "Compatibility Rate" 0 --> 100
bar [40.5, 77.4, 98.8]
Instead of building a new runtime, Nub takes advantage of Node's modern extension surfaces, which did not exist when Bun and Deno were first designed.
Specifically, Nub uses Node's --import and --require preloads alongside module.registerHooks() to intercept module resolution and transpilation. When you run a file, Nub compiles your TypeScript, JSX, or TSX in memory using Oxc, an ultra-fast Rust-based linter and parser, which is compiled into a native Node addon.
This architecture yields impressive performance. Running a TypeScript file with Nub adds virtually zero overhead compared to running plain JavaScript on Node, starting up 2.9 times faster than tsx (44ms versus 128ms).
Beyond transpilation, Nub automatically unflags experimental Node APIs like node:sqlite, vm.Module, and native WebSockets. It also injects polyfills for modern APIs like Temporal or URLPattern when running on older Node versions, and handles .env loading using Vite and Bun precedence rules before Node even starts.
The Developer Angle: Consolidation Without the Risk
For developers, Nub acts as a single binary that replaces a dozen disjointed utilities. Here is how the commands map to your existing toolchain:
| Existing Tool | Replaced By | Description |
|---|---|---|
node, tsx, ts-node, dotenv-cli |
nub <file> |
Runs TS/JS files directly with auto-env loading |
npm run, pnpm run |
nub run <script> |
Runs package.json scripts (24x faster than pnpm run) |
npx, pnpm dlx |
nubx <command> |
Executes binaries from node_modules (19x faster than npx) |
nodemon, node --watch |
nub watch <file> |
Restarts on changes using Node's native watch engine |
nvm, fnm, volta |
nub node <command> |
Manages and provisions Node.js versions on demand |
pnpm install, npm install |
nub install |
Installs dependencies using a pnpm-compatible engine |
Let's look at how Nub handles Node version provisioning. If you run nub index.ts, Nub inspects your project's configuration. It checks NODE_EXECUTABLE, package.json#devEngines, .node-version, .nvmrc, and package.json#engines in order of precedence. If the required Node version is not installed locally, Nub downloads and provisions it on the fly.
For example, if you pin Node 26:
$ echo 26 > .node-version
$ nub hello.ts
Using Node.js 26.3.0 (resolved from .node-version)
Installed in 9.8s
Hello world!
This makes onboarding new developers incredibly simple. They clone the repo, run nub install, and Nub handles both package installation (using a fast, pnpm-compatible package manager) and Node version management.
Even your CI/CD pipelines can benefit. You can swap out actions/setup-node for nubjs/setup-nub in your GitHub Actions workflows with one-to-one compatibility:
- uses: nubjs/setup-nub@v0
The Trade-offs and Caveats
While Nub is an elegant solution, it is not without risks.
First, it relies heavily on Node's ESM loader hooks (module.registerHooks()). Node's ESM implementation has been notoriously unstable over the years, and while these APIs are maturing, upstream changes in Node could still cause friction.
Second, because Nub relies on oxc for transpilation, any edge cases in oxc's TypeScript or JSX parsing will affect your runtime behavior. While oxc is incredibly fast, it is still a younger parser compared to the official TypeScript compiler (tsc).
Finally, Nub is a new entry in the ecosystem. While its local DX is fantastic, you will want to thoroughly test it on complex monorepos before throwing away your existing pnpm or npm setups.
The Verdict
Nub represents a highly pragmatic evolution in JavaScript tooling. It acknowledges that the industry is not ready to abandon the stability of Node.js, but refuses to accept the slow, fragmented developer experience that historically came with it. By decoupling the developer experience from the production runtime, Nub gives you the best of both worlds: Bun's speed and ergonomics on your laptop, and Node's production-grade reliability in the cloud.
Sources & further reading
- Show HN: Nub – A Bun-like all-in-one toolkit for Node.js — github.com
- Introducing Nub: an all-in-one toolkit for Node.js — Nub — nubjs.com
- Bun — A fast all-in-one JavaScript runtime — bun.sh
- Bun vs Node.js in 2026: Benchmarks & Migration Guide — strapi.io
- Bun vs Node.js: Everything you need to know — builder.io
Lenn writes about cloud platforms, Kubernetes internals, and the infrastructure decisions that quietly make or break engineering organizations. Based in Berlin's vibrant tech scene, they have a talent for turning dense platform-engineering topics into prose that people actually finish reading.
Discussion 2
might be the thing that finally gets me to try bun
@greybeard_unix, okay but does nub actually improve bun's numbers in a real-world setup? i'd love to see some benchmarks on a large-scale node project before getting on board