Testing the latest Next.js features and integration with Auth.js
- MongoDB
- Next.js v14
- Auth.js v5
- Shadcn UI
- Prisma
- Credential Login Flows
- OAuth
- Two Factor Authentication
- Parallel and Intercepting Routes
- Account Linking
- Setup MongoDB
docker compose up --wait
- Using MongoDB Compass, connect to localhost and start a shell prompt.
Connection String:
mongodb://127.0.0.1:27017/?replicaSet=rs0
- Create a database and create a new user
use authfulnext
db.createUser({
user: "authfulnext",
pwd: "password",
roles: [{ role: "readWrite", db: "authfulnext" }]
})
- Generate prisma client
npx prisma generate
- Push the schema
npx prisma db push
- Seed the database
npx prisma db seed
The Credential provider is setup out of the box. For OAuth support, this project is configured to use Google and Github. In order to utilize these OAuth providers, you will need to provide ID and SECRETS for both services.
During the authentication process, several emails are sent out. We use Resend to send our emails for development so you will need to setup your own account and provide your API_KEY.
You can read the docs here: Resend Docs.