# moon — Monorepo Management and Build System in Rust > A fast, polyglot build system and monorepo management tool for JavaScript, TypeScript, and Rust projects with smart caching and task orchestration. ## Install Save as a script file and run: # moon — Monorepo Management and Build System in Rust ## Quick Use ```bash # Install curl -fsSL https://moonrepo.dev/install/moon.sh | bash # Initialize in a monorepo moon init # Run a task across affected projects moon run :build # Check affected projects against main moon ci ``` ## Introduction moon is a build system and monorepo management tool built in Rust by moonrepo. It brings fast task execution, dependency-aware project graphs, and intelligent caching to JavaScript, TypeScript, and Rust monorepos, reducing CI times by only running what changed. ## What moon Does - Builds a project dependency graph from package.json and moon configuration files - Runs tasks in topological order with parallel execution across independent projects - Computes file hashes to skip tasks whose inputs have not changed since the last run - Detects affected projects from Git diffs for efficient CI pipelines - Manages toolchain versions (Node.js, npm, pnpm, yarn, Bun, Rust) per project ## Architecture Overview moon is a single Rust binary that reads `.moon/workspace.yml` and per-project `moon.yml` files to build a directed acyclic graph of projects and their tasks. The task runner resolves the graph topologically, executes tasks in parallel where possible, and caches outputs based on content hashes of inputs. Remote caching via moonbase stores and retrieves task outputs across CI runs and developer machines. The toolchain manager downloads and manages exact runtime versions per project. ## Self-Hosting & Configuration - Install the `moon` binary via shell script, npm, or cargo - Define workspace structure in `.moon/workspace.yml` with project globs - Configure per-project tasks in `moon.yml` with inputs, outputs, and dependencies - Enable remote caching by connecting to moonbase or a custom S3-compatible store - Integrate with CI via `moon ci` which automatically detects affected projects ## Key Features - Written in Rust for fast startup and execution with low memory usage - Content-aware hashing skips unchanged tasks, dramatically reducing build times - Toolchain management ensures consistent Node.js and package manager versions - Code generation and scaffolding through built-in template system - First-class support for npm, pnpm, yarn, and Bun package managers ## Comparison with Similar Tools - **Nx** — JavaScript-focused monorepo tool with plugin ecosystem; moon is polyglot and written in Rust for speed - **Turborepo** — Fast JS/TS monorepo builder by Vercel; moon provides deeper project graph analysis and toolchain management - **Bazel** — Enterprise-grade polyglot build system; moon is simpler to adopt for web ecosystem projects - **Lerna** — Package publishing focused; moon covers task orchestration, caching, and toolchain management ## FAQ **Q: Does moon replace npm/pnpm/yarn?** A: No, moon works alongside your package manager. It orchestrates tasks and manages dependencies between projects in the monorepo. **Q: Can moon be used outside of JavaScript projects?** A: Yes, moon supports Rust projects natively and can run arbitrary shell commands for any language. **Q: How does remote caching work?** A: moon hashes task inputs and checks a remote store (moonbase or S3) for cached outputs. Cache hits skip the task entirely. **Q: Is moon suitable for small projects?** A: moon is designed for monorepos with multiple projects. Single-project repositories can use simpler task runners like just or Task. ## Sources - https://github.com/moonrepo/moon - https://moonrepo.dev/docs --- Source: https://tokrepo.com/en/workflows/asset-34f2ed91 Author: Script Depot