(UPDATE) - with the latest dependencies updates, you will have to do some small config changes.
A comprehensive toolkit template repository tailored to assist in integrating advanced custom authentication into your Next.js applications using Auth.js V5. It demonstrates both client-side and server-side aspects and approaches.
- Overview
- Concept
- Key Features
- Tech Stack
- Demo Images
- Installation
- Usage
- Environment Variables
- Contributions
- License
Auth.js V5 Toolkit is a specialized toolkit designed to streamline the process of implementing sophisticated and customizable authentication mechanisms within Next.js applications. It provides a solid foundation and structure to integrate Auth.js V5 seamlessly. It's designed to provide a robust and scalable solution for managing user authentication in web applications.
The concept behind this toolkit is to create a scalable and maintainable solution for managing user authentication. It's designed with a modular approach, where each feature is encapsulated in its own module, making it easy to add, remove, or modify features.
- Client-Side Implementation: The client-side implementation includes client components and API calls. These components are responsible for rendering the user interface and interacting with the user. The API calls are used to communicate with the server, sending requests and receiving responses.
- Server-Side Implementation: The server-side implementation includes server actions and server components. Server actions handle the business logic, such as user registration, login, and authentication. Server components are responsible for rendering server-side views.
- Parallel Routes: The toolkit uses parallel routes to demonstrate a client and a server component rendering the same information with different approaches. This showcases the flexibility and versatility of the toolkit in handling different rendering strategies.
- User Registration and Login: The toolkit provides users with the ability to register and login with credentials or providers like Google and GitHub. This makes it easy for users to start using the application with their existing accounts.
- Two-Factor Authentication and Email Confirmation: The toolkit includes two-factor authentication for added security. This requires users to provide two forms of identification when logging in, such as a password and a verification code sent to their phone.
- In addition, the toolkit includes email confirmation and validation. After registering, users receive an email with a link to confirm their account. This helps to verify that the email address provided by the user is valid and belongs to them.
-
Next.js & React: Utilize Next.js and React for efficient server-side rendering and interactive UI.
-
TypeScript: Ensure type safety and enhance code quality with TypeScript.
-
TailwindCSS: Employ a utility-first CSS framework for rapid UI development and customization.
-
Auth.js V5 & OAuth 2: Implement advanced authentication features using Auth.js V5 and OAuth 2 for secure authentication flows.
-
Prisma & PostgreSQL: Leverage Prisma ORM with PostgreSQL for efficient database management and queries.
-
Shadcn-ui: Utilize UI components from Shadcn-ui for visually appealing interfaces.
-
Bcryptjs: Implement secure password hashing using Bcrypt for enhanced security.
-
React-hook-form & React-icons: Manage forms efficiently and use icons for a better user experience.
-
Resend & Sonner: Manage asynchronous tasks and scheduling effectively.
-
Zod: Ensure data validation with Zod's schema-first approach.
-
Server Actions: Implement server actions for authentication flows and providers.
-
Authentication Flows: Implement authentication flows for sign up, sign in, sign out, forgot password, and reset password.
-
Authentication Providers: Integrate authentication with credentials, OAuth 2, Google and Github providers, and refresh tokens.
-
Authentication Callbacks: For JSON Web Tokens as they allow you to implement access controls without a database and to integrate with external databases or APIs.
-
Authentication Events: Asynchronous functions that do not return a response, to handling any other side-effects.
-
Authentication Pages: For handling Sign in, Sign out, Email Verification and displaying error messages.
- TypeScript
- React
- Next.js
- TailwindCSS
- Auth.js V5
- OAuth 2
- Prisma
- PostgreSQL
- Shadcn-ui
- Bcryptjs
- React-hook-form
- React-icons
- Resend
- Sonner
- Zod
-
Logout Dropdown
- Clone the repository.
- Navigate to the project directory.
- Install dependencies using
npm install
. - Configure the environment variables required for Auth.js V5 and Prisma setup.
- Start the application with
npm run dev
.
- Access the application via the provided URL.
- Implement advanced custom authentication into your Next.js application using the toolkit's structured approach.
- Leverage the provided features and libraries to enhance your authentication mechanisms.
DATABASE_URL=
DIRECT_URL=
AUTH_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
RESEND_API_KEY=
NEXT_PUBLIC_APP_URL=
Contributions are encouraged! Get in touch to contributing to this project.
This project is licensed under the MIT License.