Essential Commands
Master the pnpm commands you'll use daily to develop, build, test, and manage packages in OneApp.
Need quick reference?
Why learn these commands?
Working in a monorepo without knowing the right commands is frustrating:
- Wrong scope — Running commands in the wrong workspace wastes time
- Failed builds — Don't know how to build specific packages or all at once
- Dependency chaos — Adding packages to the wrong location breaks builds
- Slow feedback — Running unnecessary commands across all workspaces
OneApp uses pnpm with workspace filtering (--filter) for targeted commands — letting you run builds, tests, and
installs on specific packages or groups of packages — saving time and reducing errors.
Production-ready with parallel execution, intelligent caching via Turborepo, and workspace filters that work across 40+ packages.
Use cases
Master these commands to:
- Develop efficiently — Start only the apps you need
- Build selectively — Build one package or all dependencies
- Manage dependencies — Add packages to the right workspace
- Quality checks — Lint and type-check before committing
- Clean installs — Fix dependency issues quickly
Development commands
Start development servers
# Start the main web application (port 3000)
pnpm dev
# Start OneApp microfrontend architecture (ports 3000-3002)
pnpm dev:oneapp
# Start Storybook for component development (port 6006)
pnpm --filter=storybook dev
# Start documentation site (port 3003)
pnpm --filter=docs dev
# Start email template preview (port 3004)
pnpm --filter=email devMultiple apps simultaneously
Open multiple terminals to run different apps at the same time:
Terminal 1: pnpm dev (main app) Terminal 2: pnpm --filter=storybook dev (Storybook) Terminal 3:
pnpm --filter=docs dev (docs)
Start specific workspaces
# Start by package name
pnpm --filter=web dev
pnpm --filter=@repo/ui dev
pnpm --filter=oneapp-onstage dev
# Start by path
pnpm --filter=./apps/web dev
pnpm --filter=./platform/apps/docs devBuilding commands
Build all packages and apps
# Build everything (respects dependency order)
pnpm build
# Build in parallel (faster, but more CPU intensive)
pnpm build --parallelBuild specific workspaces
# Build a single package
pnpm --filter=@repo/ui build
# Build an app
pnpm --filter=web build
pnpm --filter=oneapp-api build
# Build a package and all its dependencies
pnpm --filter=web... build
# Build a package and all dependents
pnpm --filter=...@repo/ui buildStart production servers
# Start production server (after build)
pnpm start
# Start specific app in production mode
pnpm --filter=web start
pnpm --filter=oneapp-onstage startCode quality commands
Linting
# Lint all packages
pnpm lint
# Lint specific workspace
pnpm --filter=web lint
pnpm --filter=@repo/ui lint
# Lint and auto-fix
pnpm --filter=web lint --fix
# Lint only changed files
pnpm lint --only-changedType checking
# Type check all packages
pnpm typecheck
# Type check specific workspace
pnpm --filter=web typecheck
pnpm --filter=@repo/types typecheck
# Watch mode (continuous type checking)
pnpm --filter=web typecheck --watchFull quality check
# Recommended before creating a PR
pnpm build && pnpm lint && pnpm typecheck
# Or individually
pnpm build
pnpm lint
pnpm typecheckPackage management commands
Adding dependencies
# Add production dependency to workspace
pnpm --filter=web add lodash
pnpm --filter=@repo/ui add clsx
# Add dev dependency
pnpm --filter=web add -D vitest
pnpm --filter=@repo/ui add -D @testing-library/react
# Add peer dependency (for libraries)
pnpm --filter=@repo/ui add -P react react-dom
# Add dependency to root (workspace-wide tooling only)
pnpm add -D -w prettier eslint typescriptInternal packages are automatic
When adding an internal package, pnpm automatically uses workspace:*:
pnpm --filter=web add @repo/ui
# Automatically becomes: "@repo/ui": "workspace:*"Removing dependencies
# Remove from workspace
pnpm --filter=web remove lodash
# Remove from root
pnpm remove -w prettierUpdating dependencies
# Update specific package
pnpm --filter=web update lodash
# Update to latest version
pnpm --filter=web update lodash@latest
# Update all dependencies in a workspace
pnpm --filter=web update
# Interactive update (choose which to update)
pnpm --filter=web update -i
# Update all across monorepo
pnpm -r updateInstalling dependencies
# Install all dependencies
pnpm install
# Install for specific workspace
pnpm --filter=web install
# Install ignoring lockfile (when lockfile is outdated)
pnpm install --no-frozen-lockfile
# Force reinstall
pnpm install --forceWorkspace filtering
The --filter flag is your most powerful tool:
Filter by package name
# By exact name
pnpm --filter=web dev
pnpm --filter=@repo/ui build
# Multiple packages
pnpm --filter=@repo/ui --filter=@repo/utils buildFilter by path
# By directory
pnpm --filter=./apps/web dev
# All packages in a directory
pnpm --filter="./packages/*" build
pnpm --filter="./teams/ai/**" lintFilter by dependencies
# Build package and all its dependencies
pnpm --filter=web... build
# Build all packages that depend on @repo/ui
pnpm --filter=...@repo/ui build
# Build package, its dependencies, and dependents
pnpm --filter=...@repo/ui... buildFilter by Git changes
# Run command on packages with uncommitted changes
pnpm --filter="[HEAD]" build
# Run command on packages changed since main branch
pnpm --filter="[origin/main]" lint
# Changed packages and their dependents
pnpm --filter="...[origin/main]" buildCleaning commands
# Remove node_modules and build artifacts
pnpm clean
# Manual cleanup
rm -rf node_modules
rm -rf **/node_modules
rm -rf **/.next
rm -rf **/dist
# Clean and reinstall
pnpm clean && pnpm install
# Clear pnpm cache
pnpm store pruneTesting commands
# Run tests (when configured)
pnpm test
# Test specific workspace
pnpm --filter=web test
pnpm --filter=@repo/ui test
# Watch mode
pnpm --filter=@repo/ui test --watch
# Coverage
pnpm --filter=@repo/ui test --coverageGit and versioning commands
Changesets
# Create a changeset (for versioning)
pnpm changeset
# Check changeset status
pnpm changeset:status
# Version packages (bumps versions)
pnpm changeset:version
# Publish packages (for library maintainers)
pnpm changeset:publishGit operations
# Check status
git status
# Create feature branch
git checkout -b feature/my-feature
# Stage and commit (triggers pre-commit hooks)
git add .
git commit -m "feat: add new feature"
# Push to remote
git push -u origin feature/my-featureQuick reference
Common commands cheat sheet
| Task | Command |
|---|---|
| Start dev server | pnpm dev |
| Start OneApp | pnpm dev:oneapp |
| Start Storybook | pnpm --filter=storybook dev |
| Build all | pnpm build |
| Build specific | pnpm --filter=<pkg> build |
| Lint all | pnpm lint |
| Type check all | pnpm typecheck |
| Full quality check | pnpm build && pnpm lint && pnpm typecheck |
| Add dependency | pnpm --filter=<pkg> add <dep> |
| Remove dependency | pnpm --filter=<pkg> remove <dep> |
| Update dependency | pnpm --filter=<pkg> update <dep> |
| Install all | pnpm install |
| Clean install | pnpm clean && pnpm install |
| Run tests | pnpm --filter=<pkg> test |
| Create changeset | pnpm changeset |
Next steps
- Learn architecture: Workspace Architecture →
- Manage dependencies: Dependency Management →
- Explore packages: Shared Packages →