BetterAuthKit: The Ultimate Next.js 15 Auth Starter You’ve Been Waiting For
Abdullah

Abdullah @abdullah-dev0

About: Passionate Full-Stack Developer Skilled in the MERN stack and Next.js, I am dedicated to creating and improving web applications.

Location:
Pakistan
Joined:
May 12, 2024

BetterAuthKit: The Ultimate Next.js 15 Auth Starter You’ve Been Waiting For

Publish Date: Jun 16
0 1

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
Enter fullscreen mode Exit fullscreen mode

2. Install Dependencies

npm install
Enter fullscreen mode Exit fullscreen mode

3. Configure Your .env.local

cp .env.example .env.local
Enter fullscreen mode Exit fullscreen mode

Add your credentials for Neon, Google OAuth, and SMTP in .env.local.

4. Set Up the Database

npx prisma generate
npx prisma db push
Enter fullscreen mode Exit fullscreen mode

5. Start the Development Server

npm run dev
Enter fullscreen mode Exit fullscreen mode

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:

  1. Push to GitHub
  2. Import to Vercel
  3. Add your environment variables
  4. Connect your Neon DB
  5. 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.

🔗 Check it out on GitHub


🙌 Support & Contributions

If you find this project helpful, please consider giving it a ⭐️ on GitHub. Contributions and feedback are welcome!

Comments 1 total

  • ITSupport
    ITSupportJun 16, 2025

    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

Add comment