MIT licensed, no license keys or attribution requirements, free to modify and use commercially
nextjs-starter-kit — Next.js SaaS Template
By RashadAnsari
A self-hosted SaaS starter template built on Next.js, integrating authentication, Postgres, transactional email, object storage, and subscription billing, with Docker and Ansible deployment scripts.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Preview provided in the project README.
One original preview is available. Open the full image to inspect the design.
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
Authentication, Postgres, SMTP email, S3-compatible storage, and subscription billing interface work out of the box
Billing interface is decoupled from vendors, currently implemented with Paddle, with signed webhook replay protection
Includes CSP and security response headers, post-login redirect validation, and per-user isolated storage prefixes
Provides Docker, GitHub Actions, and Ansible deployment scripts, with automatic database backups
Built-in landing page, pricing page, dashboard, settings page, and privacy/terms/refund policy pages
Template Details
This is a self-hosted SaaS foundation template for subscription products, released under the MIT license. It pre-builds the common but repetitive parts—login, billing, email, storage, and deployment—so you can start writing your own business logic.
The stack centers on the Next.js App Router with React, TypeScript, and Tailwind CSS; the database is Postgres, accessed via the pg driver and a thin repository layer, with migrations managed as plain SQL files. Authentication is provided by Better Auth with email/password registration, mandatory email verification, password reset, and session-aware route protection. Email goes through SMTP (nodemailer) with branded HTML templates; file uploads are S3-compatible, isolated by user prefix, and generate short-lived signed URLs; subscription billing defines a vendor-agnostic interface, currently implemented with Paddle, and handles signed webhooks with replay protection. Analytics uses Google Analytics 4 loaded only after user consent, with a GDPR-compliant consent banner.
The template includes landing, pricing, dashboard, settings, authentication flows, 404, and privacy/terms/refund policy pages, plus a test suite covering funding and access paths. For operations, it provides Docker builds, GitHub Actions, and Ansible playbooks to deploy the app and database to your own server, with automatic database backups to object storage.
Before use, note: the repository provides readable low-level primitives, not a design system or drag-and-drop admin; it is not tied to a particular hosting platform, but accordingly requires you to set up and maintain external services such as servers, databases, SMTP, and storage. The code itself is free; external services like domains, hosting, databases, and payments may incur separate charges; third-party assets such as demo images, fonts, and icons must be checked against their respective licenses.
Is it right for your project?
Use Cases
- Building a subscription SaaS product from scratch that requires self-hosted infrastructure
- Adding authentication, billing, email, and object storage capabilities to an existing Next.js project
- Learning or referencing concrete implementations of a Postgres repository layer, webhook idempotency, and consent-based analytics
- Teams that need to deploy the app and database to their own servers and configure automatic backups
Suitable For
- Developers or small teams who want to own and control their own servers, databases, and storage
- Engineers who prefer reading and modifying plain Next.js and plain SQL code rather than configuring someone else's abstraction layer
- Projects launching subscription products that need replaceable billing and email vendors
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
After cloning, run bun install, copy .env.example to .env.local, and fill in the required variables
- 2
The minimal configuration to start is DATABASE_URL, BETTER_AUTH_SECRET, and SMTP credentials; the rest are optional
- 3
Generate the authentication secret with openssl rand -base64 32
- 4
Locally, start Postgres with make up, apply migrations with make migrate, and start the dev server with make dev
- 5
When PAYMENT_PROVIDER is left empty, new users get three months of free access, making it easy to first run through the flow from registration to dashboard
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis entry covers the free version under the MIT license in the public repository; the free scope is the code of that version and does not mean external services or third-party assets are free.
Must comply with when using
- You may use, modify, use commercially, and distribute the code of this version for free.
- When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
- The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.
Additional costs & items to verify
- Running the template requires at least DATABASE_URL, BETTER_AUTH_SECRET, and SMTP credentials; without SMTP credentials, verification emails cannot be delivered and registration cannot be completed.
- When no payment provider is configured, new users get three months of free access by default; this is placeholder behavior in the template, and you must integrate billing logic before going live.
- Although the billing interface is decoupled from vendors, only Paddle is currently implemented; using other payment services requires implementing your own adapter layer.
- Analytics depends on the external Google Analytics 4 service and loads only after user consent; you must set up a GA4 account and configuration before use.
- File storage depends on an external S3-compatible object storage service; you must prepare a bucket and access credentials yourself.
- Deploying to your own server relies on Docker, GitHub Actions, and Ansible, and requires you to maintain the server, database, and object storage backup target yourself.
- The template provides only low-level primitives, not a design system or drag-and-drop admin; interfaces and components must be built yourself.
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
- External services such as domains, hosting, databases, payments, or AI may incur separate charges.
View Original Text Basis
Permission is hereby granted, free of charge
Original License Text
The only values you need to get running are `DATABASE_URL` (already correct for the bundled compose file), `BETTER_AUTH_SECRET`, and SMTP credentials so verification emails can be delivered.
Original README
with `PAYMENT_PROVIDER` empty the app grants each new user three months of free access
Original README
Paddle implemented, signed webhooks with replay protection
Original README
Google Analytics 4 that loads only after consent
Original README
S3-compatible uploads, per-user key prefixes, short-lived signed URLs
Original README
A Docker build, GitHub Actions, and Ansible playbooks put the app and its database on a machine you control, with automated backups to object storage.
Original README
https://github.com/RashadAnsari/nextjs-starter-kit/blob/master/LICENSEhttps://github.com/RashadAnsari/nextjs-starter-kit/blob/master/README.mdThis deliberately ships primitives, not a design system.
Original README
Compiled by DeepSeek based on repository license and README ·2026-10-03. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- Partly documented · 73 / 100
- Technologies
- Next.js · React
- Website type
- SaaS · Starter
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2026-08-02
- Screenshot last checked
- 2026-10-03
No demo link is recorded. Use the repository instructions to evaluate the project locally; the screenshot alone cannot establish interactive behavior.
The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Automatically checked against source and license rules; no manual editorial review.
Inspect the recorded source material
SHA-256: 93cad87f29d0754a49f384134c7d5d2512027c9fa018b6aa6efe58cd6a9210ae
2026-10-03T02:52:15.634Z
Source file / repository# Next.js Starter Kit **Stop rebuilding login, billing, and deploys. Start on the part that is actually yours.** A complete, self-hosted SaaS foundation: authentication, Postgres, transactional email, object storage, subscriptions, GDPR-compliant analytics, and a one-command deploy to a server you own. [](https://github.com/RashadAnsari/nextjs-starter-kit/actions/workflows/build.yml) [](LICENSE) [](https://codecov.io/gh/RashadAnsari/nextjs-starter-kit)       | | | | --------------------------------------------- | --------------------------------------- | |  |  | Every screen above is in the repository and runs on a fresh clone. ## Why this one Most starter kits ask you to pick a side: pay a few hundred euros for a closed template, or accept a stack welded to one vendor's hosting, database, and auth. This one is neither. - **It is yours.** MIT, free, no licence key, no attribution. - **No vendor lock-in.** Postgres over the plain `pg` driver, S3-compatible storage, any SMTP relay, and a billing interface with one provider implemented behind it. Every piece is swappable because nothing is welded to a platform SDK. - **It deploys to your own server.** A Docker build, GitHub Actions, and Ansible playbooks put the app and its database on a machine you control, with automated backups to object storage. - **You can read all of it.** Plain Next.js, plain SQL, and a thin repository layer. No generated code and no hidden framework. - **The security details are already right.** Webhook replay protection, redirect validation, per-user storage prefixes, a real CSP, and consent-gated analytics, with a [test suite](docs/TECHNICAL.md#testing) holding them in place. ### Who it is for Someone starting a subscription product who wants to own their infrastructure, and who would rather adapt readable code than configure someone else's abstraction. **Probably not for you if** you want a one-click hosted platform, a drag-and-drop admin panel, or a kit that picks a UI component library for you. This deliberately ships primitives, not a design system. ## What's inside | Area | What you get | | ------------- | ---------------------------------------------------------------------------------------------------------------- | | **Framework** | Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS 4 | | **Auth** | Better Auth with email and password, required email verification, password reset, session-aware route protection | | **Database** | Postgres over `pg`, a repository layer, and a migration runner for plain SQL files | | **Email** | SMTP through nodemailer, with branded HTML templates | | **Payments** | Provider-agnostic billing interface, Paddle implemented, signed webhooks with replay protection | | **Storage** | S3-compatible uploads, per-user key prefixes, short-lived signed URLs | | **Analytics** | Google Analytics 4 that loads only after consent, plus a GDPR-compliant consent banner | | **Security** | CSP and security headers, safe post-auth redirects, webhook idempotency | | **Pages** | Landing, pricing, dashboard, settings, auth flows, 404, and privacy/terms/refund policies | | **Tests** | 97 tests over the money and access paths, run by `make test` and in CI | | **Ops** | Docker build, GitHub Actions, Ansible playbooks, automated database backups to object storage | ## Quick start ```bash git clone https://github.com/RashadAnsari/nextjs-starter-kit.git my-app cd my-app rm -rf .git && git init # start your own history ``` Then: ```bash bun install cp .env.example .env.local # then fill in the required values make up # local Postgres on port 5432 make migrate # apply db/migrations make dev # http://localhost:3000 ``` The only values you need to get running are `DATABASE_URL` (already correct for the bundled compose file), `BETTER_AUTH_SECRET`, and SMTP credentials so verification emails can be delivered. Everything else is optional: with `PAYMENT_PROVIDER` empty the app grants each new user three months of free access, so the whole signup-to-dashboard path works before you set up billing. Generate the auth secret with: ```bash openssl rand -base64 32 ``` ## Documentation The [technical guide](docs/TECHNICAL.md) covers the rest: what to change to make it yours, how each piece works and why, and how to test and deploy it. | Section | What it answers | | ------------------------------------------------------------ | ----------------------------------------------------------------------- | | [Make it yours](docs/TECHNICAL.md#make-it-yours) | Renaming, colours, icons, plan, legal pages, and what is safe to delete | | [Project layout](docs/TECHNICAL.md#project-layout) | Where everything lives | | [How the pieces work](docs/TECHNICAL.md#how-the-pieces-work) | Auth, database, email, payments, storage, consent, SEO, env vars, CSP | | [Testing](docs/TECHNICAL.md#testing) | What is covered, what is deliberately not, and the pattern to copy | | [Deployment](docs/TECHNICAL.md#deployment) | The two compose stacks, the playbooks, and database backups | | [Commands](docs/TECHNICAL.md#commands) | Every `make` target | ## Contributing Fixes, dependency bumps, and documentation that saves someone an hour are all welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for what is in scope and the checks a pull request has to pass. Read [AGENTS.md](AGENTS.md) first: it carries the conventions this codebase actually follows. Found a security issue? Please do not open a public issue. Use [private vulnerability reporting](https://github.com/RashadAnsari/nextjs-starter-kit/security/advisories/new) on the Security tab instead. ## License [MIT](LICENSE). Use it for anything, including commercial work, with no attribution required.
Explore similar templates
Compare previews and descriptions within the same stack and category.

