Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mcpServers": {
"nx-mcp": {
"url": "http://localhost:9252/sse"
}
}
}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@ turbo-build.log

# Release automation files
release-description.md

.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

# moon
.moon/cache
.moon/docker
packages/*/moon
packages/*/moon.exe
/moon
/moon.exe

lerna-*.log
35 changes: 35 additions & 0 deletions .moon/tasks/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$schema: 'https://moonrepo.dev/schemas/tasks.json'

# Task definitions for Next.js applications
tasks:
# Build task for Next.js applications
build:
command: 'next build'
inputs:
- 'src/**/*'
- 'pages/**/*'
- 'components/**/*'
- 'styles/**/*'
- 'public/**/*'
- 'next.config.js'
- 'package.json'
- 'tsconfig.json'
outputs:
- '.next/**/*'
options:
cache: true

# Development server
dev:
command: 'next dev'
local: true
options:
cache: false

# Start production server
start:
command: 'next start'
deps: ['build']
local: true
options:
cache: false
16 changes: 16 additions & 0 deletions .moon/tasks/lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$schema: 'https://moonrepo.dev/schemas/tasks.json'

# Task definitions for TypeScript libraries
tasks:
# Build task for TypeScript libraries (type checking)
build:
command: 'tsc'
args: ['--noEmit', '--skipLibCheck']
inputs:
- 'src/**/*'
- 'index.ts'
- 'package.json'
- 'tsconfig.json'
- 'tsconfig.lib.json'
options:
cache: true
35 changes: 35 additions & 0 deletions .moon/tasks/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$schema: 'https://moonrepo.dev/schemas/tasks.json'

# Task definitions for Node.js projects
tasks:
# Build task for Next.js applications
build:
command: 'next build'
inputs:
- 'src/**/*'
- 'pages/**/*'
- 'components/**/*'
- 'styles/**/*'
- 'public/**/*'
- 'next.config.js'
- 'package.json'
- 'tsconfig.json'
outputs:
- '.next/**/*'
options:
cache: true

# Development server
dev:
command: 'next dev'
local: true
options:
cache: false

# Start production server
start:
command: 'next start'
deps: ['build']
local: true
options:
cache: false
24 changes: 24 additions & 0 deletions .moon/toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$schema: 'https://moonrepo.dev/schemas/toolchain.json'

# Node.js configuration
node:
version: '22.9.0'
packageManager: 'pnpm'

# Performance optimizations
dedupeOnLockfileChange: true
syncProjectWorkspaceDependencies: true

# Use workspace protocol for dependencies
dependencyVersionFormat: 'workspace'

# Add engines constraint to package.json
addEnginesConstraint: true

# Sync package manager field in package.json
syncPackageManagerField: true

# PNPM configuration
pnpm:
version: '10.10.0'
installArgs: ['--frozen-lockfile']
16 changes: 16 additions & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$schema: 'https://moonrepo.dev/schemas/workspace.json'

# Disable auto-discovery to prevent conflicts
projects:
globs:
- './apps/*'

vcs:
provider: 'github'
defaultBranch: 'main'

notifier:
terminalNotifications: 'always'
experiments:
fasterGlobWalk: true
gitV2: true
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/dist
/coverage

/.nx/workspace-data
/.nx/workspace-data
/.nx/cache
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"typescript.tsserver.maxTsServerMemory": 8192,
"typescript.tsserver.nodePath": "node",
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"nxConsole.generateAiAgentRules": true
}
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Benchmarking Nx, Turbo, Lerna, and Lage
<!--
Recording:

![nx-turbo-recording](./readme-assets/turbo-nx-perf.gif) -->
# Benchmarking Nx, Turbo, Lerna, Lage, and Moon

Repo contains:

Expand All @@ -12,33 +8,46 @@ Repo contains:

Combined there are about 26k components. It's a lot of components, but they are very small. This corresponds to a medium
size enterprise repo. A lot of our clients have repos that are 10x bigger than this, so this repo isn't something out or
ordinary. And, the bigger the repo, the bigger the difference in performance between Nx and Turbo.
ordinary. And, the bigger the repo, the bigger the difference in performance between Nx and other tools.

The repo has Nx, Turbo, Lerna and Lage enabled. They don't affect each other. You can remove one without affecting the
other one.
The repo has Nx, Turbo, Lerna, Lage, and Moon enabled. They don't affect each other. You can remove one without affecting the
others.

## Benchmark & Results (June 24, 2025)
## Benchmark & Results (January 2025)

Run `pnpm run benchmark`. The benchmark will warm the cache of all the tools. We benchmark how quickly
Turbo/Nx/Lage/Lerna can figure out what needs to be restored from the cache and restores it.
Turbo/Nx/Lage/Lerna/Moon can figure out what needs to be restored from the cache and restores it.

These are the numbers using GitHub Actions runner:

* average lage time is: 11830.6
* average turbo time is: 9992.2
* average lerna (powered by nx) time is: 3407.0
* average moon time is: TBD (pending benchmark)
* average nx time is: 1849.4
* nx is 6.4x faster than lage
* nx is 5.4x faster than turbo
* nx is 1.8x faster than lerna (powered by nx)
* nx vs moon performance comparison: TBD

### About Moon

