Next.js SaaS Starter — Auth + Stripe Subscriptions, Customer Portal & Webhooks
Accounts, Free/Pro/Team plans, Stripe Checkout, the Customer Portal and webhook-synced subscription status — tested and ready to build your product on.
Every SaaS needs the same plumbing before it can earn a dollar: sign-up and login, pricing plans, recurring payments, a place for customers to manage billing, and a reliable way to know who has paid. This starter gives you all of it in a clean Next.js 14 codebase you can read in an afternoon.
Users sign up, pick a plan, and pay through Stripe Checkout. Stripe's webhooks keep your database in sync on upgrades, downgrades, failed payments and cancellations. The webhook handling is signed, idempotent and safe against out-of-order events. One helper, effectivePlan(), tells you what to unlock.
Features:
- Next.js 14 App Router, TypeScript, Tailwind CSS
- Email + password auth with scrypt hashing and database sessions (tokens stored hashed, HttpOnly cookies, real logout)
- CSRF origin check, rate limiting, and no account enumeration on login
- Free / Pro / Team plans, monthly and yearly, defined in one file
- Stripe Checkout in subscription mode (promo codes enabled), one Stripe customer per user
- Stripe Customer Portal for plan changes, card updates, invoices and cancellation
- Signed webhooks synced to a local subscriptions table: duplicate-safe, out-of-order-safe, retry-friendly
- Protected dashboard and simple feature gating
- SQLite with zero setup; README guide for moving to Postgres on Vercel
- 14 tests (Vitest, real Stripe signature checks); type-checks and builds clean
What you get:
- Full source code (Next.js 14, React 18, Tailwind 3, Stripe SDK, Zod, better-sqlite3)
- Test suite and .env.example
- A detailed README: 10-minute Stripe test-mode setup, local webhooks with the Stripe CLI, architecture, API reference, deploy guide and go-live checklist, plus recipes for trials, seats and OAuth
- MIT license, for unlimited personal and commercial projects
- Instant download (.zip)