Skip to content

build: run the apps, scripts, and tests on Node instead of Bun - #296

Merged
adelrodriguez merged 3 commits into
mainfrom
build/run-on-node
Nov 12, 2026
Merged

adelrodriguez merged 3 commits into
mainfrom
build/run-on-node

Conversation

@adelrodriguez

@adelrodriguez adelrodriguez commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

The template still ran every application, script, and test on Bun, even though no code calls a Bun API anymore. This PR switches the runtime to Node 26. Bun stays the package manager until #278, so bun install and bun run don't change.

Closes #287

What changed

  • Node runs TypeScript directly. Node 26 strips types, so apps/worker, the seed and reset scripts in packages/database, packages/backend/scripts/generate-schema.ts, and the template commands run as node <file>.ts. drizzle-kit and turbo generate drop bun --bun.
  • apps/api loads through @oxc-node/core. The email templates that apps/api imports from @v1/email use JSX, and Node doesn't compile JSX. The scripts are node --import @oxc-node/core/register --watch src/index.ts for dev and the same without --watch for start.
    • I tried tsx first, which Hono's Node starter uses. It compiled password-reset.tsx with the classic transform, so the password reset email failed with React is not defined. tsx ignores the tsconfig of imported workspace packages (privatenumber/tsx#696). oxc-node compiles each file with the tsconfig of the workspace that owns it.
    • packages/email/tsconfig.json now sets "jsx": "react-jsx". The shared internal-package.json keeps preserve for the packages that bundlers compile.
  • apps/app uses the Nitro node-server preset. start runs node .output/server/index.mjs. I removed the leftover optimizeDeps.exclude: ["bun"].
  • Types. Every workspace lists @types/node in place of @types/bun, and every tsconfig sets "types": ["node"]. Bun's types allowed calling resolve() from Promise.withResolvers<undefined>() without an argument, and Node's types don't, so four tests now signal with withResolvers<boolean>() and resolve(true), as packages/storage already does.
  • Template commands. Node doesn't try extensions or index files when it resolves imports. scripts/codemods/add-import-extensions.ts adds them to the 20 extensionless imports in scripts/, and the root tsconfig allows .ts imports.
  • apps/mobile. scripts/codegen.ts is now codegen.mts, because the workspace stays CommonJS for Expo, and Node warned on every run otherwise.
  • Knip. Without bun --bun, Knip recognizes vite build --config vite.renderer.config.ts in the env:scan:build script of apps/desktop. It then loads that config from the repository root, where Varlock can't find PORT. apps/desktop now sets vite: false, like apps/app, and lists src/renderer/main.tsx as an entry.
  • Recipe and docs. The bull-board recipe imports serveStatic from @hono/node-server/serve-static, like bull-board's Hono example. The docs describe Node as the runtime, and the connect-backend skill runs its commands with node --eval.

Verification

I ran these checks against the Docker Compose services. Anything that writes rows ran against a scratch database.

  • bun run check, bun run analyze, bun run build, and bun template doctor pass. bun run test --force passes 23 of 23 tasks with none cached.
  • A temporary Bun.file("x") fails bun run check with Cannot find name 'Bun'.
  • apps/api:
    • start serves requests. After a sign-up, a password reset request delivered "Reset your v1 password" to Mailpit with the rendered HTML and the reset link.
    • With dev running, touching password-reset.tsx restarted the server.
    • SIGTERM shuts it down cleanly.
  • apps/worker: dev and start log Worker started, and both exit cleanly when SIGTERM reaches the Node process.
  • apps/app:
    • dev serves the app.
    • build writes a node-server output. start redirects / to /sign-in, which returns 200.
    • preview --port 3001 serves the app too.
  • packages/database: migrate, generate, seed, reset, and Studio run.
  • generate:auth regenerates schema.generated.ts with no diff. Mobile codegen:i18n runs without the module-type warning, and desktop env:scan:build passes.
  • No package.json script starts a process with bun --bun, bun --watch, or bun <file>, and no workspace lists @types/bun.

I haven't run the bull-board recipe end to end, and I haven't seen CI run on this branch yet.

bun run preview in apps/app serves on port 3000 while BASE_URL points at 3001, so server-side requests fail and the page returns 500. main does the same with the Bun preset, so I'll file it separately.

