Next.jsReact后台SaaS启动器

surge — Next.js 后台模板

作者 The-DevOps-Daily

Surge 是一个基于 Next.js 的 AI 优先 SaaS 启动器,内置认证、Stripe 支付、管理后台、博客与文档引擎,并提供面向 AI 编码代理的约定文件、技能、MCP 服务器与 OpenAPI 规范。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

1 个预览视图
作者提供的预览
作者提供的预览首屏预览

来自项目 README 的原始预览。

目前有 1 张原始预览,可打开完整图片查看设计细节。

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-03查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

内置 NextAuth v5 认证流程,包含限流的注册、忘记密码、重置密码、修改密码和删除账户

02

集成 Stripe 结账、客户门户、webhook 与按层级的功能门控

03

提供管理后台,展示用户统计、MRR、增长图表、用户管理、博客内容清单和系统健康

04

博客与文档引擎共用 markdown frontmatter 渲染,支持阅读进度、目录、分享按钮、动态 OG 图片和原始 .md 路由

05

面向 AI 编码代理提供 CLAUDE.md、AGENTS.md、.claude/skills、.claude/agents、examples、MCP 服务器、OpenAPI 规范和 llms.txt

06

暗色模式优先的设计系统,使用 CSS 变量令牌和 Button、Input、Modal、ConfirmDialog、Toast 等基础组件

模板详细介绍

Surge 是 The DevOps Daily 开源的 Next.js SaaS 启动器,采用 MIT 许可。它把认证、支付、管理后台、博客和文档等常见 SaaS 模块预先搭好,并围绕 AI 编码代理补充了 CLAUDE.md、AGENTS.md、.claude/skills、.claude/agents、examples、MCP 服务器、OpenAPI 规范、llms.txt 以及可追加 .md 后缀的内容路由,目的是让开发者或 AI 代理在扩展项目时减少重新发现约定的成本。

功能层面,认证使用 NextAuth v5 的 credentials 与 JWT 会话,包含限流的注册、忘记密码、重置密码、修改密码和删除账户;支付使用 Stripe,覆盖结账、客户门户、webhook 和按层级的功能门控;管理后台展示用户统计、MRR、增长图表、用户管理、博客内容清单和系统健康;博客与文档引擎共用一套基于 markdown frontmatter 的渲染,支持阅读进度、目录、分享按钮、动态 OG 图片和原始 .md 路由;设计系统以暗色模式优先,使用 CSS 变量令牌和 Button、Input、Modal、ConfirmDialog、Toast 等基础组件。

技术栈方面,项目使用 Next.js App Router、TypeScript、Tailwind、Prisma,开发环境默认 SQLite、生产环境可切换 Postgres,并附带 Recharts、Vitest、Docker Compose 和 GitHub Actions。README 中提到的具体框架版本号未在本介绍中复述。

使用限制:仓库代码为 MIT 许可,但演示图片、字体、图标等第三方素材需单独核对许可;域名、托管、数据库、支付和邮件等外部服务可能产生费用。README 中关于 AI 代理节省 token 的说法属于项目自述,本介绍不将其作为性能承诺。

Next.js后台SaaS启动器

适合你的项目吗?

适用场景

  • 需要快速搭建带认证、订阅支付和管理后台的 SaaS 产品原型
  • 希望项目自带博客与文档引擎,并支持 markdown 内容与动态 OG 图片
  • 团队使用 Claude Code、Cursor 等 AI 编码工具,希望项目内置约定文件、技能和 MCP 服务器以减少重复说明
  • 需要自托管部署,使用 Docker Compose 打包应用、Postgres、Nginx 和 Certbot
  • 希望以 MIT 许可的代码作为起点,自行修改并商用

适合人群

  • 熟悉 Next.js、Prisma 和 Stripe 的开发者或小团队
  • 需要 SaaS 启动器并愿意自行配置数据库、支付和邮件等外部服务的项目
  • 使用 AI 编码代理辅助开发、看重项目内约定与工具链的团队
  • 接受暗色模式优先设计系统并计划在此基础上定制品牌的前端开发者

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    克隆仓库后执行 npm install,复制 .env.example 为 .env,并运行 Prisma 迁移与种子命令

  2. 2

    必须配置 DATABASE_URL、NEXTAUTH_SECRET 和 NEXTAUTH_URL;生产环境在代理后需设置 AUTH_TRUST_HOST=true

  3. 3

    启用支付需填写 Stripe 密钥、webhook 密钥和各价格 ID;启用邮件需填写 SMTPFAST_API_KEY 和发件邮箱

  4. 4

    本地调试 Stripe webhook 可使用 stripe listen --forward-to localhost:3000/api/stripe/webhook

  5. 5

    部署可选 Docker Compose、Vercel 或 VPS 脚本,但数据库、域名、支付和邮件等外部服务需另行准备并可能产生费用

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 启用邮件功能需注册 smtpfa.st 并获取 API Key(需 email:send 权限),属于外部服务依赖,可能产生费用。
  • 启用支付功能需在 Stripe 后台创建账户并获取密钥,属于外部服务依赖,可能产生费用。
  • 使用 Vercel 部署时需将数据库指向 Neon/Supabase/Railway 等外部托管服务,可能产生费用。
  • 低内存开发机不建议运行 npm run dev 或 npm run build,完整构建交由 CI 处理。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

