nextjs_drizzle_better-auth is a starter kit for building modern full-stack web applications.
It integrates Next.js for frontend and API development with Drizzle ORM for type-safe database operations, Better Auth for secure authentication, and NeonDB for serverless PostgreSQL database hosting.
The combination of these technologies enables you to create scalable, secure, and performant web applications without spending excessive time on initial setup and configuration.
Features
🛡️ Better Auth integration for secure authentication with multiple providers (Google, GitHub)
☁️ NeonDB serverless PostgreSQL database support
📧 Resend API integration for email-based authentication
💻 Full TypeScript support throughout the application
🔄 Database migration tools for schema management
🚀 Next.js-powered frontend with server-side rendering capabilities
📊 Drizzle ORM for type-safe database operations and migrations
🔒 Built-in authentication schema generation through Better Auth CLI
👤 Multi-provider authentication (Google, GitHub, email)
Use Cases
- SaaS Applications: Build multi-tenant software-as-a-service platforms with secure user management and data isolation.
- Internal Tools: Develop company dashboards or administrative panels requiring authenticated access and database operations.
- E-commerce Sites: Create online stores needing user accounts, order history, and product management backed by a reliable database.
- Project Prototyping: Quickly set up a full-stack application environment to test ideas with built-in authentication and database support.
- Learning Modern Stacks: Explore the integration of Next.js, Drizzle, Better Auth, and serverless databases in a practical project.
Development
1. Clone the repository:
git clone https://github.com/RvDstudio/nextjs_drizzle_better-auth.git
cd nextjs_drizzle_better-auth2. Install dependencies:
pnpm install3. Set up environment variables by creating a .env file with the following:
DATABASE_URL=your_neon_db_url
BETTER_AUTH_SECRET=your_better_auth_secret
BETTER_AUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
RESEND_API_KEY=your_resend_api_key4. Generate authentication schema using Better Auth CLI:
npx @better-auth/cli generate5. Copy the generated schema to your Drizzle schema in the db folder.
6. Generate and push the database schema:
npx db:generate
npx db:push7. Start the development server:
pnpm run dev8. Access your application at http://localhost:3000
Related Resources
- Next.js Documentation: https://nextjs.org/docs – Official documentation for the Next.js framework.
- Drizzle ORM Documentation: https://orm.drizzle.team/docs/overview – Learn more about using Drizzle ORM for type-safe database access.
- Better Auth Documentation: https://better-auth.dev/ – Explore the features and setup for Better Auth. (Note: Check for the official documentation link if available).
- NeonDB Documentation: https://neon.tech/docs – Documentation for the serverless PostgreSQL provider.
Preview







