cloudflare pages + Prisma
Hi I'm trying to build a Next.js Full stack application with Cloudflare pages
thus can you please share steps to configure the Prisma along with Postgres in cloudflare next on pages
I had referred this documentation https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-cloudflare but was unable to understand the exact steps to be taken
Thus please try to help me with this
Deploy to Cloudflare Workers & Pages | Prisma Documentation
Learn the things you need to know in order to deploy an app that uses Prisma Client for talking to a database to a Cloudflare Worker or to Cloudflare Pages.
2 Replies
Hi @Md.Sadiq
1. The first thing you would need to do is to setup your Nextjs project and install Prisma
2. You would then need to configure your Prisma schema with the
driverAdapters
preview feature.
3. Install the required dependencies:
4. Set up your database connection: Create a .dev.vars
file in your project root and add your Postgres connection string:
5. Update your package.json
to include a script for loading environment variables:
Note that you would need to install dotenv
dependency.
6. Use Prisma Client in your Next.js API routes or server components:
7. For local development, you can use wrangler to run your Next.js app:
8. To deploy, first set the DATABASE_URL as a secret in Cloudflare:
9. Deploy your Next.js app to Cloudflare Pages using their deployment process.Thanks a ton for the help @RaphaelEtim