CLI 向导按框架、包管理器、数据库、认证、tRPC、邮件服务等选项生成项目,并完成依赖安装、验证与初始 Git 提交
create-stack — Next.js SaaS模板
作者 alfredmouelle
create-stack 是一个 CLI 与 SaaS 基础模板,按向导选择生成 Next.js 或 TanStack Start 项目,并把邮件、存储、缓存、日志、分析等可替换集成放在端口之后。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
可替换集成放在端口之后,应用代码只依赖端口,切换 Resend/Brevo 或 S3/R2 只改组合根一处
提供 Next.js App Router 与 TanStack Start 两套真实起步应用,CLI 按选择 fork 其中一套
能力以 packages/<capability>/ 组织,每个带 capability.json 清单与测试,端口与模块两种接线模型区分明确
附带 /create-stack 与 /add-capability 两个技能,可在创建后继续向项目添加能力
模板详细介绍
create-stack 由两部分组成:已发布的 CLI `@alfredmouelle/create-stack`,以及开发该 CLI 的私有 pnpm + Turborepo 单仓库 `@alfredmouelle/stack`。CLI 通过向导询问框架、单仓库编排器、包管理器、导入别名、数据库、认证、tRPC、邮件服务与各项能力,然后 fork 对应的基础应用并应用这些选择,同时安装依赖、执行验证并创建初始 Git 提交。
仓库中的 `apps/next-base` 与 `apps/tanstack-base` 是真实可用的起步应用,本身不含业务代码,只保留基线配置,例如严格的 Biome、`~/*` 导入别名和带类型的 `env.ts`。`packages/<capability>/` 下每个能力都带有 `capability.json` 清单与测试,其 `kind` 字段决定接线方式:端口(port)有多个适配器,在组合根处选择;模块(module)只有一个提供方或没有提供方,直接使用。
端口类能力包括 mailer(Resend、Brevo、SES)、storage(S3、Cloudflare R2、GCS、本地)、cache(Redis、Upstash、内存)、logger(pino、console)和 analytics(PostHog、Plausible、noop)。模块类能力包括 jobs(Inngest 客户端及 serve 接线)、error-tracking(Sentry 初始化选项与各框架文件,涉及修改自有文件的步骤只打印不自动应用)、email-ui(React Email 组件、可替换主题与本地预览)和 http(类型化 fetch 与 Web 标准 WebhookHandler)。
仓库还提供两个技能:`/create-stack` 用已发布 CLI 创建项目,`/add-capability <capability> [adapter]` 在现有项目中添加能力,端口类能力需要传适配器参数,模块类不需要。开发侧约定为 pnpm、turbo、tsdown、vitest、Biome v2,Node 版本要求 22 及以上。项目受 create-t3-app 启发,采用 MIT 许可。
适合你的项目吗?
适用场景
- 需要从零搭建一个 Next.js 或 TanStack Start 的 SaaS 项目骨架,并预先接好邮件、存储、缓存、日志、分析等常用集成
- 已有项目想引入邮件、存储、缓存等能力,并希望按端口/适配器方式保持提供方可替换
- 团队希望统一新项目的基线配置,包括严格 Biome、导入别名与带类型的 env 校验
- 需要本地预览 React Email 邮件模板,并保持邮件主题可替换
适合人群
- 使用 pnpm 与 Node 22 及以上版本的前端或全栈开发者
- 接受端口与适配器分层、愿意在组合根处选择提供方的团队
- 需要 Next.js App Router 或 TanStack Start 起步骨架的 SaaS 项目
- 希望用 CLI 与技能脚本减少重复初始化工作的开发者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
使用 pnpm create @alfredmouelle/stack@latest my-app 或 pnpm dlx @alfredmouelle/create-stack@latest my-app 创建项目,npm 与 yarn create 也可用
- 2
仓库开发需先 pnpm install,再运行 pnpm test、pnpm typecheck、pnpm check
- 3
本地预览邮件模板:pnpm --filter @alfredmouelle/email-ui email:dev,运行在 3001 端口
- 4
技能可通过 pnpm link:skills(Claude)或 pnpm link:skills:codex(Codex)软链到代理配置目录
- 5
代码采用 MIT 许可,可免费使用、修改、商用与分发,但需保留版权与许可声明;演示素材、字体、图标及域名、托管、数据库、支付、AI 等外部服务需另行核对许可与费用
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- jobs 能力直接依赖 Inngest,error-tracking 直接依赖 Sentry,使用这两项能力需接入对应外部服务。
- 提供方通过环境变量选择,使用端口类能力需自行配置相应环境变量。
- error-tracking 中会修改自有文件的步骤只打印而不自动应用,需手动执行。
- 运行环境要求 Node 22 及以上版本。
- 技能软链分别写入 Claude 与 Codex 的配置目录,使用技能需具备对应代理环境。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Jobs use Inngest directly, and error tracking uses Sentry directly.
README 原文
**Provider selection by env var**, with static imports.
README 原文
the steps that edit files you own are printed, not applied
README 原文
**Node:** >= 22
README 原文
https://github.com/alfredmouelle/create-stack/blob/main/LICENSEhttps://github.com/alfredmouelle/create-stack/blob/main/README.mdpnpm link:skills # Claude (~/.claude/skills) pnpm link:skills:codex # Codex (~/.codex/prompts)
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-08。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 88 / 100
- 技术栈
- Next.js · React
- 网站类型
- SaaS · 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-08-26
- 截图检查日期
- 2026-10-08
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-08
查看当时使用的来源资料
SHA-256: e8bb121c7408e42f49f5a1194208aef2e14b8fca8ed30446bb73beb50df8d7d4
2026-10-08T02:07:10.985Z
来源文件 / 仓库# create-stack > A SaaS foundation and CLI for scaffolding Next.js or TanStack Start projects. > Replaceable integrations live behind ports. Integrations with one useful provider > ship as modules. [](https://www.npmjs.com/package/@alfredmouelle/create-stack) [](./LICENSE) [](https://nodejs.org) [](./CONTRIBUTING.md) This pnpm and Turborepo monorepo keeps replaceable integrations such as email, storage, cache, logging, and analytics behind a **port**. Application code depends on that port. The composition root selects the provider, so switching Resend for Brevo or S3 for R2 stays local to one place. Jobs use Inngest directly, and error tracking uses Sentry directly. Those integrations ship as **modules** with their framework wiring included. > **Two package names, one project.** `@alfredmouelle/create-stack` is the > published CLI you install to scaffold a project. `@alfredmouelle/stack` is this > repo: the private (unpublished) monorepo that develops and ships that CLI. ## Quickstart Scaffold a project with the selected stack, installed dependencies, verification, and an initial Git commit: ```bash pnpm create @alfredmouelle/stack@latest my-app # equivalent, explicit form (npm / yarn create also work): pnpm dlx @alfredmouelle/create-stack@latest my-app ``` The wizard asks for the framework, monorepo orchestrator, package manager, import alias, database, authentication, tRPC, mailer, and capabilities. The CLI forks the matching base app and applies those choices. ## Why Every new SaaS project needs the same early work: clean the boilerplate, configure the checks, install the common libraries, and wire the usual integrations. This repo keeps that work in one place. The defaults are opinionated, while the replaceable integrations stay behind adapters. Fork the base apps or change the defaults to fit your project. ## Capabilities Each `packages/<capability>/` is a self-contained capability with a `capability.json` manifest and tests. Its `kind` field defines the wiring model: a **port** has several adapters selected at the composition root, while a **module** has one provider, or no provider, and is used directly. ### Ports (swappable) `src/port.ts` holds the interface, `src/adapters/<name>.ts` one adapter per provider. | Capability | Port | Adapters | |---|---|---| | **mailer** _reference_ | `send()`: body is always a React Email component, rendered to HTML + text | Resend · Brevo · SES | | **storage** | `put` / `get` / `delete` / `exists` / `getSignedUrl` | S3 · Cloudflare R2 · GCS · local | | **cache** | `get` / `set` / `has` / `delete` / `wrap` | Redis · Upstash · in-memory | | **logger** | `trace`…`error` / `child` | pino · console | | **analytics** | `capture` / `identify` / `flush` | PostHog · Plausible · noop | ### Modules (used directly) | Capability | What it is | Provider | |---|---|---| | **jobs** | the Inngest client plus the serve wiring: durable steps, cron, concurrency, fan-out and typed events stay reachable | Inngest | | **error-tracking** | shared `Sentry.init` options plus the per-framework files (`onRequestError`, instrumentation, `global-error`); the steps that edit files you own are printed, not applied | Sentry | | **email-ui** | composable React Email primitives + **swappable theme** + local preview (`email dev`) | n/a | | **http** | `apiFetch` (typed fetch) + Web-standard `WebhookHandler` | n/a _(for APIs without an SDK)_ | Design rules: - **Pure core.** `packages/*` have zero framework code, except where the framework integration *is* the product (the error-tracking wiring). - **Official SDKs** are always preferred over hand-rolled fetch (except `http`, whose whole job is fetch). - **Provider selection by env var**, with static imports. Use lazy imports and per-adapter subexports only when an edge deployment requires them. - **Abstract a dependency when the abstraction earns its keep.** A single obvious implementation stays a module. Jobs need durable steps, cron, concurrency, fan-out, and typed events, so the SDK remains visible. Sentry needs request hooks, source maps, early instrumentation, and per-request scope isolation, so a small `captureException` wrapper would hide the useful parts. ## Structure ``` packages/ mailer/ email-ui/ storage/ jobs/ cache/ logger/ analytics/ error-tracking/ http/ apps/ next-base/ # real Next.js (App Router) starter, fork for a new project tanstack-base/ # real TanStack Start starter, fork for a new project cli/ # create-stack: the published installer that forks a base app index.mjs lib/ templates/ # (biome.jsonc + # Author footer + wiring variants) skills/ create-stack/ # run the published create-stack CLI to scaffold a project add-capability/ # add a capability into a project behind a port scripts/ link-skills.sh # symlink skills into Claude / Codex capability.schema.json # the manifest schema each capability.json follows ``` `apps/*-base` are **real starter apps**. The CLI forks one of them for each new project. They carry the baseline, including strict Biome, the `~/*` alias, and typed `env.ts`, without application-specific code. `create-stack` selects the framework, monorepo orchestrator, package manager, import alias, and stack axes. `add-capability` adds tools after creation. ## Development Working on the repo itself (capabilities, CLI, bases): ```bash pnpm install pnpm test # all packages pnpm typecheck pnpm check ``` Preview emails locally: ```bash pnpm --filter @alfredmouelle/email-ui email:dev # react-email studio on :3001 ``` ## Skills The skills live here (versioned) and are symlinked into the agent's config, so editing them in this repo updates what the agent uses, no copy step. ```bash pnpm link:skills # Claude (~/.claude/skills) pnpm link:skills:codex # Codex (~/.codex/prompts) ``` - **`/create-stack`**: create a project with the published `@alfredmouelle/create-stack` CLI (framework + stack axes + capabilities, installs & inits git). - **`/add-capability <capability> [adapter]`**: add a capability to the current project (e.g. `/add-capability mailer resend`). Ports take an adapter argument, modules take none. Server capabilities land in `src/server/<cap>/`, pure utils in `src/lib/`, templates in `src/emails/`. See [`skills/README.md`](./skills/README.md) for details. ## Contributing Contributions are welcome. Please read the [Contributing Guidelines](./CONTRIBUTING.md) before opening an issue or PR: they cover the local setup, the ports & adapters rules, and the commit convention. ## Conventions - **Package manager:** pnpm · **Tasks:** turbo · **Build:** tsdown · **Tests:** vitest - **Lint/format:** Biome v2, strict (no semicolons, single quotes, trailing commas, `~/*` import alias) - **Schema validation (apps):** valibot · **Typed env:** `@t3-oss/env-core` - **Node:** >= 22 ## Credits Inspired by [create-t3-app](https://create.t3.gg) and the work of [Theo Browne](https://github.com/t3dotgg). Not affiliated with or endorsed by the T3 project. ## License [MIT](./LICENSE) © Alfred MOUELLE --- # Author Alfred MOUELLE | FullStack Developer [](https://comeup.com/@alfredmouelle) [](https://github.com/alfredmouelle) [](https://www.linkedin.com/in/alfredmouelle) [](https://x.com/alfredmouelle) [](mailto:[email protected]) [](https://alfredmouelle.com)
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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