Back to components
Authentication component
JB Better Auth UI
Production-ready authentication — sign-in, sign-up, OAuth, password reset.
Install
$ Run in your project root
pnpm dlx shadcn@latest add https://better-auth-ui.desishub.com/r/auth-components.jsonWhat it does
- 8 auth components (SignIn, SignUp, VerifyEmail, ForgetPassword, ResetPassword, ChangePassword, Profile, LogoutButton)
- OTP-based email verification and password reset
- Includes Prisma schema, validation schemas, API route handlers
- OAuth integration with Google and GitHub
- Email templates and env var configuration
When to use
Use it
Every project that needs authentication. This is the default auth solution.
Skip it
Non-PostgreSQL databases, or projects needing custom auth logic outside this structure.
Prerequisites
- Next.js 16 + shadcn/ui
- PostgreSQL (Neon / Supabase)
- Resend account
Environment variables
| Name | Description |
|---|---|
| BETTER_AUTH_SECRET | Random 32+ char string |
| BETTER_AUTH_URL | Full app URL (e.g. http://localhost:3000) |
| DATABASE_URL | PostgreSQL connection string |
| RESEND_FROM_EMAIL | Verified sender (e.g. noreply@yourdomain.com) |
| RESEND_API_KEY | From Resend dashboard |
| GOOGLE_CLIENT_ID | Optional — Google OAuth |
| GOOGLE_CLIENT_SECRET | Optional — Google OAuth |
| GITHUB_CLIENT_ID | Optional — GitHub OAuth |
| GITHUB_CLIENT_SECRET | Optional — GitHub OAuth |
Files & routes added
- /auth/sign-in
- /auth/sign-up
- /auth/verify-email
- /auth/forgot-password
- /auth/reset-password
- /auth/change-password
- /auth/profile
- /dashboard
- /api/auth/[...all]/route.ts
- Prisma schema additions