🤖 Created with Claude Opus 5.5 in Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Broad runtime swap across API, app SSR, worker, and database scripts affects local dev and deployment; the API’s oxc-node JSX loader is a new dependency on correct email rendering at runtime.

Overview
Switches the monorepo runtime from Bun to Node 26 while Bun stays the package manager (bun install, bun run). Application and worker dev/start scripts now invoke node instead of bun --bun or bun --watch.

Server and app targets: apps/api and apps/worker run TypeScript entrypoints under Node; the API loads through @oxc-node/core/register so JSX email templates from @v1/email compile (with jsx: react-jsx on that package). apps/app drops the Bun Nitro preset for node-server, uses plain vite for build/dev, and starts production output with node .output/server/index.mjs.

Types and tooling: Workspaces replace @types/bun with @types/node and set "types": ["node"] in tsconfigs. Root and scripts/ gain explicit .ts import paths plus allowImportingTsExtensions, with a new add-import-extensions codemod. Several tests change Promise.withResolvers<undefined>() to boolean resolvers so they type-check under Node.

Other script and config updates: Database/backend/template scripts and root scripts/template commands run via node. Mobile codegen:i18n becomes codegen.mts. Knip treats apps/desktop like other apps (vite: false, renderer entry). Docs, connect-backend skill examples, and the bull-board generator recipe are updated for Node (serveStatic from @hono/node-server, node --eval where applicable).

Reviewed by Cursor Bugbot for commit fe36f93. Configure here.

adelrodriguez and others added 3 commits November 11, 2026 19:27
…un template commands

