Is Bun.js going to replace nodejs ? What is bun.js? Is it a bun we should eat as developer?
What is bun?
Bun is a new way to run your javascript including bundler, transpiler etc basically most of the system. It replaces babel, webpack, node and a lot of other things. In another mean it is comparable to deno but also in some other mean its not. Because bun is mostly focused on performance because it tries to fix the flaws of node design system.
How to install bun?
curl https://bun.sh/install | bash
The goal of Bun is to run most of the worlds JavaScript outside of browsers, bringing performance and complexity enhancements to your future infrastructure, as well as developer productivity through better, simpler tooling. (cc https://bun.sh/)
Note: Bun is not yet edge ready as its yet in beta 0.1
Bun.js uses the JavaScriptCore engine, which tends to start and perform a little faster than more traditional choices like V8. Bun is written in , a low-level programming language with manual memory management.
Most of Bun is written from scratch including the JSX/TypeScript transpiler, npm client, bundler, SQLite client, HTTP client, WebSocket client and more.
Basic Bun Http server
// http.js
export default {
port: 3000,
fetch(request) {
return new Response("Welcome to Bun!");
},
};
Some important data from the internet till today for a better comparison
Creating a new react-app
Creating a new react-app
Creating a Nextjs app
Let’s now compare bun
with Next.js
which uses internally rust based swc
.
If you are excited visit their website: https://bun.sh/
Github repo https://github.com/oven-sh/bun