Miget Buildpacks automatically detect and build your Bun applications when you select Auto detection (Miget Buildpacks) as the build method. No configuration is required for most projects. For the full reference, visit the migetpacks Bun documentation.

Detection

Your application is detected as Bun when one of these markers is present:
  • bun.lock
  • bun.lockb
  • bunfig.toml
  • .bun-version
  • bun-types listed as a dependency in package.json

Version Detection

The Bun version is determined from the following sources, in order of priority:
  1. .bun-version file
  2. engines.bun field in package.json
If no version is specified, the latest stable version is used.

Build Process

During the build, the following steps are performed:
  1. Bun installation - The appropriate version of Bun is installed.
  2. Dependency installation - Dependencies are installed using bun install in a multi-stage build.
  3. Build script - If a build script is defined in your package.json, it runs automatically via bun run build.
  4. Caching - Dependencies are cached between builds to speed up subsequent deployments.

Run Command

The entry point is auto-detected by checking for the following files, in order:
  1. index.ts
  2. index.js
  3. src/index.ts
  4. src/index.js
You can override the run command by defining a web process in a Procfile at the root of your repository, or by setting a start script in your package.json. You can also override the run command directly in the Miget dashboard when creating your app or changing the deployment source.
Builder settings showing Run Command override

Configuration

You can customize the build and runtime behavior through the Miget dashboard and repository configuration files:
  • Environment variables - Set under Settings -> Variables in the Miget dashboard
  • Procfile - Define the start command at the root of your repository
  • Project Path - For monorepo setups, specify the subdirectory containing your application code in the Advanced tab
  • Pre-Deploy Command - Run a command before deployment (e.g., database migrations) in the Advanced tab
  • Post-Deploy Command - Run a command after successful deployment (e.g., seeding data, cache warming) in the Advanced tab

Docker Hardened Images

You can enable Docker Hardened Images (DHI) in the Advanced tab when creating your app or changing the deployment source. When enabled, your application is built using distroless runtime images with a minimal attack surface, no shell, and no package manager.
Advanced builder settings with Docker Hardened Images toggle
DHI requires Bun 1.3.6 or later.
For the complete reference, see the migetpacks Bun documentation.