
Setting up NextAuth.js application and deploying it via Vercel
2 July 2023

Sanyam
This blog is about how to set up NextAuth.js in your Next.js application and deployment using Vercel.
JavaScript
Next.js
Setting up NextAuth
- Start off by creating a Next.js application. Run the following command in the terminal
npx create-next-app@latest
- Now install NextAuth in your project.
npm install --save next-auth
- Inside your Next app, inside pagesdirectory & inside api , create a folder named auth and file inside it named [...nextAuth].js.
- Your folder structure should look like this:

- Inside the [...nextAuth].js file, define the provider and its envs. Also, add the page route you are trying to direct the user to when they click theSign In button.
For further read, click here