A modern and extensible authentication template built using Next.js 15, BetterAuth, and Drizzle ORM. Designed for fast, secure, and scalable full-stack applications.
- ✅ Built with Next.js 15 App Router
- 🔐 Authentication powered by BetterAuth
- 💃 Drizzle ORM for type-safe PostgreSQL database access
- 📄 Zod schema validation
- 🌐 Social login (Google, GitHub)
- 🧪 Full form handling with React Hook Form
- 💅 UI powered by shadcn/ui and Tailwind CSS
- ⚙️ Built-in loading state, error handling, and form validation
| Tool | Purpose |
|---|---|
| Next.js 15 | Full-stack framework (App Router) |
| BetterAuth | Authentication (sign-up, sign-in, OAuth) |
| Drizzle ORM | SQL ORM for PostgreSQL |
| Zod | Input validation |
| React Hook Form | Form state management |
| Shadcn/UI | Accessible component library |
| Tailwind CSS | Utility-first CSS framework |
git clone https://github.com/DhavalBhimani44/authentication-template.git
cd authentication-templatepnpm installor
npm installCreate a .env file in the root directory and add:
DATABASE_URL =
BETTER_AUTH_SECRET =
BETTER_AUTH_URL =
GITHUB_CLIENT_ID =
GITHUB_CLIENT_SECRET =
GOOGLE_CLIENT_ID =
GOOGLE_CLIENT_SECRET =You can just rename .env.example to .env and add in your credentials.
Run migrations using Drizzle:
npm db:pushTo open drizzle studio on local pc:
npm db:studionpm run dev
# or
pnpm devThen open http://localhost:3000 in your browser.
- ✅ Add new providers in
authClient.signIn.social(...) - ✅ Update styles via Tailwind or shadcn themes
- ✅ Extend schema validations using Zod
- ✅ Swap database (e.g., MySQL, SQLite) via Drizzle
Created by Dhaval Bhimani
If you find this project helpful, please give it a ⭐️ on GitHub!