Authentication is often one of the most time-consuming and error-prone parts of building modern web applications. Whether you're launching a SaaS platform, building a dashboard, or experimenting with a personal project, having a secure and scalable auth system is non-negotiable.
That’s why I built BetterAuthKit — a production-ready authentication boilerplate powered by Next.js 15, BetterAuth, and Neon PostgreSQL, designed to help developers ship faster without compromising security or best practices.
🚀 Why BetterAuthKit?
BetterAuthKit takes care of all the essentials you need in a modern authentication system:
- ✅ Google OAuth & Email/Password login
- 🔒 Domain-based email restrictions (
@gmail.com
by default) - 📧 Secure password reset via email
- 💻 Built with the latest Next.js 15 (App Router)
- 🛡️ Security-first design with JWT sessions & hashed credentials
- 🌱 Seamless integration with Neon (PostgreSQL) and Prisma
- ⚙️ Fully typed with TypeScript
🧰 Tech Stack Overview
Tech | Role |
---|---|
Next.js 15 | Fullstack React framework |
BetterAuth | Authentication layer |
Prisma ORM | Database ORM for Postgres |
Neon | Scalable PostgreSQL hosting |
Nodemailer | Email sending & reset links |
TypeScript | Type-safe codebase |
🧑💻 Features at a Glance
🔐 Email + Password Login
Fully secured and hashed with bcrypt, ready for production.🟢 Google OAuth Integration
Fast and easy social login using your Google credentials.📬 Password Reset via Email
Users can reset their password using a secure, time-bound link.🛂 Gmail Domain Restriction
Restrict login and sign-up to specific domains — useful for internal tools or private betas.🧼 Clean & Scalable Codebase
Follows modern development patterns with a modular structure and strong TypeScript support.
🔧 Getting Started in 5 Steps
1. Clone the Repo
git clone https://github.com/Abdullah-dev0/better-auth-kit.git
cd better-auth-kit
2. Install Dependencies
npm install
3. Configure Your .env.local
cp .env.example .env.local
Add your credentials for Neon, Google OAuth, and SMTP in .env.local
.
4. Set Up the Database
npx prisma generate
npx prisma db push
5. Start the Development Server
npm run dev
Visit http://localhost:3000 and you're live!
🔐 Security Highlights
- Passwords hashed with
bcrypt
- JWT session strategy for secure login
- Domain-based access control
- All sensitive data handled via
.env.local
- CSRF and token expiration handling included
🌍 Ready to Deploy
BetterAuthKit is 100% deployable on Vercel:
- Push to GitHub
- Import to Vercel
- Add your environment variables
- Connect your Neon DB
- Done! ✅
⭐ Final Thoughts
BetterAuthKit is more than just a starter — it's a scalable, production-grade foundation for your next web app. Whether you're building an admin dashboard, internal tool, or public product, it saves you countless hours and sets you up for long-term maintainability.
🙌 Support & Contributions
If you find this project helpful, please consider giving it a ⭐️ on GitHub. Contributions and feedback are welcome!
Great news! Dev.to is distributing a limited-time token giveaway to celebrate our authors' impact in Web3. Don’t miss this opportunity here. for verified Dev.to users only. – Dev.to Team