Docs menu

Bun

Deploy Bun apps on Primcloud: lockfile-based detection, exact version pinning, frozen installs, build scripts, and a default web process.

On this page

Primcloud deploys apps that run on Bun. Detection triggers when Primcloud finds a package.json at the root of your repo together with a Bun marker: a bun.lock or bun.lockb lockfile, a bunfig.toml, a .bun-version file, or a packageManager field naming bun@…. A package.json with none of those is a Node.js app.

The Bun version is resolved from .bun-version, the packageManager field, or engines.bun. Dependencies install from your lockfile with bun install --frozen-lockfile, your package.json build scripts run, and packages your lockfile doesn't list are pruned from node_modules.

With no Procfile, the default web process is bun run start when package.json declares a start script, otherwise Bun run against a root entry file: server.js, index.js, server.ts, or index.ts.

Bun also works as the asset builder for Ruby, PHP, and Rust apps: commit a bun.lock beside their package.json and Bun installs and builds the frontend. A web line in the app's Procfile always decides what serves it. See Bun as the asset builder for other languages.

What's in this section#

  • Getting started with Bun: deploy a minimal Bun web app end-to-end.
  • Bun on Primcloud: detection, install, build scripts, pruning, and how the default web process is chosen.
  • Runtime versions: pinning a Bun version with .bun-version, packageManager, or engines.bun, and upgrade path.
  • Package managers: bun install, lockfile requirements, private registries, and Bun as the asset builder for other languages.
  • Customizing the build: build hooks (heroku-prebuild, heroku-build, heroku-postbuild), pruning, and Debian packages via project.toml.
  • Troubleshooting Bun: common build and runtime errors with fixes.