Next.js SaaS Starter
The official Next.js SaaS starter template, integrating email/password authentication, Stripe Checkout subscriptions, a dashboard with user/team CRUD, basic Owner/Member RBAC, and activity logging.
Next.js · SaaS

Next.js Commerce
Vercel's officially maintained Next.js App Router ecommerce starter with deep Shopify integration, offering a complete product catalog, cart, and checkout flow. Core logic is modular for swapping backends, and community provider versions exist for BigCommerce, Medusa, and Saleor.
Next.js · E-commerce

Next-js-Boilerplate
A developer-first Next.js 16 starter with Tailwind CSS 4 and TypeScript, supporting both App Router and Page Router.
Next.js · Starter

tailwind-nextjs-starter-blog
A Next.js and Tailwind CSS blog starter template using Contentlayer for Markdown/MDX, with built-in SEO, code highlighting, and tags. It targets personal technical blogs and migration from Jekyll/Hugo to React, and supports one-click Vercel deployment.
Next.js · Blog

next-forge
next-forge is a Turborepo-based Next.js template maintained by Vercel, positioned as a starting point for SaaS products.
Next.js · Starter

SaaS-Boilerplate
SaaS-Boilerplate is an open-source SaaS starter template built with Next.js App Router, React 19, TypeScript, Tailwind CSS, and Shadcn UI.
Next.js · SaaS
