@microsoft/rush vs lerna vs nx vs turbo
Monorepo Management and Task Running Strategies
@microsoft/rushlernanxturboSimilar Packages:

Monorepo Management and Task Running Strategies

@microsoft/rush, lerna, nx, and turbo are tools designed to manage multiple projects within a single repository, known as a monorepo. They handle dependency installation, task execution, caching, and versioning to keep large codebases organized. While @microsoft/rush and lerna focus heavily on package versioning and publishing, nx and turbo prioritize build speed and task pipelines. Choosing the right tool depends on whether your team needs strict version control or faster build times.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
@microsoft/rush06,508922 kB1,1515 days agoMIT
lerna036,036609 kB30223 days agoMIT
nx029,45221.4 MB475a day agoMIT
turbo031,305765 kB1915 days agoMIT

Monorepo Tools: Rush vs Lerna vs Nx vs Turbo

Managing a repository with many projects — often called a monorepo — requires tools that can handle dependencies, build tasks, and versioning without slowing down your team. @microsoft/rush, lerna, nx, and turbo all solve this problem, but they take different approaches. Let's compare how they handle configuration, task running, caching, and versioning.

🗂️ Configuration Style: Strict vs Flexible

@microsoft/rush uses a strict set of JSON files to enforce policies.

  • It requires rush.json for global settings and common-versions.json for shared dependencies.
  • This prevents teams from using different versions of the same library.
// rush.json
{
  "projects": [
    {
      "packageName": "my-app",
      "projectFolder": "apps/my-app"
    }
  ]
}

lerna uses a single lerna.json file for versioning and command config.

  • It supports "fixed" mode (one version for all) or "independent" mode.
  • Setup is quick but offers less control over dependency rules.
// lerna.json
{
  "version": "1.0.0",
  "packages": ["packages/*"],
  "command": {
    "publish": { "registry": "https://npm.pkg.github.com" }
  }
}

nx uses nx.json to define task pipelines and affected ranges.

  • It supports plugins that add config for specific frameworks.
  • You can customize cache keys and target defaults deeply.
// nx.json
{
  "targetDefaults": {
    "build": {
      "cache": true,
      "dependsOn": ["^build"]
    }
  }
}

turbo uses turbo.json to define pipelines simply.

  • It focuses on defining task dependencies and caching rules.
  • Configuration is minimal and easy to read.
// turbo.json
{
  "pipeline": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**"]
    }
  }
}

⚡ Running Tasks: Commands and Filters

@microsoft/rush uses specific commands like rush build.

  • You can limit scope using --to or --from flags.
  • It ensures tasks run in the correct dependency order.
# Rush: Build specific project and its deps
rush build --to my-app

lerna uses lerna run to execute scripts across packages.

  • You filter packages using --scope or --ignore.
  • It runs tasks in parallel by default.
# Lerna: Run build in scope
lerna run build --scope my-app

nx uses nx run with project and target names.

  • It supports complex filtering based on file changes.
  • You can run tasks on affected projects only.
# Nx: Run build on affected projects
nx run-many --target=build --affected

turbo uses turbo run with filter flags.

  • It automatically detects dependencies between tasks.
  • Filtering is fast and uses git history.
# Turbo: Run build with filter
turbo run build --filter=my-app...

🔄 Caching Strategies: Local vs Remote

@microsoft/rush focuses on local incremental builds.

  • It tracks file changes to skip unchanged projects.
  • Remote caching requires custom setup or third-party tools.
# Rush: Incremental build enabled via config
# rush.json -> "commandLine": { "build": { "enableIncrementalBuild": true } }

lerna has basic caching via npm or yarn caches.

  • It does not have built-in remote caching in core.
  • Often relies on underlying package managers for speed.
# Lerna: No specific cache command in core
# Relies on npm cache internally

nx offers local caching and optional remote caching via Nx Cloud.

  • It stores task outputs based on input hashes.
  • Remote caching allows teams to share build artifacts.
# Nx: Enable remote caching
nx connect-to-nx-cloud

turbo provides local caching and remote caching via Vercel.

  • It caches based on file hashes and environment variables.
  • Remote caching is free for small teams and easy to enable.
# Turbo: Login for remote cache
npx turbo login

🏷️ Versioning and Publishing

@microsoft/rush enforces versioning policies strictly.

  • It supports locked-step versioning across the repo.
  • Publishing is handled via rush publish with change logs.
# Rush: Version and publish
rush update
rush publish --publish --include-all

lerna is built for versioning and publishing packages.

  • It supports independent versions for each package.
  • You can automate changelogs and git tags.
# Lerna: Version and publish
lerna version
lerna publish from-package

nx does not enforce versioning by default.

  • It relies on tools like changesets or lerna for publishing.
  • Focus remains on build tasks and graph management.
# Nx: Usually paired with changesets
npx changeset version
npx changeset publish

turbo does not handle versioning directly.

  • It is designed to work with changesets or similar tools.
  • Focus remains on build pipelines and speed.
# Turbo: Paired with changesets
npx changeset version

📊 Summary: Key Differences

Feature@microsoft/rushlernanxturbo
Primary FocusEnterprise PolicyVersioningBuild GraphBuild Speed
Config Filerush.jsonlerna.jsonnx.jsonturbo.json
Remote CacheCustom SetupNo (Core)Nx CloudVercel
VersioningBuilt-inBuilt-inExternal ToolExternal Tool
Learning CurveHighLowMediumLow

🤝 Similarities: Shared Ground

While the differences are clear, all four tools share core goals for monorepo management.

1. 📦 Dependency Management

  • All tools handle linking local packages together.
  • They prevent version mismatches between projects.
# All tools support installing deps
npm install
# Or specific commands like 'rush update'

