Nub: An All-in-One Rust Toolkit for Node.js
Better Stackgo watch the original →
the gist
Nub is a single Rust binary that replaces common Node.js ecosystem tools like tsx, nvm, and pnpm by augmenting stock Node.js rather than replacing the runtime.
Unified Node.js Tooling
Nub acts as a single Rust-based binary that serves as a file runner, package manager, and Node.js version manager. Unlike Bun, which provides a separate runtime, Nub operates on top of stock Node.js, ensuring flag-for-flag compatibility with existing Node.js workflows. It eliminates the need for multiple disparate tools by integrating functionality previously handled by utilities like tsx, nvm, and pnpm.
File Runner and Runtime Features
The file runner supports full TypeScript execution, including enums, namespaces, decorators, and JSX, without requiring separate transpilation steps. It automatically handles environment variable loading from .env files with support for variable expansion. Additionally, it polyfills modern APIs like Temporal and Web Workers on older Node.js versions and automatically unflags experimental features like local storage. The runner is designed to be as close to native Node.js performance as possible, with minimal overhead.
Package Management and Execution
Nub integrates a package manager that is compatible with existing pnpm and Bun lockfiles, allowing it to adopt projects without requiring a migration. It includes nubx for executing binaries directly from node_modules without spawning a Node.js process, which the author benchmarks as significantly faster than npx. The script runner also bypasses the overhead of launching the package manager's JavaScript environment, resulting in faster execution of lifecycle scripts compared to standard pnpm or npm commands. Security features include a 24-hour minimum release age for packages and a default block on execution of install scripts.