Skip to content

Repository files navigation

Next.js Advanced Authentication App

Welcome to the Next.js Advanced Authentication App! This project was built by following an educational tutorial to learn how to integrate advanced authentication features using Auth.js (next-auth v5), Next.js app router server actions, and additional libraries.

The live app is deployed at Vercel: 🔗 Live Demo

🛠 Tech Stack & Resources

🔗 Next.js 15

🔗 Auth.js (next-auth v5)

🔗 Resend (for emails)

🔗 Node.js

🔗 Shadcn UI

🔗 Clerk

🔗 Sonner

🔗 Zod for validation

🔗 Prisma or Prisma in Auth.js

🔗 Neon as database

🔑 Key Features

  • Next-auth v5 (Auth.js) authentication

  • Server Actions in Next.js 15

  • Credentials Provider (email/password login)

  • OAuth Provider (Social login with Google & GitHub)

  • Forgot Password Functionality

  • Email Verification

  • Two-Factor Authentication (2FA)

  • User Roles (Admin & User)

  • Login and Register Components (Redirect or Modal)

  • Forgot Password, Verification, and Error Components

  • Login and Logout Buttons

  • Role-Based Access Control (Role Gate)

  • Middleware Protection using Next.js middleware

  • Extended Session Handling with NextAuth callbacks

  • Custom Hooks:

    * useCurrentUser, * useRole

  • Utilities:

    * currentUser, * currentRole

  • Server and Client Component Examples

  • Admin-Only Content Rendering using RoleGate

  • Protect API Routes and Server Actions (Admins Only)

  • Change Email (with re-verification)

  • Change Password (confirm old password)

  • Enable/Disable Two-Factor Authentication (2FA)

  • Change User Role (for development/testing purposes)

📚 Learning Goals

  • Learn how to set up OAuth login with Credentials, Google and GitHub
  • Implement authentication flows (login, registration, email verification, password reset)
  • Protect pages, components, APIs, and server actions
  • Use Next.js server actions with Auth.js
  • Understand and extend next-auth sessions and callbacks
  • Add Two-Factor Authentication (2FA)
  • Manage user roles (Admin/User)
  • Explore middleware to protect routes
  • Explore advanced UI flows with Shadcn UI

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages