---
title: "Fly.io ❤️ Bun"
description: "Running Bun applications on Fly.io"
---

# Fly.io ❤️ Bun

![A ballon and the Bun logo having a picnic lunch](https://fly.io/blog/flydotio-heart-bun/assets/flydotio-heart-bun-cover.webp)

[Annie Ruygt](https://annieruygtillustration.com/)

[Bun 1.0 comes out September 7th](https://lu.ma/cqk31rvl). Fly.io is making preparations.

Previously, we stated that [Fly.io ❤️ JS](https://fly.io/blog/flydotio-heart-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](https://bun.sh/docs/runtime/nodejs-apis).

Starting with [flyctl](https://fly.io/docs/hands-on/install-flyctl/) version 0.1.54 and [@flydotio/dockerfile](https://www.npmjs.com/package/@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 the `scripts` section.
  - It has a `module` entry and specified `module` as the `type`.
  - If has a `main` entry.

Basically, if you can run [Bun’s Quickstart](https://bun.sh/docs/quickstart) and [Fly’s hands-on walk-through](https://fly.io/docs/hands-on/), you have all you need to deploy your application on fly.io.

We also have a [sample](https://github.com/fly-apps/bun/) 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](https://github.com/oven-sh/bun/issues/3605). Our Dockerfiles use this to remove development dependencies after running `build`. Of course with bun you are less likely to need a build step as TS and JSX are built in.
- [`throwIfNoEntry` is not supported in `fs.statSync`](https://github.com/oven-sh/bun/issues/1579). [`fly-apps/node-demo`](https://github.com/fly-apps/node-demo) uses that.
- Programs that used [readline](https://nodejs.org/api/readline.html) [never exit](https://github.com/oven-sh/bun/issues/3604). Switching to [global](https://bun.sh/docs/api/globals).[prompt](https://developer.mozilla.org/en-US/docs/Web/API/Window/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](https://community.fly.io/), [open an issue](https://github.com/fly-apps/dockerfile-node), or [create a pull request](https://github.com/fly-apps/dockerfile-node/pulls).
