-
Notifications
You must be signed in to change notification settings - Fork 1
DEPENDENCY MANAGEMENT
OpenCloudTouch uses npm workspaces for monorepo dependency management.
opencloudtouch/
├── package.json # Root workspace (shared deps)
└── apps/
└── frontend/
└── package.json # Frontend workspace (app-specific deps)
npm install # Run from root - installs everythingThis does:
- Install root dependencies (
concurrently,rimraf) - Install all workspace dependencies (
apps/frontend/package.json) -
Hoist shared dependencies to root
node_modules/ - Create symlinks for workspace-specific versions
If same version:
root/node_modules/
react@19.2.4 ← Hoisted (shared)
react-dom@19.2.4 ← Hoisted (shared)
If different versions:
root/node_modules/
vite@7.3.1 ← Root version
apps/frontend/node_modules/
vite@7.3.2 ← Frontend-specific (overrides)
Best practice: Keep versions aligned to save disk space.
devDependencies (development tools, shared across workspace):
{
"concurrently": "^9.1.2", // Run commands in parallel
"rimraf": "^6.0.1" // Cross-platform rm -rf
}Why here?
- Used by root npm scripts (
npm run dev,npm run clean) - Shared across all workspaces
- No version conflicts
dependencies (runtime):
{
"framer-motion": "^12.31.0",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-router-dom": "^7.13.0"
}devDependencies (build/test tools):
{
"@vitejs/plugin-react": "^5.1.3",
"cypress": "^15.10.0",
"eslint": "^9.39.2",
"rimraf": "^6.0.1", // Also in root - no conflict
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vitest": "^4.0.18"
}Why here?
- Frontend-specific (React, Vite, Cypress)
- Not needed in backend
- Isolated from other workspaces
Example:
// Root package.json
"rimraf": "^6.0.1"
// apps/frontend/package.json
"rimraf": "^6.0.1"Result: npm hoists to root, frontend uses symlink → No duplicate install ✅
If versions differ:
// Root
"rimraf": "^6.0.1"
// Frontend
"rimraf": "^5.0.0"Result: npm keeps both versions → 2 copies on disk (but isolated)
Option 1: Align versions (recommended)
npm install rimraf@latest # Update root
npm install rimraf@latest -w apps/frontend # Update workspaceOption 2: Use overrides in root (force version)
// Root package.json
{
"overrides": {
"rimraf": "^6.0.1" // Force this version everywhere
}
}npm install -D prettier # Add to root devDependencies
npm install lodash # Add to root dependenciesUse for:
- Linting/formatting tools (ESLint, Prettier)
- Build orchestration (concurrently, cross-env)
- Shared utilities used in multiple workspaces
npm install axios -w apps/frontend # Runtime dependency
npm install -D @types/node -w apps/frontend # Dev dependencyUse for:
- App-specific libraries (React, Vite, Cypress)
- Frontend-only tools
- Anything not needed in backend
cd apps/backend
pip install fastapi
pip freeze > requirements.txtBackend is Python-only - no npm/JavaScript dependencies.
# List all dependencies (hierarchical)
npm ls
# Check specific package
npm ls react
# Find duplicates
npm dedupenpm update # Updates within semver range (^, ~)npm install react@latest -w apps/frontend
npm install concurrently@latestnpm install -g npm-check-updates
ncu -i # Interactive: choose what to update
ncu -u && npm install # Auto-update package.jsonSymptom: Cannot find module 'react' even though installed
Solution:
# Delete all node_modules and reinstall
npm run clean
npm installSymptom: WARN react@19.2.4 requires a peer of react-dom@^19.0.0
Solution: Usually harmless, but can fix with:
npm install react-dom@^19.0.0 -w apps/frontendSymptom: Frontend expects vite@7.3.1 but root has vite@7.0.0
Solution: Align versions or use overrides:
{
"overrides": {
"vite": "7.3.1"
}
}- Keep versions aligned - avoid duplicates
-
Use workspaces (
-w apps/frontend) for workspace deps -
Commit lock files -
package-lock.jsonensures reproducibility -
Run
npm installfrom root - always from monorepo root -
Use
^for libraries - allows minor/patch updates -
Use exact versions for tools -
eslint@9.39.2(no^)
- name: Install dependencies
run: npm ci # Use 'ci' for reproducible builds
- name: Test
run: npm test # Runs tests in all workspacesWhy npm ci instead of npm install?
- Faster (skips package.json resolution)
- Reproducible (uses exact versions from lock file)
- Fails if lock file is out of sync
Questions? Check package.json comments or ask in team chat!
🇩🇪 Benutzerhandbuch
🇬🇧 User Guide
Development
API & Architecture
- REST API
- ADR 001 Clean Architecture
- ADR 002 FastAPI App State
- ADR 003 SSDP Discovery
- ADR 004 React/TS/Vite
Technical Reference
Legal