[Moon](https://moonrepo.dev/) is a Rust-based build system and monorepo management tool that focuses on performance and developer experience. Key features include:

* **Performance**: Written in Rust for maximum speed and efficiency
* **Smart Caching**: Advanced caching mechanisms with remote caching support
* **Task Pipeline**: Efficient task orchestration with dependency management
* **Language Support**: Multi-language support including Node.js, Python, Rust, and more
* **Configuration**: YAML-based configuration with intelligent defaults
* **Incremental Building**: Only builds what's changed for faster development cycles

### Does this performance difference matter in practice?

The cache restoration Turborepo provides is likely to be fast enough for a lot of small and mid-size repos.
The cache restoration that tools like Turborepo and Moon provide is likely to be fast enough for a lot of small and mid-size repos.
What matters more is the ability to distribute any command across say 50 machines while
preserving the dev ergonomics of running it on a single machine. Nx can do it. Bazel can do it (which Nx
borrows some
ideas from). Turbo can't. This is where the perf gains are for larger repos.
ideas from). Moon supports remote caching which enables distributed builds. This is where the perf gains are for larger repos.
See [this benchmark](https://github.com/vsavkin/interstellar) to learn more.

## Dev ergonomics & Staying out of your way
Expand All @@ -48,8 +57,6 @@ faster, but Turbo is built to stay out of you way". Let's talk about staying out

Run `nx build crew --skip-nx-cache` and `turbo run build --scope=crew --force`:

![terminal outputs](./readme-assets/turbo-nx-terminal.gif)

Nx doesn't change your terminal output. Spinners, animations, colors are the same whether you use Nx or not (we
instrument Node.js to get this result). What is also important is that when you restore things from cache, Nx will
replay the terminal output identical to the one you would have had you run the command.
Expand Down Expand Up @@ -128,7 +135,7 @@ The automation scripts are built with TypeScript for better type safety and deve
The repository uses:

* **Dependabot**: For automated dependency PRs
* **Daily Update Workflow**: Aggressive updates to ensure we're testing latest versions
* **Daily Update Workflow**: Aggressive updates to ensure we're testing latest versions (nx, turbo, lerna, lage, moonrepo)
* **Compatibility Testing**: Benchmarks run after updates to ensure everything works

### 📈 Performance Tracking
Expand Down
3 changes: 1 addition & 2 deletions apps/crew/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
71 changes: 47 additions & 24 deletions apps/crew/next.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
const withTM = require('next-transpile-modules')([
'crew-important-feature-0',
'crew-important-feature-1',
'crew-important-feature-10',
'crew-important-feature-11',
'crew-important-feature-12',
'crew-important-feature-13',
'crew-important-feature-14',
'crew-important-feature-15',
'crew-important-feature-16',
'crew-important-feature-17',
'crew-important-feature-18',
'crew-important-feature-19',
'crew-important-feature-2',
'crew-important-feature-3',
'crew-important-feature-4',
'crew-important-feature-5',
'crew-important-feature-6',
'crew-important-feature-7',
'crew-important-feature-8',
'crew-important-feature-9',
]);
// Temporarily disabled transpile modules due to module resolution issues
// const withTM = require('next-transpile-modules')([
// 'crew-important-feature-0',
// 'crew-important-feature-1',
// 'crew-important-feature-10',
// 'crew-important-feature-11',
// 'crew-important-feature-12',
// 'crew-important-feature-13',
// 'crew-important-feature-14',
// 'crew-important-feature-15',
// 'crew-important-feature-16',
// 'crew-important-feature-17',
// 'crew-important-feature-18',
// 'crew-important-feature-19',
// 'crew-important-feature-2',
// 'crew-important-feature-3',
// 'crew-important-feature-4',
// 'crew-important-feature-5',
// 'crew-important-feature-6',
// 'crew-important-feature-7',
// 'crew-important-feature-8',
// 'crew-important-feature-9',
// ]);

module.exports = withTM({
module.exports = {
reactStrictMode: true,
});
transpilePackages: [
'crew-important-feature-0',
'crew-important-feature-1',
'crew-important-feature-10',
'crew-important-feature-11',
'crew-important-feature-12',
'crew-important-feature-13',
'crew-important-feature-14',
'crew-important-feature-15',
'crew-important-feature-16',
'crew-important-feature-17',
'crew-important-feature-18',
'crew-important-feature-19',
'crew-important-feature-2',
'crew-important-feature-3',
'crew-important-feature-4',
'crew-important-feature-5',
'crew-important-feature-6',
'crew-important-feature-7',
'crew-important-feature-8',
'crew-important-feature-9',
],
};
1 change: 0 additions & 1 deletion apps/crew/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"devDependencies": {
"@types/react": "19.1.8",
"next-transpile-modules": "10.0.1",
"typescript": "5.8.3"
},
"nx": {
Expand Down
34 changes: 34 additions & 0 deletions apps/crew/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "crew",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/crew",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "apps/crew/.next"
}
},
"serve": {
"executor": "@nx/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "crew:build",
"dev": true
},
"configurations": {
"development": {
"buildTarget": "crew:build:development",
"dev": true
},
"production": {
"buildTarget": "crew:build:production",
"dev": false
}
}
}
}
}
3 changes: 1 addition & 2 deletions apps/flight-simulator/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
Loading
Loading