building-collatr

Choosing Bun over Node.js

We needed a runtime that could compile to a single binary, run on ARM64, and start in under a second.

Bun passed every test.

Five spikes. SQLite: 613,000 rows per second in batch inserts, no native dependencies. Single binary: 98MB, 27ms cold start. OPC-UA: the library dropped its native C++ addons in v4, so it runs pure JS. ARM64 cross-compilation: one flag.

The Modbus library needed a workaround. Its serial port binding breaks compilation, but we only use TCP. One external flag solved it.

The decision framework was simple. Run the spikes. Set pass/fail criteria in advance. If Bun fails, pivot to Node.js entirely. No hybrid approaches.

It passed. We moved on.

The spike code is still in the repo. Every decision has a paper trail. When someone asks “why Bun?” six months from now, the answer is there.