Workspace & Filtering

Master PNPM workspace mechanics, filtering commands, and parallel task execution.

Workspace Management & Filtering

Morax leverages PNPM workspaces to provide lightning-fast, disk-efficient package management with isolated node_modules and hardlink deduplication.

pnpm-workspace.yaml

The root workspace configuration maps all directories that contain apps and packages:

pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"

Filtering Commands (`--filter`)

The --filter (or -F) flag allows you to target specific applications or packages without changing directories:

Filter Syntax
# Run Next.js app only
pnpm --filter web dev

# Run Hono API server only
pnpm --filter server dev

# Build only the UI package and its dependents
pnpm --filter @workspace/ui... build

Adding Dependencies

Add an external package to a specific workspace directly from the root:

Targeted Installation
# Add lucide-react to web application
pnpm --filter web add lucide-react

# Add dev dependency to shared UI package
pnpm --filter @workspace/ui add -D tailwindcss

Parallel Script Execution

To run all applications concurrently in development mode, use pnpm -r (recursive) or root npm scripts:

Parallel Execution
# Run dev in all packages concurrently
pnpm -r --parallel dev