BACK TO DIRECTORY
settingadvanced

Monorepo (Turborepo)

A complete Turborepo monorepo setup with optimized task pipelines, remote caching configuration, shared TypeScript and ESLint configs, workspace dependency management, and Docker build integration. Includes configurations for apps, packages, and tooling workspaces with proper dependency boundaries and build ordering.

456 STARS
6.3k DOWNLOADS
claude-templates
monorepoturborepopnpmworkspacesconfig

CONFIGURATION

typescript
1// turbo.json
2{
3 "$schema": "https://turbo.build/schema.json",
4 "globalDependencies": [
5 "**/.env.*local",
6 ".env"
7 ],
8 "globalEnv": [
9 "NODE_ENV",
10 "CI"
11 ],
12 "tasks": {
13 "build": {
14 "dependsOn": ["^build"],
15 "inputs": ["$TURBO_DEFAULT$", ".env*"],
16 "outputs": [".next/**", "!.next/cache/**", "dist/**"],
17 "env": ["DATABASE_URL", "NEXT_PUBLIC_*"]
18 },
19 "lint": {
20 "dependsOn": ["^build"],
21 "inputs": ["$TURBO_DEFAULT$"],
22 "outputs": []
23 },
24 "type-check": {
25 "dependsOn": ["^build"],
26 "inputs": ["$TURBO_DEFAULT$"],
27 "outputs": []
28 },
29 "test": {
30 "dependsOn": ["^build"],
31 "inputs": ["$TURBO_DEFAULT$"],
32 "outputs": ["coverage/**"],
33 "env": ["DATABASE_URL"]
34 },
35 "dev": {
36 "cache": false,
37 "persistent": true
38 },
39 "clean": {
40 "cache": false
41 }
42 }
43}
44
45// Recommended directory structure:
46// apps/
47// web/ - Next.js frontend
48// api/ - Backend service
49// docs/ - Documentation site
50// packages/
51// ui/ - Shared React components
52// config-ts/ - Shared TypeScript config
53// config-eslint/- Shared ESLint config
54// database/ - Prisma schema and client
55// utils/ - Shared utility functions
56
57// pnpm-workspace.yaml
58// packages:
59// - "apps/*"
60// - "packages/*"
61
62// Root package.json scripts:
63// "dev": "turbo dev",
64// "build": "turbo build",
65// "lint": "turbo lint",
66// "test": "turbo test",
67// "type-check": "turbo type-check",
68// "clean": "turbo clean"