next-auth-v4-prisma-demo
next-auth-v4-prisma-demo copied to clipboard
Next.js starter including Typescript, NextAuth.js and Prisma. SQLite and Github OAuth used by default, easy to change :)
Next.js + NextAuth.js + Prisma.io + Typescript demo
This is roughly half of the stack detailed on init.tips.
We're using the NextAuth.js v4 Beta.
We loaded up most of the files with comments describing what they do and how to expand upon them. Be sure to check out:
prisma/schema.prismapages/index.tsxpages/_app.tsxpages/api/auth/\[...nextauth\].ts
Getting Started
Set up Github OAuth
If you will be using a different auth provider, you can skip this section
Make sure you have a valid authorization callback url for http://localhost:3000.
Your setup should look something like this

Create a .env file in the root of your project, with your Github OAuth Client ID and Secret generated above:
- GITHUB_CLIENT_ID
- GITHUB_CLIENT_SECRET
Run locally
Install and run
npm i
npx prisma migrate dev
npm run dev
Notes
If you would like to install the same packages here and replicate this on your own, look out for this bug when you intall the beta versions of next-auth v4: https://github.com/nextauthjs/next-auth/issues/2675
It should be resolved very soon. Will try to update this when it is :)