Turborepo + Yarn workspaces 的单仓库结构,apps 与 packages 分离
turborepo-boilerplate — Next.js 启动器模板
作者 MahdiTa97
基于 Turborepo 与 Yarn workspaces 的 Next.js 单仓库启动模板,内置可用的共享 UI 包、daisyUI 主题、共享 Tailwind/ESLint/TypeScript 配置以及 lint、类型检查、构建的 CI 流程。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
可用的共享 UI 包 @repo/ui,含 daisyUI 主题与 Card、Container、Navbar、HeroLogin 等组件
Tailwind 配置集中在 @repo/tailwind-config,主题改动对所有应用生效
ESLint 与 TypeScript 配置以共享预设形式提供,应用按需 extends
GitHub Actions 在每次 push 与 PR 时执行 lint、type-check、build
已启用 Dependabot 维护依赖更新
模板详细介绍
这是一个面向 Next.js 应用的 monorepo 启动模板,定位是解决单仓库中共享设计系统时的重复配置问题。仓库以 Turborepo 和 Yarn workspaces 为基础,在 Vercel 官方 create-turbo 示例之上补充了可用的共享 UI 包、统一的 Tailwind 配置来源、统一的 ESLint 与 TypeScript 预设,以及 lint、type-check、build 三步 CI。
仓库结构分为 apps 与 packages 两部分:apps/web 是使用 App Router 的 Next.js 应用,packages 下包含 ui(共享 React 组件与 daisyUI 主题)、tailwind-config(主题与插件的唯一配置来源)、eslint-config(next.js 与 library 两套预设)和 typescript-config(base、nextjs、react-library 三套 tsconfig)。Turbo 会在 apps/* 与 packages/* 中运行脚本并缓存结果。
共享 UI 包 @repo/ui 直接从源码被消费,应用通过 transpilePackages 让 Next.js 参与编译其 .tsx 文件,包的 CSS 单独编译到 dist/index.css。Tailwind 的 content 配置需要同时扫描包自身源码以及 node_modules 中的 daisyUI 与 react-daisyui 源码,否则相关类名不会生成样式。模板内置 Card、Container、Navbar、HeroLogin 以及从 react-daisyui 再导出的 Button、Theme 组件。
使用限制方面:需要 Node.js 20+ 与 Yarn 1.x;主题在 packages/tailwind-config/tailwind.config.ts 中集中修改;新增组件库时需要把其源码路径加入 UI 包的 Tailwind content 列表;UI 包中的类名默认不带前缀,若后续增加第二个 UI 包并需要隔离,需统一设置 prefix 并同步修改类名。
适合你的项目吗?
适用场景
- 多个 Next.js 应用需要共用同一套设计系统与主题时
- 希望把 lint、TypeScript、Tailwind 配置集中管理而不是在各应用间复制时
- 需要为 Turborepo 单仓库补充可运行的共享 UI 包作为起点时
- 希望 CI 默认包含 lint、类型检查与构建流程时
适合人群
- 使用 Next.js 与 React 并计划采用单仓库结构的前端团队
- 需要共享组件库与统一主题配置的多应用项目
- 偏好 Yarn 1.x 与 Turborepo 工作流的开发者
- 希望以 MIT 许可自由使用、修改并商用的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
环境要求 Node.js 20+ 与 Yarn 1.x,仓库通过 packageManager 字段固定 Yarn 版本
- 2
克隆后执行 yarn install,再运行 yarn dev,web 应用默认在 http://localhost:3000
- 3
新增应用时复制 apps/web 的 tsconfig.json、next.config.js 与 tailwind.config.ts 以接入共享配置
- 4
向 UI 包引入新的组件库时,需把其源码 glob 加入 packages/ui/tailwind.config.ts 的 content 列表
- 5
主题在 packages/tailwind-config/tailwind.config.ts 的 daisyui.themes 中修改
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 运行环境要求 Node.js 20 及以上版本,并使用 Yarn 1.x;仓库通过 packageManager 字段固定 Yarn 版本,需先满足该环境才能安装与启动。
- 向 UI 包引入新的组件库时,必须把该库源码路径加入 packages/ui/tailwind.config.ts 的 content 列表,否则其类名不会生成样式,组件将无样式渲染。
- UI 包中的类名默认不带前缀;若后续新增第二个 UI 包并需要样式隔离,需统一设置 prefix 并同步修改 src/ 下所有类名,且 group-hover: 等变体保持不加前缀。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Requires **Node.js 20+** and **Yarn 1.x** (a repo-managed `packageManager` field pins this).
README 原文
If you add a component library to the UI package, add its glob here too — otherwise its classes compile to nothing and the component renders unstyled.
README 原文
https://github.com/MahdiTa97/turborepo-boilerplate/blob/main/LICENSEhttps://github.com/MahdiTa97/turborepo-boilerplate/blob/main/README.mdIf you later add a second UI package and need isolation, set a prefix once:
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-02。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 92 / 100
- 技术栈
- Next.js · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-01
- 截图检查日期
- 2026-10-02
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: cc55f91ba597965563eff00966185630758d25e4ab5b35b8a7a5eacf4abf5516
2026-10-02T09:21:32.903Z
来源文件 / 仓库<div align="center">
# turborepo-boilerplate
**A production-ready monorepo starter for Next.js apps that share a design system.**
[](https://github.com/MahdiTa97/turborepo-boilerplate/stargazers)
[](https://github.com/MahdiTa97/turborepo-boilerplate/network/members)
[](./LICENSE)
[](https://github.com/MahdiTa97/turborepo-boilerplate/actions/workflows/ci.yml)
[](https://github.com/MahdiTa97/turborepo-boilerplate/commits/main)
</div>
---
Most monorepo starters give you a folder structure and call it a day. This one gives you
the boring parts **already solved**: shared UI with isolated Tailwind styles, one place to
change lint rules, one place to change TS config, and a build cache that makes the second
app you add almost free.
It's a superset of Vercel's `create-turbo` example — same Turborepo + Yarn workspace
foundation, plus a working `ui` package with daisyUI and Vercel's ESLint style guide wired in.
## Why use this over `create-turbo`
| | `create-turbo` | This starter |
| ----------------------------- | --------------- | ----------------------------------------------------------- |
| Shared UI package | stub | working, with daisyUI + 5 components |
| Tailwind config for a package | not set up | shared preset via `@repo/tailwind-config` |
| Lint config | default Next.js | [Vercel style guide](https://github.com/vercel/style-guide) |
| TS config | copied per app | shared presets, extended per app |
| CI | none | lint + type-check + build |
| Dependabot | manual | enabled |
## Stack
Next.js 15 · React 18 · TypeScript · [Turborepo](https://turbo.build/repo) · Yarn
workspaces · Tailwind CSS 3 · [daisyUI](https://daisyui.com/) · ESLint 8 ·
[Prettier](https://prettier.io/)
## Quick start
```sh
git clone https://github.com/MahdiTa97/turborepo-boilerplate.git
cd turborepo-boilerplate
yarn install
yarn dev
```
`web` is served on [http://localhost:3000](http://localhost:3000).
> Requires **Node.js 20+** and **Yarn 1.x** (a repo-managed `packageManager` field pins this).
## Repository layout
```
.
├── apps/
│ └── web/ # Next.js app (add more apps here)
│ └── src/app/ # App Router
└── packages/
├── ui/ # Shared React components + daisyUI theme
├── tailwind-config/ # Single source of truth for theme & plugins
├── eslint-config/ # next.js + library lint presets
└── typescript-config/ # base / nextjs / react-library tsconfigs
```
Turbo runs every script across `apps/*` and `packages/*` and caches the results.
## Scripts
Run from the repo root:
| Command | What it does |
| ----------------- | --------------------------------------------------------- |
| `yarn dev` | Start every app in watch mode (persistent, uncached) |
| `yarn build` | Build all packages then apps, respecting dependency order |
| `yarn lint` | ESLint across every workspace |
| `yarn type-check` | `tsc --noEmit` across every workspace |
| `yarn format` | Prettier + Tailwind class sorting |
| `yarn clean` | Remove build artifacts |
## Adding a second app
Apps are workspaces — there's no registry to update.
```sh
mkdir apps/admin && cd apps/admin
yarn create next-app . --typescript --tailwind --app --eslint
```
Then wire up the shared pieces by copying `apps/web/tsconfig.json`, `next.config.js` and
`tailwind.config.ts`. Because both apps share `@repo/ui` and `@repo/tailwind-config`,
Turborepo builds `@repo/ui` once and both apps consume the same cache entry.
## How the shared UI package works
`@repo/ui` is consumed **directly from source** — no build step between editing a component
and seeing it in the app:
```json
// packages/ui/package.json
"exports": {
".": "./src/index.tsx",
"./styles.css": "./dist/index.css"
}
```
This is what makes it instant:
1. Apps enable `transpilePackages: ["@repo/ui"]` in `next.config.js`.
2. Next.js compiles the `.tsx` files as part of the app build.
3. The package's CSS is compiled separately to `dist/index.css`, so Tailwind classes from
`packages/ui` are always in the compiled output.
### Where Tailwind's `content` globs come from
Tailwind only generates CSS for classes it can see in `content`. `packages/ui` therefore
scans its own source **and** the daisyUI / react-daisyUI source in `node_modules`:
```ts
// packages/ui/tailwind.config.ts
content: [
'./src/**/*.tsx',
'../../node_modules/daisyui/dist/**/*.js',
'../../node_modules/react-daisyui/dist/**/*.js',
],
```
If you add a component library to the UI package, add its glob here too — otherwise its
classes compile to nothing and the component renders unstyled.
### Styles are not prefixed
Classes in `@repo/ui` are written without a `ui-` prefix. The config is shared with the
apps, so a prefix would have to be applied consistently everywhere to be safe — and with a
single shared package it buys nothing.
If you later add a second UI package and need isolation, set a prefix once:
```ts
// packages/ui/tailwind.config.ts
const config = {
prefix: "ui-", // then update every class in src/ to match
/* … */
};
```
Remember `group-hover:` stays unprefixed — Tailwind prefixes the utility, not the variant.
## Theming
Change the theme in `packages/tailwind-config/tailwind.config.ts` and every app updates.
```ts
export default {
theme: {
extend: {
/* … */
},
},
plugins: [require("daisyui")],
daisyui: {
themes: ["emerald"], // any daisyUI theme
},
};
```
daisyUI's full theme list is in their [themes documentation](https://daisyui.com/themes/).
## Included components
| Component | Description |
| ----------------- | --------------------------------- |
| `Card` | Link card with hover transition |
| `Container` | Centered responsive container |
| `Navbar` | daisyUI navbar with dropdown menu |
| `HeroLogin` | Split hero + sign-in form layout |
| `Button`, `Theme` | Re-exported from `react-daisyui` |
Import from the package root:
```tsx
import { Card, Container, Navbar, Button } from "@repo/ui";
```
## Adding a lint rule
`@repo/eslint-config` exposes two presets — extend the right one:
| Preset | For |
| -------------------------------- | ------------------------ |
| `@repo/eslint-config/next.js` | Next.js apps |
| `@repo/eslint-config/library.js` | Plain TS/React libraries |
```js
// apps/web/.eslintrc.js
module.exports = { extends: ["@repo/eslint-config/next.js"] };
```
Both extend `@vercel/style-guide`, so you get consistent, opinionated rules out of the box.
## Adding a TypeScript preset
```jsonc
// apps/web/tsconfig.json
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": { "plugins": [{ "name": "next" }] }
}
```
Available presets: `base.json`, `nextjs.json`, `react-library.json`.
## CI
Every push and pull request runs lint, type-check and build:
```yaml
# .github/workflows/ci.yml
- run: yarn lint
- run: yarn type-check
- run: yarn build
```
Dependabot keeps dependencies current automatically.
## Requirements
- Node.js **20+**
- Yarn **1.x** (`corepack enable` if needed)
## License
[MIT](./LICENSE) — use it freely, including commercially.
## Contributing
Issues and pull requests are welcome. If you're adding a feature, please open an issue first
so we can agree on the direction — this repo is deliberately small and opinionated.
## Acknowledgements
- [Turborepo](https://turbo.build/repo) and the `create-turbo` example
- [daisyUI](https://daisyui.com/) and [react-daisyui](https://github.com/daisyui/react-daisyui)
- [Vercel style guide](https://github.com/vercel/style-guide)
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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