Give this skill to your AI — it will guide you through the entire process of building a robust authentication system in Next.js. The workflow encompasses UI component integration (Tailwind CSS, Sonner), core configuration via Better Auth, database setup with Drizzle ORM and PostgreSQL, OAuth integration (Google), email service configuration (Resend), and route protection via proxy.
templates/ directory. Then, tell them: "Here is the structure of what will be copied to your project."Project Root
├── tailwind.config.ts → templates/config/tailwind.config.ts
├── lib/
│ └── utils.ts → templates/lib/utils.ts
├── app/
│ ├── layout.tsx → templates/pages/layout.tsx
│ ├── globals.css → templates/config/globals.css
│ ├── page.tsx → templates/pages/home-page.tsx
│ ├── login/page.tsx → templates/pages/login-page.tsx
│ └── reset-password/page.tsx → templates/pages/reset-password-page.tsx
└── components/
├── forms/
│ ├── login-form.tsx → templates/forms/login-form.tsx
│ ├── register-form.tsx → templates/forms/register-form.tsx
│ ├── forgot-password-form.tsx → templates/forms/forgot-password-form.tsx
│ └── reset-password-form.tsx → templates/forms/reset-password-form.tsx
└── ui/
├── button.tsx → templates/ui/button.tsx
├── card.tsx → templates/ui/card.tsx
├── input.tsx → templates/ui/input.tsx
└── field.tsx → templates/ui/field.tsxreferences/toast-system.md. Instruct them to add <Toaster /> to app/layout.tsx and replace alert() placeholders with toast.success() and toast.error() in the form components..env for Auth (BETTER_AUTH_SECRET, BETTER_AUTH_URL).npm install command for auth dependencies./api/auth/[...all]/route.ts).getCurrentUser logic in app/page.tsx and integrate real signIn/signUp functions into the form components, removing the mock logic.proxy.ts (using references/route-protection.md)./dashboard) to intercept unauthenticated users and redirect them to /login..env for database connections.npm install command for database dependencies (Drizzle, Postgres driver).templates/db/schema.ts) and database connection setup..env variables guide and related logic code..env variables (RESEND_API_KEY and RESEND_FROM_EMAIL) and code for sending emails. Warn the user that if they do not set a verified domain for RESEND_FROM_EMAIL, emails to new users will fail due to Resend's sandbox restrictions.onSwitchTo* callbacks to handle form switching (e.g., switching from login to register)./^[^\s@]+@[^\s@]+\.[^\s@]+$/.Project Root
├── .env → templates/config/env.example
├── tailwind.config.ts → templates/config/tailwind.config.ts
├── postcss.config.js → templates/config/postcss.config.js
├── next.config.js → templates/config/next.config.js
├── drizzle.config.ts → templates/config/drizzle.config.ts
├── proxy.ts → templates/config/proxy.ts
├── db/
│ ├── drizzle.ts → templates/db/drizzle.ts
│ └── schema.ts → templates/db/schema.ts
├── lib/
│ ├── auth.ts → templates/lib/auth.ts
│ ├── auth-client.ts → templates/lib/auth-client.ts
│ └── utils.ts → templates/lib/utils.ts
├── server/
│ └── users.ts → templates/server/users.ts
├── app/
│ ├── layout.tsx → templates/pages/layout.tsx
│ ├── globals.css → templates/config/globals.css
│ ├── page.tsx → templates/pages/home-page.tsx
│ ├── login/page.tsx → templates/pages/login-page.tsx
│ ├── reset-password/page.tsx → templates/pages/reset-password-page.tsx
│ └── api/auth/[...all]/route.ts → templates/api/route.ts
└── components/
├── forms/
│ ├── login-form.tsx → templates/forms/login-form.tsx
│ ├── register-form.tsx → templates/forms/register-form.tsx
│ ├── forgot-password-form.tsx → templates/forms/forgot-password-form.tsx
│ └── reset-password-form.tsx → templates/forms/reset-password-form.tsx
└── ui/
├── button.tsx → templates/ui/button.tsx
├── card.tsx → templates/ui/card.tsx
├── input.tsx → templates/ui/input.tsx
└── field.tsx → templates/ui/field.tsx