
This repository provides a boilerplate to quickly set up a Next.js demo application with authentication using NextAuth.js v4, Prisma Postgres and Prisma ORM, and deploy it to Vercel. It includes an easy setup process and example routes that demonstrate basic CRUD operations against the database.
After cloning the repo and navigating into it, install dependencies:
Create a Prisma Postgres instance by running the following command:
This command is interactive and will prompt you to:
Once the command has terminated, copy the Database URL from the terminal output. You'll need it in the next step when you configure your .env file.
.env fileYou now need to configure your database connection via an environment variable.
First, create an .env file:
Then update the .env file by replacing the existing DATABASE_URL value with the one you previously copied. It will look similar to this:
To ensure your authentication works properly, you'll also need to set env vars for NextAuth.js:
You can generate a random 32 character string for the AUTH_SECRET secret with this command:
In the end, your entire .env file should look similar to this (but using your own values for the env vars):
Run the following commands to set up your database and Prisma schema:
Add initial data to your database:
Start the development server:
Once the server is running, visit http://localhost:3000 to start using the app.


