Supabase Blog

Next.js with PostgreSQL – Getting Started

0 views

Next.js with PostgreSQL – Getting Started

This is a Next.js project with a PostgreSQL backend and Prisma.

What you need (local deploy)

  • Node.js (v16+)
  • Docker & Docker Compose (for PostgreSQL)
  • Environment: DATABASE_URL in .env (see below)

Local deployment (full)

1. Start PostgreSQL (Docker)

docker-compose up -d

Uses: user postgres, password postgres, port 5432, DB postgres.

2. Environment

Copy .env.example to .env (or create .env with):

DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"

3. Install dependencies and DB

npm install
npx prisma generate
npx prisma migrate deploy

4. Optional – seed sample posts

npx prisma db seed

5. Run the app

npm run dev

Open http://localhost:3000.