SaaS
Next.js SaaS boilerplate architecture
A small App Router layout for accounts, a dashboard, and a billing route, and how it differs from a full SaaS kit.
A boilerplate is the smallest project you can still call a SaaS: a router, a user table, a session, and one place that starts a payment. The Next.js SaaS Boilerplate is that project. It is Next.js 15 on the App Router, TypeScript, Tailwind, Prisma 6, and a Stripe Checkout route. It is not the Complete SaaS Starter Kit.
Folders that should exist on day one
src/app/page.tsx marketing
src/app/login/page.tsx sign in
src/app/login/actions.ts credentials check
src/app/dashboard/page.tsx signed-in home
src/app/pricing/page.tsx plan list
src/app/api/stripe/checkout starts Checkout
src/lib/auth.ts current user
src/lib/db.ts Prisma client
prisma/schema.prisma
Pages stay thin. currentUser() lives in src/lib/auth.ts so a server component and a route handler share one session read. Prisma is constructed once in src/lib/db.ts. The Stripe client is a function that throws if STRIPE_SECRET_KEY is missing, which fails the request instead of sending an empty key.
Database choice
The boilerplate schema uses SQLite:
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
DATABASE_URL is a file URL such as file:./dev.db. That is enough to run npx prisma db push and sign in locally. The schema is ordinary Prisma, so pointing provider at postgresql later does not change the User fields. Do that when you need concurrent writes. The Complete kit starts on PostgreSQL because it assumes a deployed database from the first commit.
What the boilerplate leaves out
There is a Checkout route and a plan field. There is no Customer Portal route, no webhook that downgrades a canceled subscription, and no Docker Compose file. If a customer cancels in Stripe and nothing updates plan, your dashboard will keep showing the old value. That gap is the subject of Stripe webhooks with Next.js.
Use this layout when you want to read every file in an afternoon. Move to the Complete kit, or add the Stripe Subscription Starter, when cancellation and the portal have to work.
Deploy notes
next build then next start is the Node path. On Vercel, set DATABASE_URL, AUTH_SECRET, and the Stripe keys in the project environment. SQLite on a serverless disk is a local convenience, not a production database. Switch the datasource before you invite a second user.
Want to skip the setup? The Next.js SaaS Boilerplate is the short path: App Router, accounts, dashboard, and a billing route.