Skip to main content

Migration Guide: Workspace Structure Update

This document outlines the changes made during the BBND-1075 workspace migration and how to adapt to the new structure.

Overview

The Asset Tokenization Studio has been restructured into a proper npm workspaces monorepo. This change improves dependency management, build processes, and development workflows.

What Changed

Repository Structure

Before:

├── contracts/
├── sdk/
├── web/
└── package.json (individual packages)

After:

├── packages/
│ ├── ats/
│ │ ├── contracts/
│ │ └── sdk/
│ └── mass-payout/
├── apps/
│ ├── ats/
│ │ └── web/
│ └── mass-payout/
└── package.json (workspace root)

Installation Commands

TaskOld CommandNew Command
Install dependenciesnpm run install:allnpm ci
Install specific packagecd contracts && npm ciHandled automatically by workspaces

Build Commands

TaskOld CommandNew Command
Build contractsnpm run build:contractsnpm run ats:contracts:build
Build SDKnpm run build:sdknpm run ats:sdk:build
Build webnpm run build:webnpm run ats:web:build
Build allMultiple commandsnpm run ats:build

Development Commands

TaskOld CommandNew Command
Start web appcd web && yarn devnpm run ats:web:dev
Full developmentManual build + startnpm start or npm run ats:start

Testing Commands

TaskOld CommandNew Command
Test contractscd contracts && npm testnpm run ats:contracts:test
Test SDKcd sdk && npm testnpm run ats:sdk:test
Test webcd web && npm testnpm run ats:web:test
Test allManual in each directorynpm run ats:test

Version Management Commands

TaskOld CommandNew Command
Update package versions./changeVersion.sh 1.0.0npm run changesetnpm run changeset:version
Publish packagesManual npm publishnpm run changeset:publish
Build and publishMultiple manual stepsnpm run release

Environment Setup

Before:

  • Environment file location: web/.env

After:

  • Environment file location: apps/ats/web/.env

Migration Steps for Developers

1. Update Local Development Environment

# Clean existing installations
npm run clean:deps # or manually delete node_modules directories

# Quick setup: install dependencies and build all ATS components
npm run ats:setup

# Or step by step:
# Fresh install with new structure
npm ci

# Build all components
npm run ats:build

2. Update Environment Files

Move your .env file from web/.env to apps/ats/web/.env:

mv web/.env apps/ats/web/.env

3. Update IDE/Editor Settings

Update any IDE configurations that reference the old paths:

  • contracts/packages/ats/contracts/
  • sdk/packages/ats/sdk/
  • web/apps/ats/web/

4. Update CI/CD and Scripts

If you have custom scripts or CI/CD configurations, update them to use the new workspace commands.

Key Benefits

  1. Simplified Dependency Management: All dependencies are managed from the root
  2. Faster Development: Automatic dependency linking between packages
  3. Better CI/CD: Path-based test triggers and conditional publishing
  4. Scalability: Ready for additional packages (e.g., mass-payout)
  5. Consistent Tooling: Centralized linting and formatting configurations ensure code quality consistency across all packages
  6. Modern Version Management: Changesets provide automated semantic versioning, changelog generation, and release management
  7. Enterprise-Grade Releases: Automated release workflows with proper audit trails and documentation

Troubleshooting

Common Issues

Issue: Commands not found or packages not linking Solution: Run npm ci from the root directory

Issue: TypeScript/build errors Solution: Ensure you build in the correct order:

npm run ats:contracts:build
npm run ats:sdk:build
npm run ats:web:build

Issue: Environment variables not working Solution: Check that your .env file is in apps/ats/web/.env

Issue: Version management with old script Solution: The changeVersion.sh script has been replaced by Changesets:

# Old way (deprecated)
./changeVersion.sh 1.0.0

# New way
npm run changeset # Create changeset for changes
npm run changeset:version # Update package versions
npm run release # Build and publish

Getting Help

If you encounter issues during migration:

  1. Check that you're using Node.js v22.x
  2. Ensure you've run npm ci from the root directory
  3. Verify your .env file is in the correct location
  4. Try the clean and rebuild process described above