By Bikram Gupta and Dinesh Murthy
The JavaScript ecosystem is rapidly evolving to meet the growing performance and integration demands of modern, AI-driven applications. Bun is a popular framework for developers that offers an all-in-one runtime, bundler, and package manager and is considered a drop-in replacement for Node.js. With its faster startup times and lower memory usage than traditional runtimes, Bun is a top request from our customers.
Today, we’re excited to announce native Bun support on DigitalOcean App Platform. Now, you can deploy Bun applications directly from your code repository without writing a single line of configuration. App Platform’s Cloud Native Buildpacks will automatically detect, build, deploy and run your Bun apps.
Performance: Bun is a modern, high-performance JavaScript runtime with integrated tooling, optimized for fast startup and efficient execution.
Zero Configuration: You don’t need to maintain a Dockerfile. Just push your code into your git repo, and we’ll handle the runtime setup.
Seamless Next.js Support: Bun works natively with Next.js, allowing you to deploy your full-stack React applications with the same ease.
App Platform supports three distinct workflows as part of deployment.
Cloud Native Buildpacks (The “Code-First” Way): You simply connect a GitHub, GitLab, or Bitbucket repository. We analyze your code, detect the language, and build it automatically.
Dockerfiles: You include a Dockerfile in your repo. We detect it and build the image according to your instructions.
Pre-Built Images: You build the container image locally and push it to the DigitalOcean Container Registry (DOCR). We deploy exactly what you pushed.
If you’re new to Bun, getting started is straightforward. Bun is designed to be a drop-in replacement for Node.js, meaning you can often use your existing code and package.json with minimal changes.
# Install via curl
curl -fsSL https://bun.sh/install | bash
# Install dependencies
bun install
# Run your dev script
bun run dev
Once you’ve initialized your project locally and made sure it is working, App Platform identifies it as a Bun application. Our build system looks at your repository’s root directory to determine the correct runtime.
Detection: App Platform confirms if you are using Bun if it detects this specific lockerfile in your repository:
bun lock
Once detected, the buildpack takes over:
Install: Runs bun install to fetch dependencies. (Note: If your bun.lock hasn’t changed, App Platform re-uses the cached node_modules to speed up the build).
Build: Runs bun run build. You can override this by defining a build_command in the App Spec. To run actions before or after dependencies install, you can also use digitalocean-prebuild and digitalocean-postbuild package.json scripts.
Start: Defaults to bun run start to launch your application.
The bun version is selected in the following order:
From the BUN_VERSION environment variable.
From .bun-version file.
From .runtime.bun.txt file.
If no version is specified, it uses the latest version from Bun’s GitHub Releases. App Platform will cache your Bun and Node versions to ensure faster subsequent builds unless you change the requested version.
If you choose to convert an existing Node.js application on App Platform to use the Bun runtime, the process is simple. You don’t need to change application code, just project metadata.
Step 1: Remove Node Artifacts. Delete your package-lock.json (or yarn.lock). This tells App Platform “stop treating this as a standard Node app.”
Step 2: Generate Bun Artifacts. Run bun install locally. This generates the bun.lock file.
Step 3: Push Changes. Commit these changes to your repository. When App Platform sees the new commit, it will drop the Node buildpack and pick up the Bun buildpack automatically.
If you intend to use Bun as your package manager but Node.js as your runtime, Node.js will be installed in the following scenarios:
package.json. Update your package.json as follows:JSON
{
"packageManager": "bun@1.2.0"
}
package.json contains node, like this:JSON
{
"scripts": {
"start": "node src/index.js"
}
}
engines section of package.json, as follows:JSON
{
"engines": {
"node": "23.x"
}
}
You can deploy Next.js applications as well on App Platform with bun runtime. If you are deploying a Next.js project (including those using ISR), you must update your scripts to explicitly use the Bun runtime for the build and dev processes.
Update your package.json as follows:
JSON
{
"scripts": {
"dev": "bun --bun next dev", //or remove this line, as app platform uses the build script
"build": "bun --bun next build"
}
}
This ensures that Next.js utilizes Bun’s runtime features correctly during the build process on App Platform.
Native Bun support in DigitalOcean App Platform is available in all regions today.
New App? Just link your GitHub repo containing a bun lock file.
Existing App? Switch your package manager and push the update to trigger a new build.
Check out the official Bun Buildpack documentation for advanced configuration options.
Try App Platform and get $200 of credit to use over 60 days!