This guide provides a complete walkthrough for setting up YieldVault RWA for local development, including service dependencies, startup order, and common troubleshooting steps.
graph TD
A[Node.js 18+] --> B[Backend API]
A --> C[Frontend]
D[PostgreSQL] --> B
E[Redis] --> B
F[Rust/Cargo] --> G[Smart Contracts]
B --> H[Stellar Testnet RPC]
C --> H
C --> B
G --> H
| Service | Purpose | Default Port | Status Check | Dependency |
|---|---|---|---|---|
| PostgreSQL | Data persistence | 5432 | psql -c "SELECT 1" |
None (external or Docker) |
| Redis | Caching & rate limiting | 6379 | redis-cli ping |
Backend |
| Backend API | Express.js REST API | 3000 | curl http://localhost:3000/health |
PostgreSQL, Redis, Stellar RPC |
| Frontend | React + Vite UI | 5173 | http://localhost:5173 |
Backend API, Stellar Testnet |
| Smart Contracts | Soroban Rust contracts | N/A | Build succeeds | Cargo + wasm32 target |
| Stellar RPC | External service | N/A | Handled by SDK | None (external) |
Before starting, ensure you have the following installed:
- Node.js 18+ – Check with
node --version - npm or pnpm – Check with
npm --versionorpnpm --version - Git – For version control
- Rust 1.74+ – Check with
rustc --version(needed for smart contracts) - Docker & Docker Compose – For PostgreSQL and Redis (or install them separately)
- Stellar CLI – For contract deployments
- Foundry – For advanced testing (optional)
- VS Code – Recommended editor with Rust Analyzer extension
# Install Node.js from https://nodejs.org (LTS recommended)
# Install Git from https://git-scm.com
# Install Rust using rustup-init.exe (included in repo):
./rustup-init.exe -y
# Add wasm32 target
rustc target add wasm32-unknown-unknown
# Install Docker Desktop from https://www.docker.com/products/docker-desktop# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install node@18 git rustup docker
# Install Rust
rustup-init
rustup target add wasm32-unknown-unknown
# Start Docker Desktop (from Applications folder)# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs git
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup target add wasm32-unknown-unknown
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USERFollow these steps in order to ensure all dependencies are properly initialized:
git clone https://github.com/your-org/YieldVault-RWA.git
cd YieldVault-RWAStart PostgreSQL and Redis first (they have no dependencies).
# Start PostgreSQL and Redis containers
docker-compose up -d postgres redis
# Verify services are running
docker ps
# Expected output should show both 'postgres' and 'redis' containersIf Docker is not available, install and run services separately:
# PostgreSQL
# Install from https://www.postgresql.org/download
# Run: postgres -D /usr/local/var/postgres
# Redis
# Install from https://redis.io/download
# Run: redis-serverVerify PostgreSQL:
psql -U postgres -d postgres -c "SELECT version();"Verify Redis:
redis-cli ping
# Expected: PONGcd backend
# Copy environment template
cp .env.local.example .env.local
# Install dependencies
npm install
# Initialize database
npx prisma migrate dev
# Verify database is ready
npm run db:check-drift
# Start development server
npm run dev
# In another terminal, verify health check
curl http://localhost:3000/healthExpected output from health check:
{
"status": "healthy",
"checks": {
"api": "up",
"cache": "up",
"stellarRpc": "up"
}
}cd ../frontend
# Copy environment template
cp .env.local.example .env.local
# Install dependencies
npm install
# Start development server
npm run dev
# Open in browser: http://localhost:5173Only needed if you plan to modify contracts:
cd ../contracts/vault
# Install Rust dependencies (auto on first build)
cargo build --target wasm32-unknown-unknown --release
# Run contract tests
cargo test
# View generated docs
cargo doc --openOnce everything is set up, here's the recommended startup order for future development sessions:
docker-compose up -d postgres redis
# Wait 5-10 seconds for services to be readycd backend
npm run dev
# Wait for "Server running on port 3000" messagecd frontend
npm run dev
# Wait for "Local: http://localhost:5173" messagecd contracts/vault
cargo watch -x "test --target wasm32-unknown-unknown"Create backend/.env.local:
# Server
PORT=3000
NODE_ENV=development
# Database (must match Docker Compose or local installation)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/yieldvault_dev
# Stellar Network
STELLAR_RPC_URL=https://soroban-testnet.stellar.org
STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
STELLAR_NETWORK=testnet
VAULT_CONTRACT_ID=your_testnet_contract_id_here
# Cache
REDIS_URL=redis://localhost:6379
# API Configuration
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
# Optional - Log verbosity
LOG_LEVEL=debugCreate frontend/.env.local:
# Vite configuration
VITE_API_BASE_URL=http://localhost:3000
# Stellar Network
VITE_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
VITE_STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
# Contract
VITE_VAULT_CONTRACT_ID=your_testnet_contract_id_here
# Optional - Analytics & Error Tracking
VITE_FF_DEBUG_MODE=trueAfter all services are started, verify everything is working:
# Backend API health
curl http://localhost:3000/health
# Backend readiness
curl http://localhost:3000/ready
# Frontend (should see HTML)
curl -I http://localhost:5173
# Database connection
cd backend && npm run db:check-drift
# Redis connectivity
redis-cli pingProblem: Error: connect ECONNREFUSED 127.0.0.1:5432
Solutions:
# Check if PostgreSQL is running
docker ps | grep postgres
# If not running, start it:
docker-compose up -d postgres
# Verify connection string in .env.local
# Default: postgresql://postgres:postgres@localhost:5432/yieldvault_dev
# Check PostgreSQL logs
docker logs yieldvault_rwa-postgres-1
# Test connection manually
psql -U postgres -d yieldvault_dev -h localhostProblem: Error: connect ECONNREFUSED 127.0.0.1:6379
Solutions:
# Check if Redis is running
docker ps | grep redis
# If not running, start it:
docker-compose up -d redis
# Verify connection
redis-cli ping # Should return: PONG
# Check Redis logs
docker logs yieldvault_rwa-redis-1
# Check REDIS_URL in backend .env.local
# Default: redis://localhost:6379Problem: Error: P1000 Authentication failed or migration errors
Solutions:
# Reset database (WARNING: Loses all data)
cd backend
npx prisma migrate reset --force
# Or manually drop and recreate
psql -U postgres -h localhost -c "DROP DATABASE yieldvault_dev;"
psql -U postgres -h localhost -c "CREATE DATABASE yieldvault_dev;"
npx prisma migrate deployProblem: Port 3000 already in use or other startup errors
Solutions:
# Check what's using port 3000
# On Windows:
netstat -ano | findstr :3000
# On macOS/Linux:
lsof -i :3000
# Kill the process if needed (Windows):
taskkill /PID <PID> /F
# Or use different port:
PORT=3001 npm run devProblem: node_modules issues or build failures
Solutions:
cd frontend
# Clear node_modules and cache
rm -rf node_modules package-lock.json
npm install
# Clear Vite cache
rm -rf node_modules/.vite
# Reinstall
npm install
npm run devProblem: Error: Network request failed or Stellar RPC timeout
Solutions:
# Test RPC endpoint directly
curl https://soroban-testnet.stellar.org/health
# Check your VITE_SOROBAN_RPC_URL in frontend/.env.local
# Check STELLAR_RPC_URL in backend/.env.local
# If testnet is down, try using soroban cli:
soroban network list-known
# Use a different RPC if available
VITE_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org npm run devProblem: docker: command not found or permission denied
Solutions:
# Verify Docker is installed and running
docker --version
docker ps
# On Linux, add user to docker group:
sudo usermod -aG docker $USER
newgrp docker
# Restart Docker service if needed:
# Windows: Restart Docker Desktop
# macOS: Restart Docker Desktop
# Linux: sudo systemctl restart dockerProblem: npm ERR! peer dep missing or conflicting versions
Solutions:
# Use exact versions from lock file
rm -rf node_modules
npm ci # Use this instead of npm install
# Update all dependencies carefully
npm audit fix
# For backend/frontend separately:
cd backend && npm ci
cd ../frontend && npm ciProblem: Cannot find module '@stellar/stellar-sdk' or similar
Solutions:
# Reinstall all dependencies
npm install
# For monorepo issues, install at project root too:
cd ../.. && npm install
cd frontend && npm install
# Clear npm cache
npm cache clean --force
npm installProblem: error: could not compile wasm artifact
Solutions:
cd contracts/vault
# Check Rust version
rustc --version # Should be 1.74 or higher
# Update Rust
rustup update
# Ensure wasm32 target is installed
rustup target add wasm32-unknown-unknown
# Clean and rebuild
cargo clean
cargo build --target wasm32-unknown-unknown --release
# Check for compile errors
cargo check# Backend unit tests
cd backend
npm run test
# Frontend unit tests
cd ../frontend
npm run test
# E2E tests
npm run test:e2e
# Contract tests
cd ../contracts/vault
cargo test# Lint all code
cd backend && npm run lint
cd ../frontend && npm run lint
# Format code
cd backend && npm run format
cd ../frontend && npm run format
# Security audit
cd backend && npm audit
cd ../frontend && npm audit# Create new migration
cd backend
npx prisma migrate dev --name <migration_name>
# Generate Prisma client after schema changes
npx prisma generate
# View database in Prisma Studio
npx prisma studio- Use
npm ciinstead ofnpm install– Faster and more reproducible - Keep docker containers running – Don't stop/start them repeatedly
- Enable source maps for debugging – Already enabled in dev config
- Use VS Code extensions – Prettier, ESLint, Rust Analyzer for better DX
- Monitor ports – Keep HTTP/2 enabled for Vite for faster reload
If experiencing memory issues:
# Backend with more memory
NODE_OPTIONS="--max-old-space-size=4096" npm run dev
# Frontend with more memory
NODE_OPTIONS="--max-old-space-size=2048" npm run dev# Docs available at:
# http://localhost:3000/api-docs# Open Prisma Studio
cd backend
npx prisma studio
# Opens http://localhost:5555 with database browser# Backend includes test endpoints:
# POST http://localhost:3000/admin/test-webhook- Install Debugger for Chrome extension
- Create
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Backend",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/backend/src/index.ts",
"preLaunchTask": "npm: dev"
}
]
}- Architecture Overview – See docs/CONTRACTS_ARCHITECTURE.md
- Environment Setup – See ENVIRONMENT_SETUP_GUIDE.md
- API Documentation – See docs/api/README.md
- Contributing Guide – See CONTRIBUTING.md
- Stellar Documentation – https://developers.stellar.org/
- Soroban Documentation – https://developers.stellar.org/docs/build/smart-contracts
- Check logs – Always the first troubleshooting step
- Search issues – Check GitHub issues for similar problems
- Review documentation – Most common issues are covered above
- Ask in discussions – Create a new discussion for help
Last Updated: May 2026
Maintained by: Development Team
Version: 1.0.0