服务端优先:会话在 RSC 中读取,写操作以 Server Actions 完成,UI 不含客户端数据层
dimah-starter — Next.js 后台模板
作者 dimah-kz
面向多租户 SaaS 的 server-first Turborepo 启动器,包含 Next.js 仪表盘、Better Auth 认证、Drizzle 数据库与 S3 存储。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
Turborepo 多包结构:api、auth、db、storage、email、i18n、ui 按职责拆分
内置邮箱密码认证、邮箱验证、密码重置、组织、成员、邀请与平台管理员
使用 Next.js Cache Components 模型,通过 cacheTag、cacheLife 与 updateTag 管理缓存
集成 Drizzle 数据库迁移与兼容 S3 的 dimah-s3 存储上传
i18n 包提供界面文案与区域设置,从第一天支持 RTL
模板详细介绍
dimah-starter 是一个基于 Turborepo 的多租户 SaaS 启动器,产品界面以服务端优先方式构建:会话在 RSC 中通过 auth.api.getSession 读取,列表来自带标签的缓存,认证、组织与上传等写操作以 Server Actions 完成,UI 中不包含 authClient 或客户端数据层。apps/web 是 Next.js 产品应用,包含仪表盘、认证与平台管理;packages 下拆分出 api(oRPC)、auth(Better Auth 服务端)、db(Drizzle schema、客户端与迁移)、storage(dimah-s3 存储)、email(Resend 事务邮件)、i18n(界面文案与区域设置)与 ui(shadcn / ReUI / Dimah 组件)。apps/mobile 与 apps/extension 为预留位置,通过 packages 共享而非跨应用引用。
已内置邮箱密码注册登录、邮箱验证、密码重置、组织、成员、邀请、平台管理员与 S3 上传。OAuth 尚未出现在界面中;@repo/api 中的产品 oRPC 目前只有 health.ping 桩,需要自行在 src/routers/health/ 添加过程,再从 Server Actions 通过 createRouterClient 调用。apps/web 使用 Next.js 的 Cache Components 配置(next.config.ts 中 cacheComponents 与 partialPrefetching),缓存读取使用 'use cache'、cacheTag 与 cacheLife,同用户写入使用 updateTag,会话不做缓存。
运行需要 Node ≥ 22、pnpm 12、PostgreSQL 以及兼容 S3 的 dimah-s3 存储桶(例如 R2)。生产环境需注意:BETTER_AUTH_URL 应设为公开源,localhost 仅在非生产环境受信任;无服务器环境应使用池化 DATABASE_URL;getSession 可能使用最长 5 分钟的 cookie 缓存,封禁或角色变更后用户可能仍显示已登录直至缓存过期;认证限流计数存放在 Postgres,仅作用于 /api/auth 下的 Better Auth HTTP 路由而非 Server Actions;生产环境需配置 RESEND_API_KEY 与 EMAIL_FROM,否则开发环境会把邮件内容打印到服务端日志。
适合你的项目吗?
适用场景
- 搭建需要组织、成员与邀请模型的多租户 SaaS 后台
- 以服务端渲染与 Server Actions 为主、避免客户端数据层的 Next.js 项目
- 需要邮箱密码认证、邮箱验证与密码重置的仪表盘产品
- 需要 S3 兼容对象存储上传能力的后台应用
- 作为 Turborepo 多包结构起点,后续扩展移动端或浏览器扩展
适合人群
- 熟悉 Next.js、React 与 Turborepo 的开发者
- 需要多租户组织与成员管理后台的团队
- 偏好服务端优先架构、不希望引入客户端数据层 SDK 的项目
- 可自行准备 PostgreSQL 与 S3 兼容存储桶的团队
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
环境要求:Node ≥ 22、pnpm 12、PostgreSQL 与兼容 S3 的 dimah-s3 存储桶(如 R2)
- 2
复制 .env.example 为 .env,填写 DATABASE_URL、BETTER_AUTH_*,可选 GOOGLE_*、S3_*、RESEND_*、EMAIL_FROM
- 3
执行 pnpm --filter @repo/db db:migrate 应用迁移,再用 pnpm dev 同时启动 web 与 db
- 4
生产环境将 BETTER_AUTH_URL 设为公开源,无服务器部署使用池化 DATABASE_URL
- 5
生产环境配置 RESEND_API_KEY 与 EMAIL_FROM,否则开发环境邮件内容会打印到服务端日志
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 运行需要兼容 S3 的 dimah-s3 存储桶(例如 Cloudflare R2),属于外部服务依赖,需自行准备并承担相应费用。
- 环境要求 Node ≥ 22、pnpm 12、PostgreSQL 以及 dimah-s3 存储,均需自行部署或开通。
- 生产环境必须配置 Resend 的 RESEND_API_KEY 与 EMAIL_FROM,即依赖 Resend 外部邮件服务。
- GOOGLE_* 环境变量为可选,用于 Google 相关集成,需自行申请对应凭据。
- OAuth 登录尚未在界面中实现,需要自行开发接入。
- 产品 oRPC 目前仅为 health.ping 桩,业务接口需自行在 src/routers/health/ 添加。
- 无服务器部署必须使用池化 DATABASE_URL,直连 5432 会在突发流量下耗尽连接。
- 会话 cookie 缓存最长 5 分钟,封禁或角色变更后用户可能仍显示已登录,直至缓存过期。
- 认证限流仅作用于 /api/auth 下的 Better Auth HTTP 路由,不覆盖 Server Actions。
- localhost:3000 仅在非生产环境受信任,生产环境需另行设置 BETTER_AUTH_URL。
- 未配置 Resend 密钥时,开发环境会把邮件内容(含验证链接)打印到服务端日志。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
dimah-s3 storage (S3-compatible bucket, e.g. R2)
README 原文
Node ≥ 22 · pnpm 12 · PostgreSQL · dimah-s3 storage
README 原文
set `RESEND_API_KEY` and `EMAIL_FROM` in production
README 原文
optional GOOGLE_*
README 原文
Not in the UI yet: OAuth.
README 原文
Product oRPC is a `health.ping` stub in `@repo/api`
README 原文
use a **pooled** `DATABASE_URL` (Neon pooler, PgBouncer, Supabase pooler). Direct `5432` will exhaust connections under bursty functions.
README 原文
`getSession` may use a cookie for up to **5 minutes**. After a ban or role change, the affected user can still look signed-in until that cache expires.
README 原文
That limiter applies to Better Auth HTTP routes (`/api/auth`), not Server Actions.
README 原文
`http://localhost:3000` is trusted only outside production.
README 原文
https://github.com/dimah-kz/dimah-starter/blob/main/LICENSEhttps://github.com/dimah-kz/dimah-starter/blob/main/README.mdWithout a key, development prints the message (including the link) to the server log.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-11。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 88 / 100
- 技术栈
- Next.js · React
- 网站类型
- 后台 · SaaS · 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-11
- 截图检查日期
- 2026-10-11
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-11
查看当时使用的来源资料
SHA-256: 3cf293fc6e631b86c87580de91f4bc127fcae1e25fb16a8f477867cdbffe9dc5
2026-10-11T06:26:23.182Z
来源文件 / 仓库# dimah-starter A **server-first Turborepo starter** for multi-tenant SaaS — Next.js dashboard, Better Auth, Postgres, and [dimah-s3](https://dimah-s3.vercel.app) storage. Shared packages are ready for a mobile or extension app later. The product surface is server-first, not just login: session in RSC, lists from tagged cache, writes (auth, orgs, uploads) as Server Actions. No `authClient` and no client data layer in the UI. **[Use this template](https://github.com/dimah-kz/dimah-starter/generate)** ## Why server-first | Typical SaaS kit | This starter | | ---------------------------------------- | ----------------------------------------- | | Client SDK + React Query / providers | RSC session via `auth.api.getSession` | | Client mutations, then refetch | Server Actions → `auth.api` → `updateTag` | | Drop-in widgets for auth, storage, menus | Your chrome: sidebar, org switcher, menus | | Copy and locale owned by the kit | `@repo/i18n` + RTL from day one | ## Cache Components `apps/web` runs the Next.js 16.4 Cache Components model (`cacheComponents: true` and `partialPrefetching: true` in `next.config.ts`). That is framework config, not an extra library. - Cached reads: `'use cache'` + `cacheTag` + `cacheLife` in `get-*.ts` - Same-user writes: `updateTag` in the mutating Server Action - Session is never cached ## Structure ``` dimah-starter/ ├── apps/ │ └── web/ # Next.js product (dashboard, auth, admin) ├── packages/ │ ├── api/ # Product oRPC (caller + /api/rpc) │ ├── auth/ # Better Auth server │ ├── db/ # Drizzle schema, client, migrations │ ├── storage/ # dimah-s3 storage │ ├── email/ # Resend transactional email │ ├── i18n/ # UI messages & locale │ └── ui/ # shadcn / ReUI / Dimah ├── tooling/ │ ├── eslint-config/ │ └── typescript-config/ └── docs/agents/ # Contributor / agent guides ``` `apps/mobile` and `apps/extension` are reserved slots — share through packages, not across apps. ## Quick start Node ≥ 22 · pnpm 12 · PostgreSQL · dimah-s3 storage (S3-compatible bucket, e.g. R2) ```bash pnpm install cp .env.example .env # DATABASE_URL, BETTER_AUTH_*, optional GOOGLE_*, S3_*, RESEND_*, EMAIL_FROM pnpm --filter @repo/db db:migrate pnpm dev # web + db ``` → [http://localhost:3000](http://localhost:3000) | Command | What it does | | ----------------------------------- | ---------------- | | `pnpm --filter web dev` | Run the web app | | `pnpm build` / `lint` / `typecheck` | Quality gates | | `pnpm --filter @repo/db db:migrate` | Apply migrations | ## Included vs add when you need it Ships with email/password sign-in and sign-up, email verification, password reset, organizations, members, invitations, platform admin, and S3 uploads. Not in the UI yet: OAuth. Product oRPC is a `health.ping` stub in `@repo/api` (`src/routers/health/`) — add procedures there, then call them from Server Actions with `createRouterClient`. ## Production - **Trusted origins** — `http://localhost:3000` is trusted only outside production. Set `BETTER_AUTH_URL` to the public origin. - **Postgres on serverless** — use a **pooled** `DATABASE_URL` (Neon pooler, PgBouncer, Supabase pooler). Direct `5432` will exhaust connections under bursty functions. - **Session cookie cache** — `getSession` may use a cookie for up to **5 minutes**. After a ban or role change, the affected user can still look signed-in until that cache expires. - **Auth rate limit** — counters live in Postgres so they survive serverless. That limiter applies to Better Auth HTTP routes (`/api/auth`), not Server Actions. Email verification and password-reset links use those routes. - **Email** — set `RESEND_API_KEY` and `EMAIL_FROM` in production. Without a key, development prints the message (including the link) to the server log. Conventions: [`AGENTS.md`](./AGENTS.md). MIT — see [LICENSE](./LICENSE).
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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