vohzd.com

Getting Started with Bun

2 min read

Why Bun?

I switched to Bun a couple of years ago and haven't looked back. It's a JavaScript runtime like Node, but it ships with a package manager, test runner, and bundler all baked in, and it runs TypeScript natively. No compilation step, no ts-node, no config files. Just write .ts and run it.

Installation

curl -fsSL https://bun.sh/install | bash

That's it. One line. If you're on a Mac you can also brew install oven-sh/bun/bun, but the curl script works everywhere.

Getting a project going

bun init
bun add nuxt
bun run dev

No npx create-whatever. No scaffolding wizards. Just init, add what you need, and go. I use this pattern for everything now: Nuxt apps, Hono APIs, CLI scripts, the lot.

What makes it worth switching

  • Speed: bun install is absurdly fast. We're talking seconds, not minutes. Once you've felt that, going back to npm feels painful.
  • Native TypeScript: run .ts files directly. No transpilation, no tsx, no ts-node. It just works.
  • SQLite built in: bun:sqlite is a first-class citizen. I use it for all my local-first apps. No external dependencies, no drivers, just import and query.
  • Drop-in Node replacement: most of the Node ecosystem works out of the box. I've had very few issues running existing projects.

Where it falls over

It's not perfect. Some native Node modules don't compile properly, and there are edge cases. I've had to pin Bun to a specific version before because a minor release broke Nuxt's IPC layer. The ecosystem is still catching up in places.

But for web development (APIs, frontends, scripts, tooling) it's rock solid. The speed alone makes it worth the switch, and the developer experience is genuinely better. I can't see myself going back to Node for new projects.