营销落地页包含功能亮点、用户评价、FAQ 折叠面板与定价卡片
nextjs-saas-starter — Next.js 后台模板
作者 Viprasol-Tech
基于 Next.js App Router 的 SaaS 启动器,包含营销落地页、定价与按席位计费逻辑、认证就绪的仪表盘外壳、用量统计与深色模式。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
lib/pricing.ts 提供按席位总额、年度节省与周期中加席位/变更套餐的按比例计费计算
仪表盘外壳含统计卡片、用量进度条与最近活动流
lib/session.ts 提供会话创建与过期、角色层级与权限判断,可替换为自有认证提供方
深色模式通过无闪烁引导脚本与可持久化的 ThemeToggle 实现
包含 123 个 Vitest 单元与组件渲染测试,覆盖各 lib 模块
模板详细介绍
这是一个面向 SaaS 产品的启动模板,使用 Next.js App Router 与 TypeScript 严格模式构建。项目提供营销落地页(含功能亮点、用户评价、FAQ 折叠面板与可用的定价展示)、位于 /dashboard 的仪表盘外壳,以及计费与设置页面。
模板把可复用的业务逻辑抽成纯函数模块:lib/pricing.ts 处理年度节省、按席位总额与周期中加席位或变更套餐的按比例计费;lib/usage.ts 计算用量比例、等级、剩余额度与需关注指标;lib/activity.ts 生成相对时间戳与按新旧排序的活动流;lib/session.ts 提供会话创建/过期、角色层级与权限判断;lib/theme.ts 负责主题解析与切换。组件层包含 PricingCard、StatCard、UsageBar、ActivityFeed、DashboardNav、ThemeToggle、Faq、Testimonials。
需要明确的是:模板本身不包含数据库、真实认证提供方、支付网关或邮件流程,README 的路线图将 Stripe checkout 适配器、数据库适配器示例、邮件与邀请流程、端到端测试列为待办。因此它提供的是界面外壳与可测试的业务逻辑,接入真实服务需要自行替换 getCurrentUser 等接口。仓库采用 MIT 许可,免费范围限于该版本代码,演示图片、字体、图标等第三方素材与外部服务需另行核对许可与费用。
适合你的项目吗?
适用场景
- 需要一个带定价页与仪表盘外壳的 SaaS 前端起点,再接入自有数据库与认证
- 希望复用按席位计费、周期中变更套餐的按比例计算逻辑
- 需要用量计量展示(比例、等级、剩余额度、需关注指标)与活动流组件
- 为后台管理界面搭建带侧边栏的 (dashboard) 路由组与深色模式
适合人群
- 使用 Next.js App Router 与 TypeScript 的前端或全栈开发者
- 准备自行接入数据库、认证与支付服务的 SaaS 项目
- 需要可单元测试的计费与用量逻辑作为参考实现的团队
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
运行 npm install 后执行 npm run dev,访问 http://localhost:3000,仪表盘位于 /dashboard
- 2
使用 npm run typecheck 做严格类型检查,npm test 运行 Vitest 测试
- 3
模板不含真实认证与数据库,需替换 lib/session.ts 中的 getCurrentUser 并接入自有身份提供方
- 4
Stripe checkout、数据库适配器、邮件与邀请流程、Playwright 端到端测试在路线图中尚未实现
- 5
MIT 许可仅覆盖该版本代码,演示图片、字体、图标及外部服务需单独核对许可与费用
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 模板不包含数据库与真实认证提供方,需自行接入自有数据库和身份提供方后才能用于实际产品。
- 会话流程为认证就绪的占位实现,必须替换 getCurrentUser 以接入自有身份提供方,否则无真实登录能力。
- Stripe 支付结账适配器尚未实现,路线图中列为待办,接入真实支付需自行开发。
- 数据库适配器示例尚未提供,需自行编写数据持久化层。
- 邮件与邀请流程尚未实现,相关功能需自行开发。
- 端到端测试尚未提供,仅有 Vitest 单元与组件渲染测试。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Bring your own database and auth provider and you are ready to ship.
README 原文
Replace `getCurrentUser` in `lib/session.ts` with a read from your identity provider
README 原文
- [ ] Stripe checkout adapter
README 原文
- [ ] Database adapter (Drizzle/Prisma) examples
README 原文
- [ ] Email + invite flows
README 原文
https://github.com/Viprasol-Tech/nextjs-saas-starter/blob/main/LICENSEhttps://github.com/Viprasol-Tech/nextjs-saas-starter/blob/main/README.md- [ ] End-to-end tests (Playwright)
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-02。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 85 / 100
- 技术栈
- Next.js · React
- 网站类型
- 后台 · SaaS · 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-09-01
- 截图检查日期
- 2026-10-02
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: 9d09396b8487a47509ea16b2d366f00aeb1394db5722b8524a7a70ef69c883b0
2026-10-02T14:04:19.311Z
来源文件 / 仓库<div align="center">
<img src="docs/assets/logo.png" alt="Viprasol Tech" width="120" />
<h1>Next.js SaaS Starter</h1>
<p><strong>Pricing & billing math, a real dashboard, usage metering, an auth-ready session flow, and dark mode — start shipping features, not boilerplate.</strong></p>
<p>Built and maintained by Viprasol Tech</p>
<p>
<a href="https://github.com/Viprasol-Tech/nextjs-saas-starter/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" /></a>
<a href="https://github.com/Viprasol-Tech/nextjs-saas-starter"><img src="https://img.shields.io/badge/Next.js-14-black.svg?logo=next.js" alt="Next.js 14" /></a>
<a href="https://github.com/Viprasol-Tech/nextjs-saas-starter"><img src="https://img.shields.io/badge/TypeScript-strict-3178c6.svg?logo=typescript&logoColor=white" alt="TypeScript strict" /></a>
<a href="https://github.com/Viprasol-Tech/nextjs-saas-starter"><img src="https://img.shields.io/badge/tests-123%20passing-brightgreen.svg" alt="123 tests passing" /></a>
<a href="https://github.com/Viprasol-Tech/nextjs-saas-starter"><img src="https://img.shields.io/badge/version-0.2.0-blueviolet.svg" alt="version 0.2.0" /></a>
</p>
</div>
---
A lightweight, opinionated starting point for a SaaS product built on the Next.js App Router and TypeScript (strict mode). It ships a marketing landing page with working pricing, an authenticated dashboard with stat widgets and a usage/activity view, billing pages with real proration math, and well-tested logic modules — so you can drop in your own database and auth provider with confidence.
## ✨ Features
- 🧱 **App Router (Next.js 14)** — clean root layout with a `(dashboard)` route group.
- 💳 **Billing math** in `lib/pricing.ts` — annual savings, per-seat totals, and prorated charges for mid-cycle seat adds and plan changes.
- 📊 **Dashboard** — stat widgets, usage progress bars, and a recent-activity feed.
- 📈 **Usage metering** in `lib/usage.ts` — ratios, severity levels, remaining allowance, and attention filtering.
- 🕑 **Activity feed** helpers in `lib/activity.ts` — relative timestamps and recency sorting.
- 🔐 **Auth-ready session flow** in `lib/session.ts` — session creation/expiry, role hierarchy, and permission checks.
- 🌙 **Dark mode** — a no-flash bootstrap script and a persistent `<ThemeToggle>`.
- 💬 **Marketing sections** — feature highlights, testimonials, and an FAQ accordion.
- 🎨 **Tailwind CSS** preconfigured with a brand palette and `class`-based dark mode.
- ✅ **Fully tested** — 123 Vitest tests covering every lib module plus component render tests under jsdom.
## 🚀 Quickstart
```bash
npm install
npm run dev
```
Open [http://localhost:3000](http://localhost:3000). The dashboard lives at `/dashboard`.
```bash
npm run typecheck # tsc --noEmit (strict, zero errors)
npm test # vitest run (123 tests)
```
## 📦 What's included
| Area | Module | Highlights |
| --- | --- | --- |
| Pricing & billing | `lib/pricing.ts` | `seatTotal`, `prorateUpgrade`, `proratePlanChange`, `computeAnnualSavings`, `formatPrice` |
| Usage metering | `lib/usage.ts` | `usageRatio`, `usageLevel`, `usageRemaining`, `metricsNeedingAttention` |
| Activity | `lib/activity.ts` | `relativeTime`, `recentActivity`, `sortByRecency`, `countByKind` |
| Sessions & roles | `lib/session.ts` | `createSession`, `isSessionExpired`, `hasRole`, `canManageBilling` |
| Theme | `lib/theme.ts` | `resolveInitialTheme`, `toggleTheme`, `themeBootstrapScript` |
| Components | `components/` | `PricingCard`, `StatCard`, `UsageBar`, `ActivityFeed`, `DashboardNav`, `ThemeToggle`, `Faq`, `Testimonials` |
| Pages | `app/` | Landing, dashboard overview, billing, settings |
### Project structure
```
app/
layout.tsx # root layout + dark-mode bootstrap
page.tsx # landing: hero, pricing, testimonials, FAQ
globals.css
(dashboard)/
layout.tsx # auth-gated shell with sidebar
dashboard/
page.tsx # stat widgets, usage bars, activity feed
billing/page.tsx # seat + proration math
settings/page.tsx # profile, permissions, danger zone
components/ # presentational + client components
lib/ # pure, unit-tested logic
tests/ # vitest unit + render tests (jsdom)
```
## 🧮 Billing math example
```ts
import { getPlan, prorateUpgrade, proratePlanChange } from "@/lib/pricing";
const pro = getPlan("pro")!;
const scale = getPlan("scale")!;
// Add 2 seats with 15 of 30 days left in the period:
prorateUpgrade(pro, "monthly", { addedSeats: 2, daysRemaining: 15 });
// Upgrade 5 seats from Pro to Scale mid-cycle (positive = owed):
proratePlanChange(pro, scale, "monthly", { daysRemaining: 15, seats: 5 });
```
## 🗺️ Roadmap
- [x] Pricing logic with annual savings
- [x] Seat-based and prorated billing math
- [x] Dashboard with stat widgets, usage bars, and activity feed
- [x] Billing and settings pages
- [x] Auth-ready session flow with role checks
- [x] Dark mode with a persistent toggle
- [ ] Stripe checkout adapter
- [ ] Database adapter (Drizzle/Prisma) examples
- [ ] Email + invite flows
- [ ] End-to-end tests (Playwright)
## ❓ FAQ
**Is this production ready?** The pricing, billing, usage, and session logic are fully typed and unit tested. Bring your own database and auth provider and you are ready to ship.
**How do I plug in real auth?** Replace `getCurrentUser` in `lib/session.ts` with a read from your identity provider; the rest of the role and permission helpers keep working.
**Does it support annual billing and proration?** Yes — see `lib/pricing.ts` and the billing page for seat totals and mid-cycle proration.
**Can I use it commercially?** Yes, it is MIT licensed.
## 🤝 Contributing
Contributions are welcome! Please open an issue to discuss substantial changes first. Before sending a PR, make sure both checks are green:
```bash
npm run typecheck
npm test
```
See [CONTRIBUTING.md](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
## Contact — Viprasol Tech Private Limited
- Website: [viprasol.com](https://viprasol.com)
- Email: [[email protected]](mailto:[email protected])
- Telegram: [t.me/viprasol_help](https://t.me/viprasol_help) | WhatsApp: +91 96336 52112
- GitHub: [@Viprasol-Tech](https://github.com/Viprasol-Tech) | [LinkedIn](https://www.linkedin.com/in/viprasol/) | X [@viprasol](https://twitter.com/viprasol)
## License
[MIT](LICENSE) (c) 2025 Viprasol Tech Private Limited
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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 · 启动器
