The role of Node.js today.
What about Deno?
Maybe you’ve got heard a few Node.js competitor, released in 2020, named Deno. it’s also using Google’s V8 engine but is using an own package manager, which isn’t compatible with NPM packages. But it definitely has its strengths. Deno has sand boxing features, supports TypeScript out of the box and a solid collection of normal packages. Nevertheless, Deno has not yet been considered a true Node.js competition. the most important disadvantage is that the loss of the 1.5 million node packages. At the instant, there are only ~5000 Deno modules available. And there’s nothing else out of the normal that has convinced many users to think about Deno as a solid alternative to Node.js.
Bun has entered the chat.
Bun is out there publically beta since early July 2022. But I’ve been a part of the closed beta already for quite few months. And yes, even in its beta, it makes JS development much faster and far more fun compared to Node.js. But that’s not simply because of its fastness. Bun is additionally a NPM client. it’s compatible with almost every npm package. you almost certainly understand how annoying it’s to attend for npm install to end. the answer is easy, with Bun you’ll not experience this. within the projects I tested it on, it had been often 2x faster than npm i and 1.6x faster than yarn.
Bun’s biggest strength is that the performance gain while still supporting the bulk of NPM packages.
How to test Bun? — Create a React app with Bun
1.Install bun on mac (M1, x64), Linux (x64) or in WSL
curl https://bun.sh/install | bash
Always check script source before executing.
2.Create a new react project
bun create react ./bun-react-playground
3.Start the react app
It took me 1182.02ms combined to create the project and run the dev server.
Check out the documentation and official website.
Is this the top of Node.js?
Not yet — it’s great to play with for private projects, but it’s not for businesses yet. there’s still a protracted journey, but I hope that more people use Bun as an alternate to Node.js within the future, so it gets the needed stability and support. Its performance and features are just on another level. My personal highlights are the following:
- Bun automatically loads .env files
- TypeScript & JSX just work (even .tsconfig support)
- Web APIs like fetch & WebSocket are built-in (bye bye node-fetch
I use Bun for a few of my personal projects and that i enjoy it such a lot. there’s still some polishing work to try and do, but it’s already extremely stable and also the compatibility has been great on behalf of me to date. the sole thing I still need to use Node.js for is NestJS development because the NestCLI is using the node executable and there are some general issues.