Node's ESM resolver does not try extensions or index files the way Bun
does, so `node scripts/index.ts` failed with ERR_UNSUPPORTED_DIR_IMPORT.
scripts/codemods/add-import-extensions.ts rewrites the 20 imports, and the
root tsconfig now allows importing .ts extensions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- apps/api runs `node --import @oxc-node/core/register`, because the email
  templates it imports from @v1/email use JSX. tsx would compile them with
  the classic transform, since it ignores the tsconfig of imported
  workspace packages (privatenumber/tsx#696).
- apps/worker, the database scripts, the backend schema script, and the
  template commands run TypeScript directly with `node`.
- apps/app builds with the Nitro node-server preset and starts with node.
- Every workspace uses @types/node in place of @types/bun, so a new `Bun.*`
  call fails `bun run check`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bull-board recipe serves its UI with `serveStatic` from
`@hono/node-server/serve-static` in place of `hono/bun`, and the
connect-backend skill runs its one-off commands with `node --eval`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v1 Ready Ready Preview Nov 11, 2026 11:29pm UTC
v1-docs Ready Ready Preview Nov 11, 2026 11:29pm UTC

Request Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes across the Node runtime migration, workspace types, template commands, and supporting tooling.

  • Application runtimes: API uses the OXC loader for email JSX, worker runs TypeScript directly, and app SSR targets Nitro’s Node server.
  • Scripts and generators: Database, backend, mobile codegen, and template commands use Node-compatible execution and imports.
  • Types and tests: Node types replace Bun types, with explicit values for test synchronization promises.
  • Tooling and recipes: Desktop Knip entries, bull-board static serving, documentation, and backend-connection instructions reflect the migration.

Validated on Node 26.13.1: full bun template doctor, uncached tests (23/23 Turbo tasks), email JSX rendering through the API loader, and production SSR redirect/sign-in responses.

Pullfrog  | View workflow run | Using gpt-6-astra | 𝕏

@adelrodriguez
adelrodriguez merged commit 8684f88 into main Nov 12, 2026
11 checks passed
@adelrodriguez
adelrodriguez deleted the build/run-on-node branch November 12, 2026 02:30
adelrodriguez added a commit that referenced this pull request Nov 12, 2026
The Vercel projects override the install command with `bun install`,
which fails now that the workspace globs live in pnpm-workspace.yaml.
vercel.json takes precedence over the project settings, so it now sets
the pnpm install command. Dropping bunVersion runs the functions on
Node, the template's runtime since #296.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>
adelrodriguez added a commit that referenced this pull request Nov 12, 2026
The Vercel projects override the install command with `bun install`,
which fails now that the workspace globs live in pnpm-workspace.yaml.
vercel.json takes precedence over the project settings, so it now sets
the pnpm install command. Dropping bunVersion runs the functions on
Node, the template's runtime since #296.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>
adelrodriguez added a commit that referenced this pull request Nov 12, 2026
* build: move the package manager config from Bun to pnpm

Move the workspace globs, overrides, the evlog patch, and exact saves from
package.json and bunfig.toml to pnpm-workspace.yaml, and replace bun.lock
with pnpm-lock.yaml. The lockfile was imported from Bun's resolution
through a Yarn v1 lockfile, so dependency versions do not drift. A fresh
resolution paired @effect/platform-node-shared 4.1.4 with effect 4.0.0
and broke Adamantite.

allowBuilds records a decision for each dependency with a build script.
electron-winstaller runs, because the Squirrel maker needs its 7-Zip
binary. The esbuild, msgpackr-extract, and protobufjs scripts only verify
prebuilt binaries or print warnings. The old trusted entries for
electron, @tailwindcss/oxide, and @parcel/watcher no longer have install
scripts.

hoistPattern repeats pnpm's default so Electron Forge's system check
accepts isolated installs until electron/forge#4188 lands.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build: run workspace scripts with pnpm

Replace `bun update --interactive` in every bump:deps script, the
`bun run --parallel` codegen scripts, `bunx` in @v1/auth, and `bun x` in
the backend schema generator. pnpm runs the scripts that a regex matches
concurrently, so `pnpm run "/^codegen:/"` keeps codegen parallel.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build: run template commands and recipes with pnpm

The template commands and recipes now install with `pnpm install` and
`pnpm add`, and their messages name pnpm commands. pnpm-workspace.yaml
sets saveExact, so the recipes drop `--exact`. The Sentry recipe passes
`--allow-build=@sentry/cli` instead of editing trustedDependencies,
which pnpm does not read.

The remote-cache recipe now finds Turbo behind `pnpm run`, the `pnpm`
script shorthand, `pnpm exec`, and `pnpm dlx`. It also stops matching
commands such as `turbo-ignore`.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: set up Node and pnpm with pnpm/setup

pnpm/setup reads .node-version and the packageManager field, caches the
pnpm store, and runs a frozen install, so it replaces the setup-node,
setup-bun, cache, and install steps in each job.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: install the Vercel previews with pnpm and run them on Node

The Vercel projects override the install command with `bun install`,
which fails now that the workspace globs live in pnpm-workspace.yaml.
vercel.json takes precedence over the project settings, so it now sets
the pnpm install command. Dropping bunVersion runs the functions on
Node, the template's runtime since #296.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(turbo): deny core-js's install script when the PostHog recipe adds posthog-js

pnpm fails an install when a dependency has an unreviewed build script.
posthog-js depends on core-js, whose postinstall only prints a funding
message, so the recipe denies it with --allow-build=!core-js.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build(mobile): regenerate the native iOS project with pnpm paths

expo prebuild under pnpm replaces the node_modules/.bun paths that Bun's
isolated linker wrote into Podfile.lock and project.pbxproj.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(turbo): cover pnpm flag values before a Turbo call in remote-cache

`pnpm --filter app exec turbo run build` and the `-F` and `--dir` forms
run Turbo, but the recipe's parser does not skip a flag's separate value.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(turbo): find Turbo after pnpm flags that take a value

The remote-cache recipe matched direct Turbo calls with a regex that
could not skip a flag's separate value, and its script parser stopped at
`exec`. One parser now skips flags and their values, then reads whether
pnpm runs a binary through `exec` or `dlx`, a script through `run`, or
either through the shorthand.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build: let the maintainer's own packages skip pnpm's release-age wait

pnpm refuses packages published less than a day ago, so every install
failed for a day after a @sanely release. Exempt @sanely/* and adamantite,
as the maintainer's other pnpm repositories do.

Refs #278

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

2 active deployments
Preview – v1 — fe36f933 Deployed Nov 11, 2026 by vercel[bot]
Preview – v1-docs — fe36f933 Deployed Nov 11, 2026 by vercel[bot]
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.

build: run applications, scripts, and tests on Node instead of Bun

1 participant