Hello. I am building a nextjs e-commerce

Hello. I am building a nextjs e-commerce site and I will deploy it in cloudflare pages. I am writing the backend in nextjs for the first time. I am having issue in communication to the db. I am using supabase's pg database. I created a hyperdrive for the pg database. Now in the next js project I want to use the connection with Kysely. I can't find any proper docs or example on how to create the client. I can't use supabase's client side library since it doesn't support joins without FK. From my research I found that hyperdrive is the only way to acheive it, but I am having trouble setting it up. Can someone please help? TIA 🙏
1 Reply
thomasgauvin
thomasgauvin19h ago
You should be able to use Kysely with the Hyperdrive connection string, similarly to how we have docs on Drizzle and Prisma ORM https://developers.cloudflare.com/hyperdrive/examples/connect-to-postgres/postgres-drivers-and-libraries/drizzle-orm/
Cloudflare Docs
Drizzle ORM
Drizzle ORM is a lightweight TypeScript ORM with a focus on type safety. This example demonstrates how to use Drizzle ORM with PostgreSQL via Cloudflare Hyperdrive in a Workers application.

Did you find this page helpful?