Source linked

Nub Delivers 24x Faster npm Run in a Bun-Style Node.js Toolkit

github.com@mild_koala2 hours ago·Developer Tools·2 comments

Nub augments Node.js with a Rust-based CLI that runs TypeScript, manages Node versions, and accelerates common tasks like npx and pnpm install by up to 19x.

nubnodejstypescriptrustdeveloper toolsbun

Nub claims 24x faster script runs than pnpm run and 19x faster than npx, all without replacing the Node.js runtime. That benchmark alone makes you look twice.

What Nub Actually Does

Nub is a Rust-written CLI that wraps stock Node.js with a Bun-like developer experience. It runs .ts, .jsx, .mjs files directly - no build step. It handles nub install (2.5x faster than pnpm install), nub run (24x faster), and nubx (19x faster than npx). It also replaces nvm/fnm for Node version management (nub node install 26). The whole thing is one binary installable via curl or npm.

Crucially, Nub doesn't ship a separate runtime. It hooks into Node through extension surfaces that largely didn't exist when Bun and Deno were built: --import/--require preloads, module.registerHooks() for transpilation and resolution, and N-API native addons. The oxc transpiler is embedded for that TypeScript/JSX compilation.

How It Gets That Speed

The performance wins come from three places. First, the runner is a Rust binary with zero JavaScript startup cost - no Node bootstrap for the package manager itself. Second, Nub aggressively caches dependency resolution and uses a tracked dependency graph for its watch mode, avoiding globs. Third, it auto-installs the exact Node version your project expects (from .node-version, engines, etc.) and runs your code against that, unflagging experimental APIs like node:sqlite, ShadowRealm, and WebSocket automatically.

Benchmark numbers from the README: nub run dev is 24x faster than pnpm run, nubx prisma generate is 19x faster than npx prisma generate, nub install is 2.5x faster than pnpm install. Startup speed alone is 2.9x faster than tsx.

Who Should Care

Anyone running TypeScript in Node.js projects daily - the 24x speedup on script runs alone recovers lost time waiting for pnpm run dev or npx prisma generate. The Node version manager integration eliminates another tool. The polyfill layer for modern APIs (Temporal, URLPattern, EventSource) means you can write code targeting Node 26 today even if your deployment uses Node 22.

Nub is open source (Apache 2.0) and already has 1.5k stars and 919 commits. If it delivers on those benchmarks at scale, it could become the default CLI for Node.js projects.


Source: Show HN: Nub - A Bun-like all-in-one toolkit for Node.js
Domain: github.com

Read original source ->

External source stays available while the OJO article and comment thread stay local.

Comments load interactively on the live page.