Skip to content

Run on Bun: bun install, bun --bun next, standalone server under Bun - #2

Merged
ralyodio merged 1 commit into
mainfrom
chore/bun-runtime
Oct 1, 2026
Merged

ralyodio merged 1 commit into
mainfrom
chore/bun-runtime

Conversation

@ralyodio

@ralyodio ralyodio commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Part of the fleet Node → Bun migration. This applies the recipe from the phonenumbers.bot pilot (profullstack/phonenumbers.bot#12).

Changes

  • Package manager: bun.lock replaces pnpm-lock.yaml, and packageManager is now bun@1.4.0. I dropped the engines.node >=24 pin.
  • Runtime: the scripts now call bun --bun next. bun test src/lib runs the existing node:test suites unchanged, and all 9 pass.
  • next.config: adds output: "standalone" and pins outputFileTracingRoot. The OG and Twitter cards read the Geist font from node_modules at request time, so it is listed in outputFileTracingIncludes. Without that entry, the standalone build would silently fall back to the default font.
  • Image: .nixpacks/Dockerfile is the path dev2's compose stack builds. It is now a hand-written oven/bun:1.4.0-slim multi-stage build that runs bun server.js as the non-root bun user. The HEALTHCHECK probes /healthz on 127.0.0.1. I removed the nixpacks .nix and build.sh. Port 3000, the env vars and /healthz are unchanged, and the compose stack passes no build args.
  • CI: setup-bun, then a frozen install, test, typecheck and build, then the standalone server is booted under Bun.

Verified locally

I built the image from git archive HEAD through a compose file shaped like dev2's (same dockerfile path, env block, 1 GiB limit and port map).

  • /healthz, /robots.txt, /sitemap.xml, /opengraph-image and /twitter-image are byte-identical to the live Node site.
  • / and /privacy have the same content. Their bytes differ only in module ids and RSC chunking, and / varies anyway because of the A/B hero.
  • The cookies (session, variant, first touch) are set as before. A malformed events POST returns 400, CSS returns 200, and /_next/image returns 200.
  • docker top shows bun server.js. The container is healthy, used about 114 MiB, and stops on SIGTERM in 1.8 s.

🤖 Generated with Claude Code

Part of the fleet Node -> Bun migration, following the phonenumbers.bot pilot.

- Package manager: bun.lock replaces pnpm-lock.yaml; packageManager bun@1.4.0.
  The engines.node >=24 pin is dropped: nothing runs on Node any more.
- Runtime: scripts use `bun --bun next`, so Next builds and serves on Bun.
  `bun test` runs the existing node:test suites unchanged (9 pass).
- next.config: output standalone with the tracing root pinned to this
  directory, and the Geist font the OG/Twitter cards read from node_modules at
  request time named in outputFileTracingIncludes so standalone ships it.
- Image: .nixpacks/Dockerfile (the path dev2's compose stack builds) is now a
  hand-written oven/bun:1.4.0-slim multi-stage build running `bun server.js` as
  the non-root bun user. The nixpacks .nix and build.sh are gone. Port 3000,
  env and the /healthz health path are unchanged.
- CI: setup-bun, frozen install, test, typecheck, build, boot the standalone
  server under Bun.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​types/​react-dom@​19.2.5 ⏵ 19.3.0100 +110075 +192100
Updated@​types/​react@​19.2.18 ⏵ 19.3.01001007992100
Updated@​types/​node@​24.13.3 ⏵ 24.19.010010081 +196100

View full report

@ralyodio
ralyodio merged commit cfb6fa1 into main Oct 1, 2026
3 checks passed
@ralyodio
ralyodio deleted the chore/bun-runtime branch October 1, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant