Thanks to visit codestin.com
Credit goes to Github.com

Skip to content
/ better-auth-starter Public template

A modern Next.js boilerplate with authentication, admin dashboard, and user management built with Better Auth, Drizzle ORM, and PostgreSQL

License

Notifications You must be signed in to change notification settings

zexahq/better-auth-starter

Repository files navigation

Zexa Auth Starter

A modern, production-ready Next.js boilerplate with comprehensive authentication, admin dashboard, and user management features. Built by Zexa for rapid application development.

✨ Features

πŸ” Authentication

  • Email & Password Authentication with email verification
  • Session Management with secure token handling
  • Account Linking support
  • Role-based Access Control (Admin, User roles)

πŸ‘₯ User Management

  • User Registration & Login with form validation
  • Email Verification system
  • Profile Management
  • User Banning/Unbanning with expiration dates
  • Session Revocation for security

πŸ›‘οΈ Admin Dashboard

  • User Management Interface - View, edit, ban/unban users
  • Role Assignment - Manage user permissions
  • User Actions - Delete users, revoke sessions
  • Responsive Admin UI with modern design

Admin Panel image

🎨 UI/UX

  • Modern Design System with Tailwind CSS
  • Responsive Layout for all devices
  • Component Library with Radix UI primitives
  • Form Validation with React Hook Form + Zod
  • Toast Notifications for user feedback

πŸ› οΈ Tech Stack

  • Framework: Next.js 16 with App Router
  • Authentication: Better Auth
  • Database: PostgreSQL with Drizzle ORM
  • Styling: Tailwind CSS
  • UI Components: Radix UI
  • Form Handling: React Hook Form
  • Validation: Zod
  • Email: Resend
  • TypeScript: Full type safety

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • Resend account (for email functionality)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd zexa-auth-starter
  2. Install dependencies

    pnpm install
  3. Environment Setup

    Copy the .env.example file to .env.local and fill in the values.

    cp .env.example .env.local
  4. Database Setup

    # Generate and run migrations
    pnpm db:generate
    pnpm db:migrate
  5. Start Development Server

    pnpm dev

Visit http://localhost:3000 to see your application!

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”œβ”€β”€ admin/             # Admin dashboard pages
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ auth/              # Authentication pages
β”‚   └── dashboard/         # User dashboard
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ admin/            # Admin-specific components
β”‚   β”œβ”€β”€ auth/             # Authentication forms
β”‚   β”œβ”€β”€ landing/          # Landing page components
β”‚   └── ui/               # Reusable UI components
β”œβ”€β”€ db/                   # Database configuration
β”œβ”€β”€ lib/                  # Utility libraries
└── utils/                # Helper functions

πŸ”§ Available Scripts

  • pnpm dev - Start development server with Turbopack
  • pnpm build - Build for production
  • pnpm start - Start production server
  • pnpm lint - Run ESLint
  • pnpm db:generate - Generate database migrations
  • pnpm db:migrate - Run database migrations
  • pnpm db:push - Push database migrations to the database
  • pnpm db:studio - Open the Drizzle ORM Studio

πŸ”‘ Key Features Explained

Authentication Flow

  1. Registration: Users sign up with email/password
  2. Email Verification: Automated email verification process
  3. Login: Secure session-based authentication

Admin Features

  • User Management: Full CRUD operations on user accounts
  • Role Management: Assign and modify user roles
  • Security Actions: Ban users, revoke sessions, delete accounts
  • Audit Trail: Track user actions and changes

πŸš€ Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy!

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

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

πŸ™‹ Support

For support and questions:

  • Create an issue in this repository
  • Contact Zexa team

Built with ❀️ by Zexa

Ready to build something amazing? Get started with Zexa Auth Starter today!

About

A modern Next.js boilerplate with authentication, admin dashboard, and user management built with Better Auth, Drizzle ORM, and PostgreSQL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published