Cloud & deploymentCloud deployment decisions

Cloud deployment decisions

Decide whether Bun is the runtime, build tool, or package manager on the target platform

Last updated on

Ask one question first

“Supports Bun” may only mean that a platform can run bun install; it does not guarantee that Bun handles production requests. Identify the build environment and the request runtime separately.

TargetBun's actual roleRecommended entryMain boundary
Docker / Cloud Run / ECS / KubernetesReal runtime inside a containerbun run src/index.tsHonor the platform port, signals, probes, and limits
AWS Lambda containerBun plus Lambda Web AdapterContainer imageAdapt the event model; Bun's guide uses PORT=8080
Vercel FunctionsBun runtime (bunVersion)Supported framework entryBun.serve is unsupported; Next.js still bundles with Turbopack/Webpack
Cloudflare WorkersPackage manager and local toolingbunx wrangler deployProduction runs on workerd; do not assume Bun.* exists
Static site / CDNBuild toolbun run buildProduction serves artifacts, not a Bun process

Local success is not platform compatibility

A successful bun run dev only validates the local toolchain. Acceptance on the target runtime must cover startup, networking, filesystems, native dependencies, signals, timeouts, and scaling.

Pick a path

Platform guides

Platform-independent release gates

  1. Pin Bun or use a controlled version range, and commit bun.lock.
  2. Build production dependencies with bun install --frozen-lockfile --production.
  3. Run type checks, tests, and smoke tests in the production image.
  4. Run as a non-root user and treat local state as replaceable.
  5. Give readiness, liveness, and startup probes distinct meanings.
  6. Inject credentials from a secret manager; never bake them into images, logs, or agent context.
  7. Test SIGTERM, rolling deployment, rollback, and migration ordering.

Official references: Bun Docker guide, Bun deployment guides, and Cloudflare Wrangler.