2. ⚡ Parallel Execution

  • All tools run tasks in parallel where possible.
  • They respect dependency0 dependency order automatically.
# All support parallel runs
# rush build, lerna run, nx run-many, turbo run

3. 🛠️ CLI Interfaces

  • All provide command-line tools for automation.
  • They integrate into CI/CD pipelines easily.
# CI Example
# npm run build (wrapped by tool)

💡 The Big Picture

@microsoft/rush is like a strict governance framework 🏛️ — best for large enterprises needing control. It ensures everyone follows the same rules, which reduces long-term maintenance costs.

lerna is like a package publisher 📦 — best for teams managing many npm libraries. It handles versioning and publishing better than build-focused tools.

nx is like a smart build engine 🧠 — best for complex apps with many dependencies. It knows exactly what needs to rebuild when you change a file.

turbo is like a speed booster 🚀 — best for teams wanting fast builds with minimal config. It gets you running quickly and caches results effectively.

Final Thought: If you need versioning, look at lerna or rush. If you need build speed, look at nx or turbo. Many teams now combine them — using lerna for versioning and turbo for builds.

How to Choose: @microsoft/rush vs lerna vs nx vs turbo

  • @microsoft/rush:

    Choose @microsoft/rush if you work in a large enterprise environment that requires strict policies and stability. It enforces a specific folder structure and versioning rules, which prevents drift across teams. This tool is best for organizations that prioritize long-term maintenance over rapid setup. It handles complex dependency linking better than most alternatives.

  • lerna:

    Choose lerna if you need a simple solution for versioning and publishing multiple packages. It is well-suited for projects that already exist and need standard monorepo features without heavy configuration. Note that for task running, it often pairs with other tools in newer versions. It remains a solid choice for independent package versioning.

  • nx:

    Choose nx if you want a highly extensible build system with powerful dependency graph analysis. It offers deep integration with frameworks like Angular, React, and Node.js through plugins. This tool excels when you need to run tasks only on affected projects after a change. It is ideal for complex repos where build performance is critical.

  • turbo:

    Choose turbo if you prioritize speed and simple configuration for your build pipelines. It offers excellent caching out of the box with minimal setup effort. This tool works well with Next.js and Vercel deployments but supports any JavaScript project. It is perfect for teams that want fast feedback loops without complex rules.

README for @microsoft/rush

@microsoft/rush

rush
      https://rushjs.io

Rush makes life easier for JavaScript developers who build and publish many NPM packages at once. If you're looking to consolidate all your projects into a single repo, you came to the right place! Rush is a fast, professional solution for managing this scenario. It gives you:

  • A single NPM install: In one step, Rush installs all the dependencies for all your projects into a common folder. This is not just a "package.json" file at the root of your repo (which might set you up to accidentally require() a sibling's dependencies). Instead, Rush uses symlinks to reconstruct an accurate "node_modules" folder for each project, without any of the limitations or glitches that seem to plague other approaches.

    ⏵ This algorithm supports the PNPM, NPM, and Yarn package managers.

  • Automatic local linking: Inside a Rush repo, all your projects are automatically symlinked to each other. When you make a change, you can see the downstream effects without publishing anything, and without any npm link headaches. If you don't want certain projects to get linked, that's supported, too.

  • Fast builds: Rush detects your dependency graph and builds your projects in the right order. If two packages don't directly depend on each other, Rush parallelizes their build as separate Node.js processes (and shows live console output in a readable order). In practice this multi-process approach can yield more significant speedups than all those async functions in your single-threaded Gulpfile.

  • Subset and incremental builds: If you only plan to work with a few projects from your repo, rush rebuild --to <project> does a clean build of just your upstream dependencies. After you make changes, rush rebuild --from <project> does a clean build of only the affected downstream projects. And if your toolchain is package-deps-hash enabled, rush build delivers a powerful cross-project incremental build (that also supports subset builds).

  • Cyclic dependencies: If you have hammers that build hammer-factory-factories, Rush has you covered! When a package indirectly depends on an older version of itself, projects in the cycle use the last published version, whereas other projects still get the latest bits.

  • Bulk publishing: When it's time to do a release, Rush can detect which packages have changes, automatically bump all the appropriate version numbers, and run npm publish in each folder. If you like, configure your server to automatically run rush publish every hour.

  • Changelog tracking: Whenever a PR is created, you can require developers to provide a major/minor/patch log entry for the affected projects. During publishing, these changes will be automatically aggregated into a nicely formatted CHANGELOG.md file.

  • Enterprise policies: Want to review new libraries before developers add them to package.json, but avoid hassling people about already approved cases? Want to enforce that all your projects depend on the same library version numbers? Are unprofessional personal e-mail addresses accidentally showing up in your company's Git history? Rush can help maintain a consistent ecosystem when you've got many developers and many projects in the mix.

  • Lots more! Rush was created by the platform team for Microsoft SharePoint. We build hundreds of production NPM packages every day, from internal and public Git repositories, for third party SDKs and live services with millions of users. If there's an important package management problem that needs solvin', it's likely to end up as a feature for Rush.

3 Minute Demo

See Rush in action! From your shell, install the tool like this:

$ npm install -g @microsoft/rush

For command-line help, do this:

$ rush -h

To see Rush build some real projects, try running these commands: :-)

$ git clone https://github.com/microsoft/rushstack
$ cd rushstack
$ rush install
$ rush install  # <-- instantaneous!
$ rush rebuild
$ rush build    # <-- instantaneous!

(If you don't have a GitHub account set up, you can use rush install --bypass-policy.)

Getting Started

For more details and support resources, please visit: https://rushjs.io

The repository also includes an experimental Rush reporter opt-in and demo guide. Rush 5 retains legacy terminal output unless a reporter is explicitly enabled.

Links

Rush is part of the Rush Stack family of projects.