Skip to content

yntpdotme/authjs-mastery

Repository files navigation

Auth.js Mastery

Learn advance authentication with Auth.js

Jio Network blocking the view? Network switch reveals the magic!

Twitter Badge   Linkedin Badge   Mail Badge   Conventional Commits  MIT License


Introduction · Features · Tech Stack · Development Setup · Contributing


Welcome Auth.js Mastery, your ultimate guide to implementing robust authentication in Next.js using Auth.js. This advance guide provides you with everything you need to authenticate modern web apps. Delve into the codebase to explore more.


Jio Network blocking the view? Network switch reveals the magic!


  •  🗃️   Organized File and Folder Structure

  •   ▲   Next.js 15 with Server Actions

  •  🔑   Credentials & OAuth Providers (Google & GitHub)

  •  🔒   Forgot Password & Email Verification

  •  📱   Two-Factor Authentication

  •  👥   User Roles (Admin & User)

  •  🔓   Login Component (Redirect or Modal)

  •  📝   Registration & Forgot Password Components

  •  ✅   Verification & Error Components

  •  🚧   Role-Based Access Gate

  •  🖥️   Server & Client Component Examples

  •  🛡️   Protect API Routes & Server Actions for Admins

  •  📧   Change Email & Password with Verification in Settings

  •  🔔   Enable/Disable 2FA in Settings



  1. Prerequisites
    Make sure you have the following installed on your machine:

  2. Clone the repository:

    git clone https://github.com/yntpdotme/authjs-mastery.git
  3. Navigate to the project directory:

    cd authjs-msatery
  4. Install dependencies:

    pnpm install
  5. Add Environment Variables:

    Create .env file in the root folder and copy paste the content of .env.sample

    cp .env.sample .env

    Update credentials in .env with your credentials.

  6. Setup Prisma

    pnpm prisma generate
    pnpm dlx prisma db push
  7. Start the App:

    pnpm dev

    Visit  https://localhost:3000  to access your app.

  8. Start Prisma Studio:

    pnpm prisma studio

    Visit  https://localhost:5555  to access prisma studio.


🤝  Contributing

Contributions are always welcome! See CONTRIBUTING.md for ways to get started.


🪪   License

Auth.js Mastery is open-source under the MIT License. Feel free to learn, add upon, and share!