name: nx
description: Run NX workspace commands for the Ghostfolio monorepo - build, graph, affected, run-many, and project info
disable-model-invocation: true
allowed-tools: Bash, Read, Glob
argument-hint: "[build|graph|affected|projects|run ]"
Ghostfolio NX Workspace Manager
Manage the NX monorepo workspace. Ghostfolio has 4 projects: api, client, common (lib), ui (lib).
Workspace Info
- NX version: 22.4.5
- Projects: api (NestJS), client (Angular), common (shared lib), ui (Angular component lib)
- Build: esbuild (client) + Webpack (API)
Commands
Based on $ARGUMENTS:
build [project]
Build a specific project or all projects:
# Build specific project
cd /home/james-allen/Projects/ghostfolio && npx nx build $1
# Build all for production
cd /home/james-allen/Projects/ghostfolio && npm run build:production
graph
Open the NX dependency graph visualization:
cd /home/james-allen/Projects/ghostfolio && npx nx dep-graph
This opens a browser showing project dependencies.
affected [target]
Run a target only on projects affected by current changes:
cd /home/james-allen/Projects/ghostfolio && npx nx affected --target=${1:-build} --base=main --head=HEAD
Common targets: build, test, lint
projects
List all NX projects with their types and paths:
cd /home/james-allen/Projects/ghostfolio && npx nx show projects --json
Also show the project graph relationships.
run
Run a specific NX target on a specific project:
cd /home/james-allen/Projects/ghostfolio && npx nx run $2:$1
Examples:
/nx run test api- Run API tests/nx run build client- Build the client/nx run lint common- Lint common lib
reset
Clear the NX cache (useful when builds are stale):
cd /home/james-allen/Projects/ghostfolio && npx nx reset
migrate
Check for and apply NX workspace migrations:
cd /home/james-allen/Projects/ghostfolio && npx nx migrate --run-migrations
NX Project Structure
apps/
api/ # NestJS backend (port 3333)
project.json
client/ # Angular frontend (port 4200)
project.json
libs/
common/ # Shared DTOs, interfaces, enums, helpers
project.json
ui/ # Shared Angular components (Storybook)
project.json
Module Boundaries
NX enforces module boundaries via ESLint. The key rules:
libs/commoncan be imported by any projectlibs/uican be imported byapps/clientapps/projects should not import from each other- All cross-project imports use
@ghostfolio/path aliases
Available NX Targets Per Project
| Target | api | client | common | ui |
|---|---|---|---|---|
| build | Yes | Yes | Yes | Yes |
| test | Yes | Yes | Yes | Yes |
| lint | Yes | Yes | Yes | Yes |
| serve | Yes | Yes | - | - |
| storybook | - | - | - | Yes |