Lesson 0007 · ~12 minutes · synthesis

Ship the decision, not the monorepo slogan

One skill: given a multi-project brief, defend topology + tool + moon loop + one risk you own — without feature tourism.

Mission payoff

This is the durable skill from MISSION.md (issue #10): standardize multi-project maintenance with monorepo judgment and moon as the concrete tool — or knowingly pick Turborepo / Nx / Bazel / polyrepo when they fit better.

Lesson-only path

You can complete this from lessons 1–6 alone. Official comparison pages remain optional enrichment, not a gate.

1. Four gates (run in order)

Gate A · Job

Related projects that change together, shared standards, atomic API/type fixes → monorepo. Hard isolation / separate access / independent release ownership with no shared change pressure → polyrepo. Deploy monolith is a different axis (lesson 1).

Gate B · Tool layer

Package manager workspaces only link packages. You still need a project graph + tasks + affected + cache or you are collocating (lessons 2, 6; Nx KB).

Gate C · Tool family

Pick the class of tool for the job — next section. Do not start from brand loyalty.

Gate D · Ship risks

If monorepo+moon: map projects, inherit tasks, pin toolchain, --affected, ownership/constraints, honest inputs, incremental migrate (lessons 36).

2. Tool family (decision depth only)

Sources: moon’s own feature comparison (explicitly incomplete / may be outdated — use as a map, not gospel) and monorepo.tools/compare.

Tool Best-fit signal Not the default when…
Turborepo JS/TS monorepo; mostly package.json scripts + cache; thin layer; Vercel remote cache OK Need built-in language toolchain, non-JS projects as first-class, or repo-wide task inheritance without repeating scripts (moon: Turbo ≈ scripts orchestrator + cache)
moon Config-first; task inheritance; integrated toolchain pins; polyglot commands on PATH + managed envs; ownership / constraints; repo management beyond pure turbo-style pipelines You only want the thinnest JS script cache and already live in pure npm workspaces with no pin story
Nx Full monorepo platform: plugins, generators, deep affected/CI, distributed task execution / cloud features (monorepo.tools marks DTE + deflake + agentic CI for Nx) You want minimal surface and will not invest in Nx’s plugin / cloud model
Bazel Hermetic sandbox builds; transparent remote execution; extreme multi-language scale (Bazel’s differentiator on monorepo.tools) Small/medium web monorepo that will not pay BUILD-file and hermetic modeling cost

Mission bias is valid: for “standardize multiple projects with shared tasks + toolchain + orchestration,” moon is a strong default — not the only correct tool. Lerna is now Nx-flavored package/publish (moon comparison); treat as Nx-adjacent, not a third major path.

3. If moon: the one-page loop

  1. Install binary → moon init
  2. Map projects (globs or sources)
  3. Shared .moon/tasks + inheritedBy
  4. Pin .moon/toolchains full semver
  5. moon run scope:task and CI with --affected
  6. Constraints + CODEOWNERS before spaghetti wins

Cheat sheets: everyday loop, inheritance, toolchain, deal-breakers.

Sentence you should be able to say

“We use mono | poly because job; tool is moon | turbo | nx | bazel because need; if moon, loop is init → map → inherit → pin → run affected; we own ownership | cache inputs | migration | isolation.”

4. Practice

Equal-length options. Design-review fluency.

Question 1

Gate A — strongest polyrepo default?

Question 2

Gate C — best Turborepo fit?

Question 3

Gate C — best moon fit for this track’s mission?

Question 4

Gate D — strongest monorepo+moon ship package?

5. Primary source

Recommended: moon feature comparison (read the caveats first) + skim monorepo.tools compare for Bazel/Nx/Turbo/moon capability rows. Print the playbook sheet for real reviews.

Ask your teacher Run a real brief (trio-moon, a polyrepo merge, or a greenfield web monorepo) through the four gates. Chat is part of the course.