feat: add Cloudflare D1 runtime support #4

Merged
kdaniel2410 merged 3 commits from codex/d1-production-runtime into main 2026-06-25 11:10:45 +00:00
Owner

Summary

  • add a request-aware Drizzle runtime database that uses Cloudflare D1 via the DB binding when DATABASE_URL is not set
  • keep local SQLite/libSQL development through DATABASE_URL and defer local client creation until runtime
  • add the DB D1 binding to wrangler.jsonc, regenerate Worker types, and document local/production database flows
  • make Better Auth build-safe while still requiring ORIGIN and BETTER_AUTH_SECRET at runtime

Checks

  • pnpm check
  • pnpm build
  • pnpm exec prettier --check src/lib/server/db/index.ts src/lib/server/auth.ts README.md wrangler.jsonc worker-configuration.d.ts
  • pnpm exec eslint src/lib/server/db/index.ts src/lib/server/auth.ts

Note: full pnpm lint still reports a pre-existing formatting issue in src/lib/components/first-admin-form.svelte, which this PR does not touch.

## Summary - add a request-aware Drizzle runtime database that uses Cloudflare D1 via the DB binding when DATABASE_URL is not set - keep local SQLite/libSQL development through DATABASE_URL and defer local client creation until runtime - add the DB D1 binding to wrangler.jsonc, regenerate Worker types, and document local/production database flows - make Better Auth build-safe while still requiring ORIGIN and BETTER_AUTH_SECRET at runtime ## Checks - pnpm check - pnpm build - pnpm exec prettier --check src/lib/server/db/index.ts src/lib/server/auth.ts README.md wrangler.jsonc worker-configuration.d.ts - pnpm exec eslint src/lib/server/db/index.ts src/lib/server/auth.ts Note: full pnpm lint still reports a pre-existing formatting issue in src/lib/components/first-admin-form.svelte, which this PR does not touch.
kdaniel2410 added 2 commits 2026-06-25 10:42:30 +00:00
kdaniel2410 added 1 commit 2026-06-25 11:09:57 +00:00
kdaniel2410 merged commit 4ee0a8f4ec into main 2026-06-25 11:10:45 +00:00
kdaniel2410 deleted branch codex/d1-production-runtime 2026-06-25 11:10:45 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kdaniel2410/clearity#4