Introduction
moon is a build system and monorepo management tool built in Rust by moonrepo. It brings fast, reproducible task execution to JavaScript, TypeScript, and polyglot web projects with features like dependency-aware task orchestration, remote caching, and automatic affected-project detection.
What moon Does
- Orchestrates tasks across monorepo packages with dependency awareness
- Detects affected projects from Git changes for efficient CI runs
- Provides remote caching to skip redundant builds across machines
- Manages toolchain versions (Node.js, Bun, Deno, Go, Python, Rust) automatically
- Generates project graphs and dependency visualizations
Architecture Overview
moon uses a Rust core for performance-critical operations: hashing, dependency resolution, and task scheduling. Projects are defined in moon.yml files, and tasks run through a DAG-based executor that respects inter-project dependencies. The toolchain manager downloads and pins exact runtime versions per project. Remote caching stores task outputs keyed by input hashes, shared via moonbase or custom backends.
Self-Hosting & Configuration
- Install the moon binary via the official install script or npm
- Run
moon initto scaffold configuration in your monorepo root - Define projects in
.moon/workspace.ymland tasks in per-projectmoon.yml - Configure remote caching with moonbase or a custom S3-compatible backend
- Integrate
moon ciinto your CI pipeline for affected-only builds
Key Features
- Rust-powered performance with sub-millisecond task hashing
- Automatic toolchain version management across the team
- Built-in affected-project detection from Git diff analysis
- Remote caching to eliminate redundant CI work
- First-class support for JavaScript, TypeScript, Bun, Deno, Go, Python, and Rust
Comparison with Similar Tools
- Turborepo — JS-focused, simpler but less polyglot support
- Nx — feature-rich but heavier, Node.js-based runtime
- Bazel — extremely powerful but steep learning curve for web teams
- Lerna — monorepo publishing tool, not a build system
- Pants — Python-focused polyglot build system, less web-oriented
FAQ
Q: Does moon replace npm/pnpm/yarn? A: No. moon orchestrates tasks on top of your existing package manager. It manages when and in what order tasks run, not package installation.
Q: How does affected detection work? A: moon computes a hash of each project's source files and dependencies from the Git diff. Only projects with changed inputs (or downstream dependents) run in CI.
Q: Can I use moon for non-JavaScript projects? A: Yes. moon supports Go, Python, and Rust toolchains alongside JavaScript/TypeScript, making it suitable for polyglot monorepos.
Q: How does remote caching work? A: Task outputs are stored in a remote cache keyed by input hash. When another developer or CI run encounters the same inputs, the cached output is restored instead of re-running the task.