feat(infra): integrate Cloudflare Hyperdrive with Supabase and Prisma adapter
Overview
Integrates Cloudflare Hyperdrive (finwise-db, ID: 2e364c7ca4ef490da2e03e40a8b4cb32) to provide edge-accelerated, connection-pooled database access to Supabase PostgreSQL for the FinWise backend.
Key Changes
-
Wrangler & Edge Configuration:
- Added
wrangler.tomlwith[[hyperdrive]]binding and local connection string fallback. - Added
src/worker.tsas the Cloudflare Worker edge entrypoint with/healthdiagnostic endpoints. - Updated
.gitignoreto ignore.wrangler/build artifacts and.dev.vars.
- Added
-
Prisma & Database Driver Adapter:
- Enabled
driverAdapterspreview feature inprisma/schema.prisma. - Installed
@prisma/adapter-pgandpgfor Edge runtime driver compatibility. - Implemented dynamic runtime detection and lazy initialization in
src/database/prisma.client.ts(supports both Node.js Express server and Cloudflare Edge Worker isolates).
- Enabled
-
Scripts & Environment:
- Added
wrangler:dev,wrangler:dev:remote, andwrangler:deployscripts inpackage.json. - Added TypeScript environment definitions in
src/types/worker-env.ts.
- Added