A Next.js boilerplate with authentication, Prisma ORM, and a local PostgreSQL database running in Docker.
- Next.js app with App Router, Server Actions & API Routes
- Authentication with NextAuth.js v4 (sign up & log in flows)
- Prisma ORM with PostgreSQL for data modeling, migrations, and seeding
- CRUD operations for blog posts (create, view, delete)
- Pagination, filtering & relation queries
pnpm installCreate an .env file in the project root:
cp .env.example .env # or create it manuallyIt should contain:
DATABASE_URL="postgres://user:password@localhost:5432/hackathon"
AUTH_SECRET="RANDOM_32_CHARACTER_STRING"Generate a value for AUTH_SECRET:
npx auth secretSpin up the local PostgreSQL container with Docker:
pnpm db:upOther database commands:
| Command | Description |
|---|---|
pnpm db:up |
Start the database container |
pnpm db:down |
Stop the container |
pnpm db:reset |
Wipe the volume and restart (fresh DB) |
Apply the Prisma schema to the database:
pnpm prisma migrate dev --name initAdd initial data:
pnpm prisma db seedpnpm devVisit http://localhost:3000 to start using the app.
app/ # Next.js App Router pages and API routes
lib/ # Prisma client and DB utilities
prisma/ # Schema, migrations, and seed script
pnpm prisma studio # Open Prisma Studio (GUI for the DB)
pnpm prisma migrate dev # Create and apply a new migration
pnpm prisma generate # Regenerate the Prisma client