Local Setup
This guide walks you through setting up the NMT platform for local development.
1. Clone the Repository
git clone <repository-url>
cd NMT
2. Backend Setup
Start the Database
cd backend
make up
This command:
- Starts PostgreSQL 16 in Docker
- Restores a database backup (so you have real data to work with)
Install Rust Dependencies & Run
# Build all crates (first build takes several minutes)
cargo build
# Run the server (API + workers)
make run-server
The backend will start on http://localhost:8080. You can view the API docs at http://localhost:8080/docs.
Configuration
For local development, the backend reads configuration from TOML files and environment variables. You'll need to set at minimum:
| Variable | Purpose |
|---|---|
DATABASE_URL |
PostgreSQL connection (set by Docker Compose) |
RPC_ENDPOINTS |
Blockchain RPC URLs (ask team lead) |
3. Frontend Setup
Install Dependencies
cd frontend-app
npm install
Generate Prisma Client
npx prisma generate
This generates the TypeScript database client from the Prisma schema.
Environment Variables
Create a .env.local file in frontend-app/:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/nmt"
DIRECT_URL="postgresql://user:password@localhost:5432/nmt"
# Auth
NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID="your-dynamic-id"
# Session
COOKIE_PASSWORD="a-random-32-character-string-here"
# (Add other required variables as needed)
.env.local to git. Ask a team member for the actual values — they contain API keys and credentials.
Run the Development Server
npm run dev
The frontend will start on http://localhost:3000.
4. Smart Contracts Setup (Optional)
Only needed if you're working on the Solidity contracts.
cd smart-wallets
npm install
# Compile contracts
npx hardhat compile
# Run tests
npx hardhat test
# Run a local blockchain node
npx hardhat node
5. Verify Everything Works
| Check | How | Expected Result |
|---|---|---|
| Database | docker ps |
PostgreSQL container running |
| Backend | curl http://localhost:8080/api/v1/health |
200 OK |
| Backend docs | Open http://localhost:8080/docs |
Swagger UI loads |
| Frontend | Open http://localhost:3000 |
App loads |
| Contracts | cd smart-wallets && npx hardhat test |
Tests pass |
Troubleshooting
Database connection failed
Make sure Docker is running and the PostgreSQL container is up:
docker ps | grep postgres
Rust build fails
Ensure you have the latest Rust toolchain:
rustup update
Prisma client errors
Regenerate the Prisma client after schema changes:
cd frontend-app && npx prisma generate
Port conflicts
If ports 5432, 8080, or 3000 are in use, check for other services:
lsof -i :5432
lsof -i :8080
lsof -i :3000