This project uses Nextauth for Authentication

Why nextauth?

nextauth is the most popular Auth library for nextjs by far. (opens in a new tab)

It allows you to keep all your user data in one place, in your own database.

This is compared to hosted solutions Auth0 or Clerk Dev where Your user data is kept in a separate database than all your regular database data. This leads to obvious complexity and potential breaking points in your app.

Having all your user and auth data in one database, next to all your other data presents a much better, more robust and seamless developer experience.

You also own your data and database compared to outsourcing to a third party company which can go out of business or be the target of a cyber attack.


Nextauth discourges using password and does not even support password auth. The industry moving towards passwordless auth with technologies on the horizan such Webauthn.

To make this project future proof and work well with nextauth, password auth is not supported.

Webauthn (opens in a new tab) (opens in a new tab)

Passwords are ok for small internal apps. (opens in a new tab)

This implementation in the Nextjs tutorial is an overly simplistic setup and should not be used in public facing apps. Its ignoring throttling and many other security features that are needed when implementing password auth.

If password auth is absolutely required, lucia-auth would be a solid choice. (opens in a new tab)

Google Login

This project also utilizes google oauth login and signup. (opens in a new tab) (opens in a new tab)


If you would like to use a hosted email provider in dev check out mailtrap. To setup mailtrap or another smpt server substitute the credentials in the nodemailer transporter and use the transporter to send emails in sendEmail.ts file.

JWT vs Session

This project uses session storage for auth instead of JWT. Session auth is more robust and ensure a single source of truth for auth state which is important for working with a multi tenant app. (opens in a new tab)