A simple Next.js starter template that provides a basic authentication setup using Better Auth. It is intended to be used as a starter or template for new projects.
- Framework: Next.js (App Router)
- Authentication: Better Auth
- Database: PostgreSQL (pg)
- Styling: Tailwind CSS, shadcn/ui
- Forms & Validation: React Hook Form, Zod
- Email: Resend
- Email and password authentication
- GitHub OAuth authentication
- Login page
- Register page
- Protected dashboard page
- Session validation
First, clone the repository and install the dependencies:
npm installCreate a .env file in the root directory and add the following variables:
BETTER_AUTH_SECRET=
BETTER_AUTH_URL=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
DATABASE_URL=
RESEND_API_KEY=Start the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
.
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── (auth)/ # Authentication pages
│ │ ├── api/ # API routes
│ │ └── dashboard/ # Protected dashboard pages
│ ├── components/ # Reusable UI components
│ ├── layout/ # Layout definitions
│ └── lib/ # Core utilities and auth configuration
├── public/ # Static assets
└── package.json # Project dependencies and scripts

