Shipping a Node.js server as a native desktop app with Tauri and Bun
I have a small Node server — Express, a WebSocket hub, about 2,000 lines. It's a LAN file-transfer tool called MeghXL . Running it means cloning a repo, npm install , npm start . That's fine for me and a wall for everyone else. I wanted a double-clickable app for macOS, Windows and Linux, where the user has no idea Node exists. Here's what that actually took. Why not Electron Electron would have been the boring answer, and boring answers are usually right. It bundles Node, so the server just runs in the main process. No sidecar, no IPC puzzle. I went with Tauri for one reason: size. My finished installers are 28–41 MB. The Electron equivalent starts around 150 MB before I've written anything, because it ships Chromium. For a tool whose pitch is "small enough to audit in an evening", handing people a 150 MB download undercuts the whole argument. The cost is that Tauri is Rust and uses the OS webview, so the Node server can't live inside it. It has to be a separate process. The sidecar Tauri has a mechanism for this: externalBin . You give it a binary, it bundles it, and your Rust code spawns it. { "bundle" : { "externalBin" : [ "binaries/meghxl-server" ] } } The catch: it must be one file. A server.js plus a node_modules tree is not a binary. Compiling Node to a single executable Three options, and the differences matter: pkg — the classic answer, now archived and unmaintained. Node SEA (single executable applications) — official, but fiddly with CommonJS across many files. bun build --compile — one command, and it cross-compiles. Bun won: bun build ./server.js \ --compile \ --target = bun-darwin-x64 \ --outfile meghxl-server-x86_64-apple-darwin That produces an 82 MB self-contained executable in about half a second. It runs Express, ws , multer and mDNS discovery with no runtime installed. The thing that made this work at all: all seven of my runtime dependencies are pure JavaScript. No native addons. If one of them had shipped a .node binary, the whole approach wou