Development Workflow

This page covers common development workflows for the NMT platform.

Daily Workflow

1. Pull latest changes
   git pull origin main

2. Start local services
   cd backend && make up

3. Run the backend (if working on backend or need fresh data)
   make run-server

4. Run the frontend (if working on frontend)
   cd frontend-app && npm run dev

5. Make changes → Test → Commit → Push → PR

Working on the Backend

Running Tests

cd backend
cargo test                    # Run all tests
cargo test -p nmt-api         # Test only the API crate
cargo test -p nmt-workers     # Test only the workers crate

Linting

cargo fmt --check            # Check formatting
cargo clippy                  # Run linter

Adding a New Database Entity

  1. Write a migration in migrations/pg/
  2. Create the entity file in crates/storage/src/entities/
  3. Add repository functions in crates/storage/src/repositories/
  4. Register the entity in the appropriate module

Adding a New API Endpoint

  1. Create a handler in crates/api/src/routes/v1/
  2. Add the route to the router in the module's mod.rs
  3. Add Utoipa annotations for Swagger docs

Working on the Frontend

Running Tests

cd frontend-app
npm run test                  # Run Vitest
npm run typecheck             # TypeScript type checking

Working with Prisma

npx prisma generate          # Regenerate client after schema changes
npx prisma db push           # Push schema changes to local DB
npx prisma studio            # Open visual DB browser (great for debugging)

Adding a New Feature Module

  1. Create a folder in src/features/{feature-name}/
  2. Add components, hooks, and actions
  3. Create a page route in src/app/platform/{feature-name}/
  4. Add types in src/types/ if needed

Adding a New DeFi Adapter

  1. Create a folder in src/lib/defi/{protocol-name}/
  2. Add ABI files, action functions, data fetchers
  3. Wire it into the transaction flow in src/features/transact/

Working on Smart Contracts

Compiling

cd smart-wallets
npx hardhat compile

Testing

npx hardhat test                         # Run all tests
npx hardhat test test/PermissionsManager.test.ts  # Run specific test
npx hardhat coverage                     # Coverage report

Deploying to Testnet

npx hardhat deploy --network sepolia

Adding a New Module

  1. Create the contract in contracts/modules/
  2. Inherit from BaseModule.sol
  3. Implement the protocol-specific functions
  4. Add permission checks via PermissionsManager
  5. Write tests in test/
  6. Add a deploy script in deploy/

Git Workflow

Branch Purpose
main Production-ready code
dev Development integration
feature/* Feature branches
devops/* Infrastructure changes

PR Checklist

Before submitting a pull request:

  • [ ] Code compiles without errors
  • [ ] Tests pass locally
  • [ ] No new linting warnings
  • [ ] Types are correct (no new : any in TypeScript)
  • [ ] Database migrations are reversible
  • [ ] API changes have Swagger annotations
  • [ ] Smart contract changes have test coverage

results matching ""

    No results matching ""