f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6.3 KiB
6.3 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-enterprise-scale-monorepo-manage | Enterprise Scale Monorepo Management | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Enterprise Scale Monorepo Management
매 한 줄
"매 single repo, many projects — 매 build graph 의 일관성". 매 monorepo 의 핵심은 모든 코드를 하나의 VCS root 안에 두되, 매 build 시스템이 dependency graph 를 이해해서 affected projects 만 build/test 한다는 점. Google (Piper/Bazel), Meta (Buck2), Microsoft (Rush), 그리고 매 OSS 의 Nx/Turborepo 가 이 패러다임을 driving.
매 핵심
매 Monorepo 가치
- Atomic cross-project changes: 매 API + caller 의 한 PR 안에서 변경.
- Shared tooling: 매 lint, format, build, test 의 unified config.
- Visibility: 매 모든 코드 의 grep-able.
- Refactor confidence: 매 type-checker 가 모든 caller 를 검증.
매 도전 과제
- Build time scaling: 매 naive build 의 N² growth — affected detection 필수.
- VCS performance: 매 git 의 100GB+ repo 에서 sparse checkout / VFS 필요.
- Permissions: 매 single repo + multiple teams = CODEOWNERS / branch protection.
- CI cost: 매 모든 commit 의 모든 project rebuild 의 X — incremental + cache.
매 도구 선택
- Nx (TypeScript-heavy, mid-large): smart caching + computation graph.
- Turborepo (Vercel, JS/TS): Rust-based, simple config, remote cache.
- Bazel (polyglot, mega-scale): hermetic builds, network-distributed.
- Pants (Python-heavy): similar to Bazel, lighter setup.
- Rush (.NET / TS): Microsoft's pnpm-based.
💻 패턴
Nx workspace structure
my-org/
├── nx.json
├── package.json
├── tsconfig.base.json
├── apps/
│ ├── web/ # Next.js app
│ └── api/ # NestJS API
├── libs/
│ ├── ui/ # shared React components
│ ├── data-access/# API clients
│ └── utils/
└── tools/
nx.json with affected + cache
{
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": ["build", "test", "lint", "e2e"],
"accessToken": "${NX_CLOUD_TOKEN}"
}
}
},
"targetDefaults": {
"build": { "dependsOn": ["^build"], "inputs": ["production", "^production"] },
"test": { "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"] }
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": ["default", "!{projectRoot}/**/*.spec.ts", "!{projectRoot}/jest.config.ts"]
}
}
Affected detection in CI
# .github/workflows/ci.yml
jobs:
affected:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: nrwl/nx-set-shas@v4
- run: pnpm install --frozen-lockfile
- run: npx nx affected -t lint test build --parallel=4
- run: npx nx affected -t e2e --parallel=1
Turborepo pipeline
// turbo.json
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": ["**/.env.*local"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
},
"test": { "dependsOn": ["build"], "outputs": ["coverage/**"] },
"lint": {},
"dev": { "cache": false, "persistent": true }
}
}
Bazel BUILD file (polyglot)
# libs/ui/BUILD.bazel
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
ts_project(
name = "ui",
srcs = glob(["src/**/*.ts", "src/**/*.tsx"]),
declaration = True,
tsconfig = "//:tsconfig",
deps = [
"//libs/utils",
"@npm//react",
"@npm//@types/react",
],
visibility = ["//apps:__subpackages__"],
)
CODEOWNERS for team boundaries
# CODEOWNERS
/apps/web/ @org/frontend-team
/apps/api/ @org/backend-team
/libs/ui/ @org/design-system
/libs/data-access/ @org/backend-team @org/frontend-team
/.github/ @org/platform-team
/tools/ @org/platform-team
Remote cache with Turborepo
# Self-hosted with turborepo-remote-cache
docker run -p 3000:3000 \
-e TURBO_TOKEN=secret \
-e STORAGE_PROVIDER=s3 \
-e STORAGE_PATH=my-bucket \
ducktors/turborepo-remote-cache
# In repo:
echo 'TURBO_API=http://cache.internal:3000' > .turbo/config.json
echo 'TURBO_TOKEN=secret' >> .turbo/config.json
turbo build --remote-only
매 결정 기준
| 상황 | Approach |
|---|---|
| <50 packages, JS/TS only | Turborepo (simplicity) |
| 50-500 packages, type-heavy | Nx (project graph + generators) |
| Polyglot (Go+Rust+TS+Python) | Bazel (hermeticity) |
| Python ML monorepo | Pants v2 |
| <10 packages | pnpm workspaces alone |
기본값: 매 TS/JS team 에게 Turborepo 또는 Nx (size dependent).
🔗 Graph
- 부모: Version Control
- 응용: Code Ownership
- Adjacent: Bazel · Nx · Turborepo
🤖 LLM 활용
언제: refactoring across packages, generating new lib boilerplate (Nx generator), CODEOWNERS automation, dependency graph 분석. 언제 X: 매 build cache invalidation logic 의 직접 결정 — Nx/Bazel hash algorithm 신뢰.
❌ 안티패턴
- Single CI job for entire repo: 매 affected detection 없이 매 commit 모든 build — 30분+ pipeline.
- No remote cache: 매 each developer 가 cold rebuild — wasteful.
- Mixing app-specific and lib code: 매 libs/ 와 apps/ 의 분리 안 함 — circular deps risk.
- Implicit dependencies: 매 package.json 에 list 안 된 import — Bazel/Nx 가 catch.
- No CODEOWNERS: 매 review fatigue + ownership 모호.
🧪 검증 / 중복
- Verified (Nx Cloud docs 2026, Turborepo 2.0, Bazel 7).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — monorepo tooling matrix + Nx/Turbo/Bazel patterns |