Skip to main content
reopt Handbook
reopt Handbook
Enterprise Project Architecture

Monorepo Foundation

Monorepo ArchitectureWorkspace DesignShared PackagesTurbo Pipeline

Apps and Delivery

Next.js PatternsVercel DeploymentCI/CD PipelineTesting Strategy

Agents and Operations

Agentic DevelopmentSkills EcosystemSecurity GovernanceMonitoring and Incident

Appendix

TemplatesReferencesUpdatesVerification
Handbook›Enterprise Project Architecture›Turbo Pipeline
한국어English

Turbo Pipeline

Configure Turborepo tasks, caching, dependencies, and environment rules for enterprise delivery.

Key takeaways

  • The Turbo pipeline is a monorepo's execution contract, deciding which tasks run, in what order, what is cached, and which env vars affect correctness.
  • Task layers carry different cache expectations: lint and typecheck are cacheable, test is cacheable when deterministic, build needs explicit outputs, and dev and deploy are not cacheable.
  • Declare task dependencies (not just names), list build outputs explicitly, and treat env vars as part of the cache key when they affect output.
  • Use --affected for PR feedback while keeping full verification for release gates, and keep the default cache directory to preserve Git worktree cache sharing.
  • When CI fails, ask whether the cause is code, dependency order, cache config, environment leakage, or a nondeterministic test; treat repeated flakiness as a platform problem.

The pipeline is the execution contract of a monorepo. It decides which tasks run, in what order, which outputs are cached, and which environment variables affect correctness.

Task Layers

TaskPurposeCache expectation
lintStatic quality and style checksCacheable
typecheckType contract validationCacheable
testUnit and integration testsCacheable when deterministic
buildProduction artifact creationCacheable with explicit outputs
devLocal development serverNot cacheable
deployExternal side effectNot cacheable

Pipeline Rules

  • Define dependencies between tasks, not only task names.
  • List build outputs explicitly so cache restore is reliable.
  • Treat environment variables as part of the cache key when they affect output.
  • Keep long-running development tasks outside cached CI paths.
  • Use --affected for PR feedback and keep full verification for release gates.
  • Keep the default cache directory unless you intentionally want to disable Git worktree cache sharing.
  • Review Turborepo 2.9 deprecations before adopting future 3.0 behavior.

Common Pattern

NeedPattern
Build packages before appsApp build depends on upstream package build
Validate contracts earlyRun typecheck before expensive tests
Avoid stale artifactsDeclare outputs and clean rules
Protect productionAdd release-only gates after normal CI
Agent worktreesLet Turborepo share local cache across linked Git worktrees

Failure Review

When a pipeline fails, ask whether the problem is code, dependency order, cache configuration, environment leakage, or a nondeterministic test. Treat repeated flaky CI as a product problem for the platform team.

Related docs

Verification

A checklist for validating enterprise project architecture and operations.

Advanced EAS Build Pipelines

Expo Enterprise Production · Build profiles, cache strategy, EAS environments, and monorepo optimization.

Ch6. Cost and Latency Optimization

LLMOps and AgentOps in Production · Manage unit cost and response time without sacrificing quality

Updates

Change log for the enterprise project architecture handbook.

Shared Packages

Govern reusable packages for UI, contracts, configuration, and domain logic.

Next.js Patterns

Use App Router, server boundaries, data fetching, and route ownership consistently.

On this page

Task LayersPipeline RulesCommon PatternFailure Review