Skip to content

Migrate to Node 24, pnpm, Neon, and better-auth#1

Closed
dubscode wants to merge 3 commits into
mainfrom
feat/node-pnpm-vitest-migration
Closed

Migrate to Node 24, pnpm, Neon, and better-auth#1
dubscode wants to merge 3 commits into
mainfrom
feat/node-pnpm-vitest-migration

Conversation

@dubscode

@dubscode dubscode commented Jun 4, 2026

Copy link
Copy Markdown

Migrates the monorepo from Bun to Node 24 + pnpm, replacing Bun workspace/lock/config files with pnpm workspace, lockfile, install policy, and CI/Docker command updates.
Adds the Neon/Drizzle, better-auth, and Vercel Blob cutover work, including new auth/storage packages, database schema/client changes, file upload/download routes, and migration validation scripts.
Updates API, dashboard, worker, jobs, bot, and package tests/configuration to run under Vitest and the new runtime, with lazy-loading fixes for ESM-only bot/chat dependencies.
Validation: not rerun during PR creation; branch is pushed and ready for GitHub CI.

dubscode added 3 commits June 2, 2026 16:14
- replace Bun with pnpm (pnpm-workspace.yaml, pnpm-lock.yaml, .npmrc) and pin Node 24 (.nvmrc, engines)
- swap bun:test for Vitest across packages (per-package vitest.config.ts, test setup updates)
- update CI workflows, Dockerfiles, and setup action for pnpm/Node
- remove bunfig.toml + bun.lock; vendor xlsx tarball; add smoke-test script
db: Drizzle->Neon (pooled/unpooled, no Railway replicas); add better-auth
tables (session/account/verification/two_factor/jwks) + users.email unique +
email_verified/updated_at/two_factor_enabled; strip 110 Supabase RLS policies +
auth.users shim; fix 6 latent index opclasses; finish postgrest->Drizzle.

storage: new @midday/storage over Vercel Blob (private vault + public stores),
signed-file HMAC, /files/signed + /files/upload-token, 33 call-site swaps,
tus->@vercel/blob/client.

auth: new @midday/auth (better-auth: emailOTP, social, jwt/JWKS, twoFactor);
dashboard sign-in/session/MFA; API JWKS verifier w/ aud+requiredClaims;
deleteUser via FK cascade.

teardown: drop Supabase Realtime + 11 consumers; delete @midday/supabase +
@supabase/supabase-js; strip SUPABASE_* env/CI; health blob probe.

cutover: scripts/cutover runbook + pg_dump/restore, auth identity import,
storage copy, validation.

BREAKING CHANGE: removes Supabase (db/auth/storage/realtime); requires Neon,
Vercel Blob, better-auth env. Realtime live updates dropped.
The chat/@chat-adapter/toolpick packages are ESM-only and broke require()
at boot in the (CJS) API. Keep the API CJS (so the repo's circular package
deps stay tolerated) and dynamically import the ESM-only deps instead:

- bot: lazy async getBot() singleton dynamic-imports the 6 chat adapters;
  api webhook/oauth handlers + runtime call getBot() lazily; dynamic
  import("chat") for toAiMessages; dynamic import("toolpick") in chat/tools
- dashboard: serverExternalPackages for better-auth/kysely (Turbopack
  mis-bundled better-auth's unused sqlite adapters); lazy Resend init +
  dev OTP-to-console in @midday/auth (no crash when RESEND_API_KEY unset)
Copilot AI review requested due to automatic review settings June 4, 2026 03:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@dubscode dubscode closed this Jun 4, 2026
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.

2 participants