Tech Thoughts: I like Bun

I've been doing this web-dev thing for about 12 years now. I'm primarily self-taught, so I wouldn't classify myself as any degree of "good programmer", but after 12 years that amounts to enough burned fingers that I know how to operate the oven pretty well.

It's always felt kinda illegal to run Javascript server-side. I know Node's been around for a thousand years at this point, but when I began writing websites in the jQuery days Javascript was dirty.

It still is, but I feel like after ES2015 things got a lot better. Also, since the declarative UI revolution I write wat more Javascript than I do other languages -- so much so that at some point it became my native tongue over the Python I was raised on.

And why not? Javascript is everywhere. No other language is so readily at your fingertips -- just open the web inspector of any browser and you're ready to sling code, transform some data, or test a Regex. Nowadays JS ships with a ludicrous amount of built-in functionality as well -- everything from MIDI to WebGPU to USB interactions. Look at all this stuff!

I've always been a Python-backend kinda person. Flask, FastAPI, Django with it's various fixings -- I've been using Python server-side my whole career. But for small stuff, the microservices and simple SPAs I frequently need to assemble for work, the static-site builder for my blog, for all the little scrapers and scripts that I write on a daily basis, I'm switching to Bun .

-

Bun is a server-side Javascript runtime that kinda does everything. It's built with Zig, which is my absolute favourite programming language that I'll never have a legitimate use-case for, and it's compatible with everything Node can do (including npm packages). It can run Typescript out of the box if that's your jam, and it comes with enough built-in APIs that you can do quite a bit without ever needing to install a 3rd party library.

For example:

I don't even have a valid use-case for half of this stuff, but I'm certainly jazzed about all of them.

Basically, if you're doing anything to do with web-stuff, Bun's probably got what you need baked right in -- and if it doesn't you're just a bun install away from a decade's worth of JS libraries. Installation trivial (though it does use the much lamented pipe-a-curl-into-bash method that's become popular), and they've confidently declared themselves past version 1.0.

I've put together 4-5 microservices at work now using Bun, and it's been an absolute pleasure to work with. It has the familiarity of modern Node without the baggage that the evolution of JS has burdened Node with carrying. It feels clean and lightweight, the built-in APIs are intuitive and easy to use, and I finally feel comfortable using JS on both the front and back-ends of a project (and can even use the same types system on both for Typescript projects!)

I don't think I'm ready to stop relying on the robustness of python and Django for my larger projects, but for small forays into web-oriented development I've got a new swiss army knife.