`SMTPFAST_API_KEY` | for email | from https://smtpfa.st/api-keys with `email:send` scope

README 原文

`STRIPE_SECRET_KEY` | for payments | from Stripe dashboard

README 原文

**Vercel**: connect the repo, set env vars, point `DATABASE_URL` at Neon/Supabase/Railway.

README 原文

Don't run `npm run dev` or `npm run build` on a low-RAM dev box — CI handles full builds.

README 原文
https://github.com/The-DevOps-Daily/surge/blob/main/LICENSEhttps://github.com/The-DevOps-Daily/surge/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 76 / 100
技术栈
Next.js · React
网站类型
后台 · SaaS · 启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-05-22
截图检查日期
2026-10-04

目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

审核声明: [email protected] · 2026-10-04

查看当时使用的来源资料

SHA-256: 69e969f2474ebbd31596e283d10a45d1b393a4effce0b16e9e1ab88b50b3e701

2026-10-04T07:36:48.812Z

来源文件 / 仓库
# Surge

<p align="center">
  <img src="./.github/social-preview.png" alt="Surge — AI-first SaaS starter kit. Ship your SaaS in prompts, not months." width="100%" />
</p>

**An AI-first SaaS starter kit.**

Surge ships with Claude Code skills, auto-trigger subagents, an MCP server, an OpenAPI spec, `.md` content routes, an `llms.txt` index, and a comprehensive `CLAUDE.md` — so when you (or your AI agent) extend it, you spend prompts shipping features instead of rediscovering conventions.

Under the hood it's a production-ready Next.js 16 + Stripe + Prisma + NextAuth + smtpfa.st stack with auth, payments, admin, blog, docs, and a dark-mode-first design system. Clone it, customize it, ship.

