For the last few months I’ve been using a new would-be node.js replacement called bun. (Yes, it’s hard to google because bun is not a unique word.) As of writing, bun has just turned v0.5.0. It’s not ready for production, but it’s plenty ready for development.

What is bun?

bun.js is a javascript runtime that’s intended to be a drop-in replacement for node.js, but with a few key differences:

  • much much faster
  • runs TypeScript “natively”
  • transpiles, bundles, and serves your code (including hot reloading)

In a nutshell, the idea is that you can write replace npm or npx with bun and everything works faster, but even more nicely you can write bun dev and it will host your /public directory (by default, or whatever path you specify) with hot reloading and on-the-fly typescript transpilation.

Effectively, you can code in TypeScript just as effortlessly as you could otherwise code in vanilla javascript.

Which is why I’ve been using it.

What have I been doing with bun?

bun dev lets you run your TypeScript code directly and debug it in the browser.

I’ve already posted about my progress with xinjs. I owe a lot of this rapid progress to the fact that I’ve been able to code in TypeScript using bun as effortlessly as I previously was able to work in vanilla javascript. I’ve even hacked together my own hot reload support.

So, I really like bun. It’s great. Give it a try!