Bun

Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.

You can easily deploy your Bun app in Zeabur.

Quick Start

Create a Bun App

You can initialize a Bun app using the following command:

mkdir bun-app
 
cd bun-app
 
bun init

Create a HTTP Server

Open index.ts and paste the following code snippet, which implements a simple HTTP server with Bun.serve.

Remember modify the port to Bun.env.PORT in your serve function to make sure the application can listen correctly on the environment variable PORT given by Zeabur.

index.ts
const server = Bun.serve({
  port: Bun.env.PORT ?? 3000, // modify the port to Bun.env.PORT
  fetch() {
    return new Response("Bun on Zeabur!");
  },
});
 
console.log(`Listening on http://localhost:${server.port} ...`);

Additionally, make sure to specify an entry point in the package.json file.

Zeabur currently supports the following file extensions as entry point: .js, .ts, .tsx, .jsx, .mjs, .mts, .cjs, or .cts.

package.json
{
  "name": "bun-app",
  "module": "index.ts", // let zeabur know where to start
  "type": "module",
  // ...
}

Detection

Zeabur will automatically recognize your application as a Bun app. Ensure that you have a bun.lockb file in the root directory of your project.

root
├── bun.lockb
├── index.ts
└── package.json

You can install bun-types into your project if you prefer not to commit the bun.lockb file to your repository.

package.json
{
  "devDependencies": {
    "bun-types": "latest"
  }
}

Deploy

Click on Git button.

Search for your Bun app repository, click on import, your Bun app will start deploying.

deploy

Ecosystem

Bun has a strong ecosystem, allowing you to build applications using various frameworks such as Astro, Nuxt, SvelteKit, ElysiaJS, and more.

You can deploy these applications and use Bun as your runtime or package manager.

Learn more about Bun - Ecosystem (opens in a new tab).