Next Auth v5 beta | Authentication Service

This project uses next-auth v5(beta) to create an reliable and reusable authentication service. It incorporates the latest technologies of web development, and this project can be reused in every small to large-scale project, can be tailored easily upto your needs. This project is a full-stack web application built with Next.js 14 and leverages a modern tech stack for optimal performance and maintainability. I adopted a meticulously structured project architecture, separating concerns into app router, API routes, server actions, and components. Added a custom middleware to enforce route protection, differentiating between public, auth, and protected routes. I also extended the user session to showcase how to tailor it according to your needs. I have added a custom middleware that ensures route protection by separating protected, auth, and public routes. Also implemented Two-factor authentication (2FA) as an optional security measure for credential-based logins. Also the implementation of password reset and recovery functionalities is added. To showcase how to handle user management and how to fetch session on both server and client sides, I have added server example, and a client example that showcase it. I have also added an admin example that shows how NextJS API routes, and server actions can be protected for admin role. The example will clearly help on how to use it according to your needs. Also in this example a role-based access control was implemented using a role gate, ensuring that only authorized users can access specific sections. toasts are used to show the behaviour of this example. It is deployed using vercel, you can see it here https://lnkd.in/eSR2jY92 Link to source code: https://lnkd.in/egkZ2iTE

Aug 01, 2024 - Aug 31, 2024