Setting Up PostgreSQL and a Prisma Project
1. Get a PostgreSQL database running
Locally (via Docker) or a hosted free tier both work, either way you end up with a connection string:
postgresql://USER:PASSWORD@HOST:PORT/DATABASE
2. Create a Node project and install Prisma
npm init -y
npm install prisma --save-dev
npm install @prisma/client
npx prisma init
npx prisma init creates:
prisma/schema.prisma, where you'll define your data models..env, with aDATABASE_URLplaceholder for your connection string.
3. Point it at your database
DATABASE_URL="postgresql://postgres:secret@localhost:5432/blog_dev?schema=public"
Prisma reads DATABASE_URL from your environment, never hardcode credentials directly in schema.prisma.