How to Make Node.js Fast and Convenient Without Switching to Bun
Bun and Deno engines have reimagined the familiar JS development experience. Native TypeScript support, instant test launching, and a reactive package manager set a new quality bar. However, not everyone is ready to migrate their actual production to a new runtime. Specific C++ addons, nuances of module behavior, and accumulated legacy keep most projects on classic Node.js.
The Nub project team decided to take a different approach. Instead of creating another isolated runtime, they wrote a utility in Rust that supercharges standard Node.
What's the idea
Developers often load their projects with a dozen utilities: 4 or 5 for running TypeScript, 6 or 7 for Node.js version management, 8 for packages, and 9 for environment variables. As a result, launching any script incurs hundreds of milliseconds of delay before your code even starts executing.
Nub combines all these functions into a single Rust binary. The tool acts as a transparent layer between the developer and Node.js. V8 and standard modules remain unchanged inside, but all the surrounding tooling works at compiled code performance.
0Running TypeScript and automatic version selection
The 10 command executes 11, 12, 13, 14, 15, and other formats without any build tool configuration.
Under the hood, it uses the fast Oxc Rust parser. For transpilation and correct path resolution (including 16 and imports without extensions), Nub leverages modern Node.js extension points: 17 preload and the 18 mechanism.
An interesting aspect relates to version management. When launching a file, Nub checks for 19 files, 20, or the 21 section in 22. If the required Node version isn't available locally, the utility downloads it to cache and executes the code through it.
1Nub also automatically removes experimental flags for newer Node.js features. Working with 23, 24, or 25 works immediately without needing to specify CLI flags.
Accelerating scripts and launching binaries
Every time 26 or 27 is called, a full Node.js process starts just to read 28 and invoke the appropriate shell script. Waiting for the JS environment to initialize creates a noticeable bottleneck.
Since 29 is written in Rust, there's no JavaScript initialization phase. Scripts are picked up instantly.
In the developers' benchmarks, hot launching a script through 30 takes about 14 milliseconds. For comparison, 31 has this at around 330 milliseconds, and 32 exceeds 440 milliseconds.
The 33 utility works similarly, replacing 34 and 35. When calling a binary from 36, it doesn't create an extra intermediate Node.js process, making it approximately 19 times faster than 37.
2If a package isn't available locally, 38 downloads it from the registry, executes it, and removes the temporarily created files.
Package manager and Corepack support
The 39 command handles dependency fetching. It's built on the Aube engine, which can work in compatibility mode with existing lock files.
If you enter a project with 40, Nub respects pnpm settings, reads 41, and builds the dependency graph without conflicts. The same applies to projects with 42 or 43.
Several security features when installing packages:
- Automatic blocking of 44 scripts by default.
- Package version checking against the osv.dev vulnerability database during graph resolution.
- Minimum release age restriction of 24 hours to protect against supply chain attacks.
For working with multiple package manager versions, the 45 command is available. It creates global shims for 46, 47, and 48. This is a useful replacement for Corepack, which was removed from Node.js starting with version 25.
Practical usage
The tool doesn't require changing your project structure or abandoning your existing infrastructure. You can install it globally and use it only for quick debugging or running local CLI utilities.
3In GitHub Actions pipelines, the standard 49 is replaced with 50. This provides a consistent interface and accelerates build step execution through fast caching and dependency installation.
The bottom line
Nub turns out to be a solid compromise for teams that appreciate Bun's convenience but face technical constraints preventing them from leaving Node.js. The utility consolidates a scattered collection of CLI tools, accelerates everyday commands, and doesn't force you to rewrite a single line of code.
The project is quite new but has already accumulated around 3.8k stars on GitHub. It's worth trying out at least for instant 51 execution and convenient auto-downloading of the required Node.js versions.
Related projects