/authByKMaar

Auth by KMaar is a comprehensive authentication solution for Next.js applications. It leverages the power of Next-auth v5 and Next.js 14 to provide a robust and secure authentication system.

Primary LanguageTypeScript

Auth by KMaar

Auth by KMaar is a comprehensive authentication solution for Next.js applications. It leverages the power of Next-auth v5 and Next.js 14 to provide a robust and secure authentication system.

Key Features

  • Next-auth v5 (Auth.js): Utilizes the latest version of Next-auth for secure authentication.
  • Next.js 14 with server actions: Built on the latest version of Next.js with server actions for enhanced performance.
  • Credentials Provider: Allows users to sign in using their credentials.
  • OAuth Provider: Supports social login with Google & GitHub.
  • Forgot password functionality: Users can recover their account using the forgot password feature.
  • Email verification: Ensures user authenticity with email verification.
  • Two factor verification: Provides an extra layer of security with two-factor authentication.
  • User roles (Admin & User): Supports different user roles with varying levels of access.
  • Login/Register/Forgot password components: User-friendly components for various authentication processes.
  • Verification/Error components: Components to handle verification and display errors.
  • Login/Logout buttons: Easy-to-use login and logout buttons.
  • Role Gate: Restricts access based on user roles.
  • Exploring next.js middleware: Middleware exploration for advanced functionalities.
  • Extending & Exploring next-auth session/callbacks: Advanced session management and callback exploration.
  • useCurrentUser/useRole hooks: Custom hooks for accessing current user and role.
  • currentUser/currentRole utilities: Utilities for managing current user and role.
  • Example with server/client component: Examples provided for both server and client components.
  • Render content for admins using RoleGate component: Special rendering for admin users.
  • Protect API Routes/Server Actions for admins only: Enhanced security by protecting API routes and server actions for admins only.
  • Change email/password/two-factor auth/user role in Settings page: Allows users to manage their account settings.

Getting Started

  1. Clone the repository
  2. Install dependencies with npm install
  3. Start the development server with npm run dev

Contributing

We welcome contributions from the community. Please read our contributing guide for more information.

License

This project is licensed under the MIT License. See the LICENSE file for details.