This module provides all authentication-related UI and logic for the boilerplate, including sign up, login, password reset, and forgot password flows. It is designed to work with BetterAuth and integrates with the rest of the app using React hooks, zod validation, and UI primitives from shadcn/ui.Documentation Index
Fetch the complete documentation index at: https://docs.builderbox.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
- Purpose: Handle all user authentication flows in a secure, user-friendly, and extensible way.
- Integration: Used in Next.js pages (e.g.,
/login,/signup,/forgot-password,/reset-password). - Tech: React, shadcn/ui, zod, react-hook-form, BetterAuth client, toast notifications.
Components
SignupForm
- File:
features/auth/signup-form.tsx - Purpose: User registration form supporting name, email, password, and social signups (GitHub, Google).
- How it works:
- Uses
react-hook-formand zod for validation. - Calls
authClient.signUp.emailto register a new user. - On success, shows a toast and prompts for email verification.
- Supports toggling password visibility.
- Social signup buttons trigger OAuth flows via BetterAuth.
- Uses
- Usage: Used on
/signuppage.
LoginForm
- File:
features/auth/login-form.tsx - Purpose: User login form supporting email/password and social logins.
- How it works:
- Uses
react-hook-formand zod for validation. - Calls
authClient.signIn.emailfor email/password login. - On success, shows a toast and redirects to dashboard.
- Social login buttons trigger OAuth flows via BetterAuth.
- Includes a link to the forgot password page.
- Uses
- Usage: Used on
/loginpage.
ForgotPasswordForm
- File:
features/auth/forgot-password-form.tsx - Purpose: Initiates password reset by sending a reset link to the user’s email.
- How it works:
- Uses
react-hook-formand zod for validation. - Calls
authClient.forgetPasswordto send a reset email. - Shows a toast on success or error.
- Uses
- Usage: Used on
/forgot-passwordpage.
ResetPasswordForm
- File:
features/auth/reset-password-form.tsx - Purpose: Allows users to set a new password after clicking the reset link.
- How it works:
- Uses
react-hook-formand zod for validation (password and confirm password). - Calls
authClient.resetPasswordwith the new password and token from the URL. - Shows a toast on success and redirects to login.
- Uses
- Usage: Used on
/reset-passwordpage.
How It Works in the App
- Each form is imported and rendered in the corresponding Next.js page under
/app. - All forms use shadcn/ui components for consistent styling.
- Toast notifications provide user feedback for all actions.
- Social login/signup is handled via BetterAuth and can be extended with more providers.
Example Usage
Extending
- Add more providers by extending the social login/signup button logic.
- Customize validation by editing the zod schemas in
@app/packages/validators. - Adjust UI by modifying the shadcn/ui components or adding new ones.