0002. pnpm workspaces and Turborepo

Design document, published from the repository at docs/adr/0002-monorepo-tooling.md.

  • Status: Accepted
  • Date: 2026-11-13

Context

QuantLayer spans libraries, two web apps, workers, contracts, circuits and Rust crates that must evolve atomically (e.g. a protocol change touches core, contracts and the SDK together).

Decision

  • A single repository using pnpm 12 workspaces (apps/*, packages/*, services/*) and Turborepo 2 for task orchestration and caching.
  • pnpm's strict, non-flat node_modules so a package can only import what it declares.
  • Third-party versions are defined once in the pnpm catalog; internal dependencies use workspace:*.
  • pnpm's supply-chain defaults are kept: dependency build scripts are denied unless allow-listed (allowBuilds), and very recently published versions are not installed.
  • Contracts (Foundry) and Rust (Cargo) keep their native toolchains and are run as separate CI jobs rather than wrapped in npm scripts.

Consequences

One lockfile, one PR per cross-cutting change, cached incremental builds. Contributors need pnpm installed (Corepack is no longer bundled with Node.js ≥ 25). Docker images use turbo prune + pnpm deploy to ship only what a deployable needs.