
Next Auth v5 App
Next.js 14
NextAuth v5 (Auth.js)
Resend (Email service)
Google Auth
GitHub Auth
Node.js
Shadcn UI
Prisma
PostgreSQL
TailwindCSS
Project Overview
A Next.js application that implements authentication using NextAuth v5, featuring user registration, login, logout functionalities, and Multi-Factor Authentication (MFA) with email code verification.
Project Gallery

Project Overview
A Next.js application that implements authentication using NextAuth v5, featuring user registration, login, logout functionalities, and Multi-Factor Authentication (MFA) with email code verification.
Key Features
- ๐ Next-auth v5 (Auth.js)
- ๐ Next.js 14 with server actions
- ๐ Credentials Provider
- ๐ OAuth Provider (Social login with Google & GitHub)
- ๐ Forgot password functionality
- โ๏ธ Email verification
- ๐ฑ Two factor verification (2FA)
- ๐ฅ User roles (Admin & User)
- ๐ Login component (Opens in redirect or modal)
- ๐ Register component
- ๐ค Forgot password component
- โ Verification component
- โ ๏ธ Error component
- ๐ Login button
- ๐ช Logout button
- ๐ง Role Gate
- ๐ Exploring next.js middleware
- ๐ Extending & Exploring next-auth session
- ๐ Exploring next-auth callbacks
- ๐ค useCurrentUser hook
- ๐ useRole hook
- ๐ง currentUser utility
- ๐ฎ currentRole utility
- ๐ฅ๏ธ Example with server component
- ๐ป Example with client component
- ๐ Render content for admins using RoleGate component
- ๐ก๏ธ Protect API Routes for admins only
- ๐ Protect Server Actions for admins only
- ๐ง Change email with new verification in Settings page
- ๐ Change password with old password confirmation in Settings page
- ๐ Enable/disable two-factor auth in Settings page
- ๐ Change user role in Settings page (for development purposes only)
Technical Details
Implements NextAuth v5 with custom authentication flows, including email verification and MFA. Uses Prisma with PostgreSQL for user data management.
Challenges & Solutions
Implementing secure authentication flows while maintaining a smooth user experience, especially for the MFA implementation.