Bun 1.0 comes out September 7th. Fly.io is making preparations.
Previously, we stated that Fly.io ❤️ JS, and we understandably started with Node.js. While that work is ongoing, it makes sense to start expanding to other runtimes.
Bun is the obvious next choice given it aims for complete Node.js API compatibility.
Starting with flyctl version 0.1.54 and @flydotio/dockerfile version 0.3.3, you can launch and deploy bun applications using fly launch
and fly deploy
,
provided:
- You’ve installed bun version 0.5.3 or later
- You have a
package.json
that meets at least one of the following conditions:- It has a
start
entry in thescripts
section. - It has a
module
entry and specifiedmodule
as thetype
. - If has a
main
entry.
- It has a
Basically, if you can run Bun’s Quickstart and Fly’s hands-on walk-through, you have all you need to deploy your application on fly.io.
We also have a sample that you can deploy.
Be forewarned that everything is beta at this point. Some issues we encountered while preparing this support:
bun install
has no--prune
option. Our Dockerfiles use this to remove development dependencies after runningbuild
. Of course with bun you are less likely to need a build step as TS and JSX are built in.throwIfNoEntry
is not supported infs.statSync
.fly-apps/node-demo
uses that.- Programs that used readline never exit. Switching to global.prompt resolved this issue for
@flydotio/dockerfile
.
Undoubtedly there will be bugs in fly’s dockerfile generator too. But as Node.js and Bun share the same generator, fixes that are made for either framework will generally benefit both.
If you see a problem, start a discussion, open an issue, or create a pull request.