This document describes the conversion of Traqora from a multi-component repository to an npm workspaces monorepo.
- Moved
backend/→packages/backend/ - Moved
client/→packages/client/ - Created root
package.jsonwith workspaces configuration
- Created
package.jsonwith npm workspaces setup - Added shared devDependencies to root:
@types/nodeeslinttypescriptzod
- Added workspace scripts for running commands across all packages
- Backend (
packages/backend/package.json):- Removed shared dependencies (now hoisted to root)
- Kept backend-specific dependencies
- Client (
packages/client/package.json):- Removed shared dependencies (now hoisted to root)
- Fixed package name to follow npm conventions (
traqora-client) - Temporarily removed
@creit-tech/stellar-wallets-kit(see Manual Steps)
- Updated
docker-compose.yml:- Backend context:
./packages/backend - Frontend context:
./packages/client
- Backend context:
- Updated
docker-compose.prod.yml:- API context:
./packages/backend - Frontend context:
./packages/client
- API context:
- Updated Dockerfiles:
- Client: Switched from pnpm to npm
- Added
--legacy-peer-depsflag for React 19 compatibility
- Installed all dependencies at root level using
npm install --legacy-peer-deps - Removed old lock files (pnpm-lock.yaml, package-lock.json from packages)
- Single
package-lock.jsonat root manages all workspace dependencies
Traqora/
├── package.json (root with workspaces)
├── package-lock.json (single lock file)
├── packages/
│ ├── backend/
│ │ ├── package.json
│ │ ├── Dockerfile
│ │ └── ...
│ └── client/
│ ├── package.json
│ ├── Dockerfile
│ └── ...
├── docker-compose.yml
├── docker-compose.prod.yml
└── ...
From the root directory:
# Install all dependencies
npm install --legacy-peer-deps
# Run development servers for all packages
npm run dev
# Build all packages
npm run build
# Run tests for all packages
npm run test
# Run linting for all packages
npm run lint
# Run type checking for all packages
npm run typecheck# Backend only
npm run dev --workspace=packages/backend
# Client only
npm run dev --workspace=packages/client# Development
docker-compose up
# Production
docker-compose -f docker-compose.prod.yml upThe @creit-tech/stellar-wallets-kit package was temporarily removed from packages/client/package.json because npm cannot resolve JSR packages directly. To restore this package:
Option A: Use pnpm for the client package
- Install pnpm globally:
npm install -g pnpm - Navigate to
packages/client/ - Run
pnpm install - Update the Dockerfile to use pnpm again
Option B: Find an alternative package
- Search for a non-JSR alternative to
@creit-tech/stellar-wallets-kit - Update the client code to use the alternative
- Add the alternative to
packages/client/package.json
Option C: Use a different package manager
- Consider using yarn or pnpm at the root level instead of npm
- Update the root package.json and Dockerfiles accordingly
Check for any hardcoded paths in the codebase that reference the old directory structure:
- Import statements
- Configuration files
- Scripts
- Documentation
Update any references from:
./backend→./packages/backend./client→./packages/client
Update any CI/CD configurations (GitHub Actions, GitLab CI, etc.) to:
- Use the new directory structure
- Run npm commands from the root
- Update build and deployment paths
Update project documentation to reflect the monorepo structure:
- README.md
- CONTRIBUTING.md
- Any setup guides
- API documentation
- Shared Dependencies: Common packages are installed once at the root
- Unified Commands: Run scripts across all packages with a single command
- Simplified CI/CD: Single build process for the entire project
- Better Dependency Management: Single lock file prevents version conflicts
- Easier Development: Work on multiple packages simultaneously
If you encounter dependency resolution errors:
npm install --legacy-peer-depsIf a specific package fails to build:
# Build individual package
npm run build --workspace=packages/backendIf Docker builds fail, ensure:
- The Dockerfile context paths are correct
- The package.json files are in the right locations
- Dependencies are installed at the root level
- The
--legacy-peer-depsflag is used due to React 19 compatibility issues with some packages - Consider upgrading to a package manager with better monorepo support (pnpm, yarn) in the future
- The contracts/ directory was not moved - consider if it should be part of the monorepo structure