DEV Community

Habib Jutt
Habib Jutt

Posted on

I built a free Next.js SaaS boilerplate because I was tired of rebuilding auth and payments from scratch

Every SaaS project I started had the same first two weeks: set up authentication, wire up Stripe, build an admin panel, configure emails, create a blog. By the third time around, I decided to just package everything into one starter and open-source it.

What this is

A production-ready Next.js boilerplate for SaaS applications. It ships with the boring-but-necessary stuff already done so you can focus on the thing that actually makes your product different.

GitHub: github.com/habibjutt/nextjs_boilerplate
Live demo: nextjssaas.netlify.app

What's in the box

Authentication

  • Email/password, Google, GitHub, and Apple sign-in
  • Two-factor authentication (TOTP)
  • Email verification (toggleable via env var)
  • Password reset flow
  • Session management

All powered by Better Auth, which I picked over NextAuth because it handles edge cases around session management more reliably in my experience.

Payments

  • Stripe integration with subscriptions and one-time payments
  • Customer portal for managing billing
  • Webhook handling for payment events
  • Configurable pricing plans

Admin dashboard

  • User management (view, edit, delete, assign roles)
  • Role-based access control with custom roles
  • Analytics overview
  • Activity logs

Blog CMS

  • MDX-powered content
  • Categories and tags
  • SEO metadata per post

Other stuff

  • 50+ UI components (shadcn/ui)
  • Dark mode
  • Transactional emails via React Email + Resend
  • Full SEO setup with structured data
  • Responsive design, mobile-first

Tech stack

Layer Tech
Framework Next.js 16 (App Router)
Language TypeScript
Database PostgreSQL + Prisma ORM
Styling Tailwind CSS
UI shadcn/ui + Radix
Auth Better Auth
Payments Stripe
Email React Email + Resend

Getting started

git clone https://github.com/habibjutt/nextjs_boilerplate.git
cd nextjs_boilerplate
npm install
cp .env.example .env
# Fill in your env vars (Stripe keys, database URL, etc.)
npx prisma migrate dev
npm run dev
Enter fullscreen mode Exit fullscreen mode

The .env.example file has comments explaining each variable. Most features can be toggled on or off through environment variables - for example, you can disable email verification or two-factor auth with a single flag.

Why I'm sharing this

I built this primarily for myself, but figured it might save other people some time too. It's MIT licensed with no premium tier or gated features.

If you try it out, I'd appreciate feedback. And if you find it useful, a GitHub star helps with visibility.

Contributions are welcome - whether it's bug fixes, new features, or just pointing out something that could be better.


Links:

Top comments (0)