[![License: MIT](https://img.shields.io/badge/License-MIT-18181b.svg)](LICENSE)
[![Next.js](https://img.shields.io/badge/Next.js-16-black.svg)](https://nextjs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-6-blue.svg)](https://www.typescriptlang.org/)
[![Tailwind](https://img.shields.io/badge/Tailwind-4-38bdf8.svg)](https://tailwindcss.com/)

---

## AI-first, what does that mean

Pure starter kits dump 10,000 lines on you and call it done. Three weeks later, when you ask Claude to add a feature, it burns 50k tokens grepping for the auth pattern, the design tokens, and the right primitive. Surge is built so that doesn't happen.

| Feature | What it does for you |
|---|---|
| [`CLAUDE.md`](./CLAUDE.md) | Conventions, primitives, helpers, rules — read automatically by every Claude session |
| [`AGENTS.md`](./AGENTS.md) | Same content, cross-tool format (Cursor, Aider, Continue, Codex) |
| `.claude/skills/` | Five invokable skills: `/customize`, `/add-page`, `/add-api-route`, `/add-stripe-tier`, `/add-email` |
| `.claude/agents/` | Three auto-trigger subagents: route-auditor, migration-reviewer, token-enforcer |
| `examples/` | Six canonical snippets the skills reference — no boilerplate re-derivation |
| `mcp/server.ts` | Local MCP server with read-only tools (`list_users`, `subscription_stats`, etc.) — query your app data in chat |
| `/api/openapi.json` | Auto-generated OpenAPI 3 spec so agents can introspect your API surface |
| `/llms.txt` + `/llms-full.txt` | AI-crawler link tree and full content bundle |
| `/blog/*.md`, `/docs/*.md` | Append `.md` to any URL for raw markdown — no HTML parsing |
| `robots.txt` | Explicit `Allow` for GPTBot, ClaudeBot, PerplexityBot, etc. |
| `docs/prompts/` | Prompt cookbook of proven recipes (add usage-based tier, OAuth, team seats, public API) |

The result: features that used to take a 30k-token back-and-forth become 3k-token one-shots.

---

## Quickstart

```bash
git clone https://github.com/The-DevOps-Daily/surge.git
cd surge
npm install
cp .env.example .env
npx prisma migrate dev --name init
npx prisma db seed
npm run dev
```

Then, in Claude Code (in the same directory):

```
/customize
```

Walks you through making the starter yours — product name, pricing, branding, env vars. Done in a few minutes instead of a few hours.

For a one-shot brand-only pass: `/customize --quick`.

---

## What's in the box

### App surfaces
- **Authentication** — NextAuth v5 credentials, JWT sessions, rate-limited register/forgot/reset, password change, account delete
- **Stripe** — checkout, customer portal, webhook handler, tier-based feature gating, configurable pricing
- **Admin dashboard** — user stats, MRR, growth chart, user management, blog content inventory, system health
- **Blog engine** — markdown frontmatter, reading progress, TOC, share buttons, dynamic OG images, raw `.md` routes
- **Docs engine** — same engine pointed at `content/docs/`, with prev/next navigation
- **Dark-mode-first design system** — CSS-variable tokens, primitive components (Button, Input, Modal, ConfirmDialog, Toast), responsive
- **Email** — smtpfa.st, light-friendly transactional templates with a shared scaffold

### Stack
- Next.js 16 (App Router) · TypeScript · Tailwind 4 · Prisma + SQLite (dev) / Postgres (prod)
- NextAuth v5 · Stripe · smtpfa.st · Recharts · Vitest · Docker Compose · GitHub Actions

### MCP server

Connect the read-only MCP server and ask your AI client about your app state directly:

```bash
claude mcp add saas-starter -- npx tsx mcp/server.ts
```

Then in chat:
- "How many Pro subscribers do we have?"
- "Show me the last 5 signups."
- "What's MRR right now?"
- "Any paid users with expired tier?"

See [docs/mcp](/docs/mcp) for the full tool list.

---

## Environment

Copy `.env.example` to `.env` and fill in:

| Variable | Required | Notes |
|---|---|---|
| `DATABASE_URL` | yes | SQLite `file:./dev.db` for local, Postgres URL for prod |
| `NEXTAUTH_SECRET` | yes | `openssl rand -base64 32` |
| `NEXTAUTH_URL` | yes | `http://localhost:3000` locally |
| `AUTH_TRUST_HOST` | prod | `true` behind a proxy |
| `REGISTRATION_ENABLED` | optional | `true` (default) or `false` |
| `STRIPE_SECRET_KEY` | for payments | from Stripe dashboard |
| `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` | for payments | from Stripe dashboard |
| `STRIPE_WEBHOOK_SECRET` | for payments | from Stripe dashboard |
| `NEXT_PUBLIC_STRIPE_PRO_PRICE_ID` | for payments | monthly Pro price |
| `NEXT_PUBLIC_STRIPE_PRO_YEARLY_PRICE_ID` | for payments | yearly Pro price |
| `NEXT_PUBLIC_STRIPE_FAMILY_PRICE_ID` | for payments | monthly Team price |
| `NEXT_PUBLIC_STRIPE_FAMILY_YEARLY_PRICE_ID` | for payments | yearly Team price |
| `SMTPFAST_API_KEY` | for email | from https://smtpfa.st/api-keys with `email:send` scope |
| `SMTPFAST_API_URL` | optional | defaults to `https://smtpfa.st`, override for staging/self-hosted |
| `SMTPFAST_FROM_EMAIL` | for email | `Your App <[email protected]>` |

---

## Project layout

```
.claude/                # skills, agents, settings
  skills/<name>/SKILL.md
  agents/<name>.md
  settings.json
examples/               # canonical snippets the skills reference
mcp/                    # read-only MCP server (stdio)
content/
  blog/                 # markdown blog posts
  docs/                 # markdown docs
docs/prompts/           # prompt cookbook
src/
  app/                  # Next.js App Router
    (admin)/            # admin pages (role-gated)
    (app)/              # authed app pages
    (marketing)/        # public marketing pages
    api/                # route handlers (auto-introspected by openapi.json)
    llms-full.txt/      # dynamic AI ingest bundle
  components/
    admin/              # admin chrome
    blog/, docs/        # content rendering
    layout/             # app shell, sidebar, mobile nav
    marketing/          # marketing chrome
    ui/                 # design system primitives
  lib/                  # auth, prisma, stripe, email, rate-limit, etc.
prisma/                 # schema, migrations, seed
public/                 # static assets, manifest, llms.txt, robots.txt
CLAUDE.md               # conventions for Claude — primes every session
AGENTS.md               # cross-tool agent summary
```

---

## Deployment

**Docker Compose** (recommended for self-hosting):

```bash
docker compose up -d                                # dev (builds locally)
docker compose -f docker-compose.prod.yml up -d     # prod (uses pre-built image)
```

Bundles the app, Postgres, Nginx, and Certbot for SSL.

**Vercel**: connect the repo, set env vars, point `DATABASE_URL` at Neon/Supabase/Railway.

**VPS**: `scripts/setup-server.sh` provisions Ubuntu 22.04+ with Docker. GitHub Actions deploy on push to main when `DEPLOY_HOST`, `DEPLOY_USER`, `DEPLOY_SSH_KEY` secrets are configured.

---

## Stripe webhook (local)

```bash
stripe listen --forward-to localhost:3000/api/stripe/webhook
```

---

## Tests

```bash
npm test          # vitest run
npx tsc --noEmit  # type-check
```

Don't run `npm run dev` or `npm run build` on a low-RAM dev box — CI handles full builds.

---

## License

MIT. See [LICENSE](LICENSE).

Copyright 2026 [The DevOps Daily](https://github.com/The-DevOps-Daily).
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。