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
- Write a migration in
migrations/pg/ - Create the entity file in
crates/storage/src/entities/ - Add repository functions in
crates/storage/src/repositories/ - Register the entity in the appropriate module
Adding a New API Endpoint
- Create a handler in
crates/api/src/routes/v1/ - Add the route to the router in the module's
mod.rs - 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
- Create a folder in
src/features/{feature-name}/ - Add components, hooks, and actions
- Create a page route in
src/app/platform/{feature-name}/ - Add types in
src/types/if needed
Adding a New DeFi Adapter
- Create a folder in
src/lib/defi/{protocol-name}/ - Add ABI files, action functions, data fetchers
- 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
- Create the contract in
contracts/modules/ - Inherit from
BaseModule.sol - Implement the protocol-specific functions
- Add permission checks via PermissionsManager
- Write tests in
test/ - 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
: anyin TypeScript) - [ ] Database migrations are reversible
- [ ] API changes have Swagger annotations
- [ ] Smart contract changes have test coverage