MIT 许可,无许可证密钥与署名要求,可自由修改和商用
nextjs-starter-kit — Next.js SaaS模板
作者 RashadAnsari
基于 Next.js 的自托管 SaaS 启动模板,集成认证、Postgres、事务邮件、对象存储与订阅计费,并提供 Docker 与 Ansible 部署脚本。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
认证、Postgres、SMTP 邮件、S3 兼容存储与订阅计费接口开箱即用
计费接口与供应商解耦,当前实现 Paddle,并带签名 webhook 重放保护
包含 CSP 与安全响应头、登录后重定向校验、按用户隔离的存储前缀
提供 Docker、GitHub Actions 与 Ansible 部署脚本,支持数据库自动备份
内置落地页、定价页、仪表盘、设置页及隐私/条款/退款政策页面
模板详细介绍
这是一个面向订阅制产品的自托管 SaaS 基础模板,采用 MIT 许可发布。它把登录、计费、邮件、存储和部署等常见但重复的部分预先搭好,让你从自己的业务逻辑开始写。
技术栈以 Next.js App Router 为核心,配合 React、TypeScript 与 Tailwind CSS;数据库使用 Postgres,通过 pg 驱动和一层薄 repository 访问,迁移以纯 SQL 文件管理。认证由 Better Auth 提供邮箱密码注册、强制邮箱验证、密码重置和会话感知的路由保护。邮件走 SMTP(nodemailer)并带品牌化 HTML 模板;文件上传兼容 S3,按用户前缀隔离并生成短期签名 URL;订阅计费定义了一个与供应商无关的接口,目前实现了 Paddle,并处理带重放保护的签名 webhook。分析使用仅在用户同意后加载的 Google Analytics 4,并附带 GDPR 合规的同意横幅。
模板自带落地页、定价页、仪表盘、设置页、认证流程、404 以及隐私/条款/退款政策页面,另有覆盖资金与访问路径的测试套件。运维方面提供 Docker 构建、GitHub Actions 与 Ansible playbook,可将应用和数据库部署到自有服务器,并自动备份数据库到对象存储。
使用前需要注意:仓库提供的是可读的底层原语,而不是设计系统或拖拽式后台;它不绑定某一家托管平台,但相应地也要求你自行准备并维护服务器、数据库、SMTP 和存储等外部服务。代码本身免费,域名、托管、数据库、支付等外部服务可能另行收费;演示图片、字体、图标等第三方素材需按各自许可单独核对。
适合你的项目吗?
适用场景
- 从零搭建需要自托管基础设施的订阅制 SaaS 产品
- 为已有 Next.js 项目补充认证、计费、邮件与对象存储等基础能力
- 学习或参考 Postgres 仓储层、webhook 幂等与同意式分析的具体实现
- 需要将应用与数据库部署到自有服务器并配置自动备份的团队
适合人群
- 希望拥有并控制自己服务器、数据库和存储的开发者或小团队
- 偏好阅读和修改纯 Next.js、纯 SQL 代码,而不是配置他人抽象层的工程师
- 正在启动订阅制产品、需要可替换计费与邮件供应商的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
克隆后运行 bun install,复制 .env.example 为 .env.local 并填写必要变量
- 2
启动所需的最小配置为 DATABASE_URL、BETTER_AUTH_SECRET 和 SMTP 凭据,其余可选
- 3
使用 openssl rand -base64 32 生成认证密钥
- 4
本地通过 make up 启动 Postgres、make migrate 应用迁移、make dev 启动开发服务器
- 5
PAYMENT_PROVIDER 留空时新用户获得三个月免费访问,便于先跑通注册到仪表盘的流程
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 运行模板至少需要配置 DATABASE_URL、BETTER_AUTH_SECRET 和 SMTP 凭据;缺少 SMTP 凭据时验证邮件无法送达,注册流程无法完成。
- 未配置支付提供商时,新用户默认获得三个月免费访问权限;这是模板的占位行为,正式上线前需自行接入计费逻辑。
- 计费接口虽与供应商解耦,但当前仅实现了 Paddle;使用其他支付服务需自行实现适配层。
- 分析功能依赖 Google Analytics 4 外部服务,且仅在用户同意后加载;使用前需自行准备 GA4 账号与配置。
- 文件存储依赖 S3 兼容的外部对象存储服务,需自行准备存储桶与访问凭据。
- 部署到自有服务器依赖 Docker、GitHub Actions 与 Ansible,并要求自行维护服务器、数据库及对象存储备份目标。
- 模板只提供底层原语,不含设计系统或拖拽式后台;界面与组件需自行搭建。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
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.
README 原文
with `PAYMENT_PROVIDER` empty the app grants each new user three months of free access
README 原文
Paddle implemented, signed webhooks with replay protection
README 原文
Google Analytics 4 that loads only after consent
README 原文
S3-compatible uploads, per-user key prefixes, short-lived signed URLs
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.
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.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 73 / 100
- 技术栈
- Next.js · React
- 网站类型
- SaaS · 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-08-02
- 截图检查日期
- 2026-10-03
目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: 93cad87f29d0754a49f384134c7d5d2512027c9fa018b6aa6efe58cd6a9210ae
2026-10-03T02:52:15.634Z
来源文件 / 仓库# 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.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

ai-website-cloner-template
Clone any website with one command using AI coding agents
Next.js · 启动器

Next.js SaaS Starter
Next.js SaaS Starter 是 Next.js 官方维护的 SaaS 起点模板,定位介于学习资源和可直接部署的脚手架之间。
Next.js · SaaS

Next.js Commerce
Next.js Commerce 是 Vercel 团队维护的电商启动模板,基于 Next.js App Router 构建,采用服务端渲染、React Server Components、Server Actions …
Next.js · 电商

Next-js-Boilerplate
Next-js-Boilerplate 是一个面向 Next.js 16、Tailwind CSS 4 和 TypeScript 的启动器,核心定位是开发者体验优先。
Next.js · 启动器

tailwind-nextjs-starter-blog
tailwind-nextjs-starter-blog 是一个面向个人技术博客的 Next.js 与 Tailwind CSS 启动模板,其 v2 版本基于 App Router 与 React Server Comp…
Next.js · 博客

next-forge
Production-grade Turborepo template for Next.js apps.
Next.js · 启动器
