This a boilerplate providing registration and login with credentials and google provider. It uses the next-auth package as well as vercel's postgres storage to save users. It is styled with tailwindcss. It uses the app router in Next.js and is bootstrapped with create-next-app.
First, you'll need to configure the Vercel project with the proper .env variables. To get started, fork this project and follow this guide for setting up the database in Vercel.
You'll also need to set up Google credentials for a new project through the Google cloud console, placing the following environment variables in your .env file:
GOOGLE_ID=
GOOGLE_SECRET=For next-auth, you also need to generate a secret key to encrypt JWTs. I use openssl for this:
openssl rand -hex 32And place it in your .env file.
AUTH_SECRET=Then, install dependencies and run the development server:
pnpm i
pnpm devOpen http://localhost:3000 with your browser to see the result.