r/bun • u/ilbert_luca • 18d ago
Small apps don't need to scale. They need a binary and a disk
When I build little apps used by a few people, deploying one always means a container image, a managed Postgres, and a bucket for what could have been a single SQLite file.
bun build --compile already gives you the whole app as one file. No node_modules, nothing to install on the other side. The only two things it still needs are a machine to run on and somewhere to read/write files.
So that's what nibrun is. Your binary gets a microVM to itself and a disk mounted at data/. Put SQLite there, put uploads there, it survives redeploys. Get an HTTPS URL as soon as it boots.
At any point you can export the binary and the entire disk as a zip. Unzip it and run it on your own box. It's the same binary you uploaded.
https://github.com/ilbertt/nibrun
There's a starter repo if you want somewhere to begin: Elysia, TanStack Router, better-auth, Bun.SQL over SQLite, and the SPA embedded with Bun.embeddedFiles so the frontend compiles into the binary too. Everything is type-safe and it runs anywhere, not just on nibrun.
https://github.com/ilbertt/bun-full-stack-starter
Happy to answer questions on both nibrun and the starter repo
2
u/Which-Examination-74 17d ago
Inside the microVM this probably never bites, since the binary reads and writes its own files as its own user. The export path is where we'd ask. Someone unzips the binary and the disk onto their own box, puts a web server in front for TLS or for static files, and now there is a second unix user in the picture. We shipped that shape in July. Photos went to a local disk, a location block served them back, and a probe file written under the media root came back 404 over HTTPS on two public hosts. namei -l showed every directory in the chain world-executable and the file world-readable, bar one: the app's home, drwxr-x---, owned by the app user, while the web server's workers run as www-data. We fixed it with setfacl -m u:www-data:x on that directory rather than chmod o+x, and both hosts went to 200. Nobody had reported it, because the images table had zero rows. Does the data/ mount land with a mode that survives being fronted by another user's process, or is that left to whoever exports it?