Run the comprehensive test suite:
cd /Users/gabrielantonyxaviour/Documents/projects/doma/doma-score
./test-all-services.shStart the Data Pipeline API:
cd backend
npm install
npx ts-node src/api-server.tsTest Endpoints:
# Health check
curl http://localhost:3001/health
# System status (tests Doma API connectivity)
curl http://localhost:3001/api/v1/status
# Single domain valuation
curl -X POST http://localhost:3001/api/v1/valuations \
-H "Content-Type: application/json" \
-d '{"domain":"test.eth"}'
# Batch valuation
curl -X POST http://localhost:3001/api/v1/valuations/batch \
-H "Content-Type: application/json" \
-d '{"domains":["test1.eth","test2.com","abc.xyz"]}'
# Get domain features
curl http://localhost:3001/api/v1/scores/test.eth
# Top domains by rarity
curl http://localhost:3001/api/v1/top-domains?limit=10
# Generate ML dataset
curl http://localhost:3001/api/v1/dataset?limit=50
# Collection statistics
curl http://localhost:3001/api/v1/statsStart Frontend:
cd frontend
npm install
npm run devTest in Browser:
- Visit: http://localhost:3000
- Test wallet connection
- Test domain valuation interface
- Test portfolio upload (CSV)
- Test market analytics dashboard
- Test mobile responsiveness
Run E2E Tests:
cd frontend
npx playwright testTest ML API Endpoints:
# Single ML prediction
curl -X POST http://localhost:3001/api/v1/valuations \
-H "Content-Type: application/json" \
-d '{"domain":"crypto.eth"}'
# Verify rarity scoring
curl http://localhost:3001/api/v1/scores/x.com
curl http://localhost:3001/api/v1/scores/longdomainname.xyz
# Test batch ML processing
curl -X POST http://localhost:3001/api/v1/valuations/batch \
-H "Content-Type: application/json" \
-d '{"domains":["a.com","bb.eth","ccc.xyz","dddd.org"]}'Start Real-time Analytics Server:
cd backend
npx ts-node src/services/realtime-analytics-service.tsTest REST Endpoints:
# Health check
curl http://localhost:3002/health
# Current market analytics
curl http://localhost:3002/api/realtime/analytics
# Recent events
curl http://localhost:3002/api/realtime/events?limit=20
# Filtered events
curl "http://localhost:3002/api/realtime/events/filter?tld=eth&timeframe=24"
# Processing statistics
curl http://localhost:3002/api/realtime/stats
# Inject test event
curl -X POST http://localhost:3002/api/realtime/test-event \
-H "Content-Type: application/json" \
-d '{"name":"test.eth","type":"NAME_TOKEN_PURCHASED","price":"0.5"}'
# Start/stop processing
curl -X POST http://localhost:3002/api/realtime/start
curl -X POST http://localhost:3002/api/realtime/stopTest WebSocket Connection:
# Install wscat for WebSocket testing
npm install -g wscat
# Connect to WebSocket server
wscat -c ws://localhost:3002
# In the WebSocket connection, send:
# {"type":"subscribe-market"}
# {"type":"subscribe-events"}WebSocket Testing with Node.js:
const io = require('socket.io-client');
const client = io('http://localhost:3002');
client.on('connect', () => {
console.log('Connected to real-time server');
// Subscribe to market analytics
client.emit('subscribe-market');
client.emit('subscribe-events');
});
client.on('market-analytics', (data) => {
console.log('Market Analytics:', data);
});
client.on('new-events', (events) => {
console.log('New Events:', events.length);
});
client.on('flash-sale-alert', (sales) => {
console.log('Flash Sale Alert:', sales);
});Start Enhanced API Server:
cd backend
npx ts-node src/api-server-v2.tsTest API Endpoints:
# Health check
curl http://localhost:3003/health
# API documentation
curl http://localhost:3003/api/v1/docs
# Test with demo API key
API_KEY="demo-key-12345"
# API statistics
curl -H "X-API-Key: $API_KEY" http://localhost:3003/api/v1/stats
# Domain valuation with authentication
curl -X POST http://localhost:3003/api/v1/valuations \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"premium.eth"}'
# Market trends
curl -H "X-API-Key: $API_KEY" http://localhost:3003/api/v1/trends
# Market analytics
curl -H "X-API-Key: $API_KEY" http://localhost:3003/api/v1/analytics/market
# Create price alert
curl -X POST http://localhost:3003/api/v1/alerts \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"watch.eth","priceThreshold":1.0,"alertType":"email"}'
# Test rate limiting (send multiple requests quickly)
for i in {1..10}; do
curl -H "X-API-Key: $API_KEY" http://localhost:3003/api/v1/stats
done# Install apache bench
brew install httpd # macOS
# or apt-get install apache2-utils # Ubuntu
# Test API performance
ab -n 100 -c 10 http://localhost:3001/health
ab -n 50 -c 5 -p domain_data.json -T application/json http://localhost:3001/api/v1/valuations
# Create test data file
echo '{"domain":"test.eth"}' > domain_data.json# Install artillery for WebSocket load testing
npm install -g artillery
# Create WebSocket test config
cat > websocket-load-test.yml << EOF
config:
target: 'ws://localhost:3002'
phases:
- duration: 30
arrivalRate: 5
scenarios:
- name: "WebSocket connection test"
engine: ws
flow:
- connect:
namespace: ""
- emit:
channel: "subscribe-events"
data: {}
- think: 10
EOF
# Run WebSocket load test
artillery run websocket-load-test.yml# Start all services
cd backend
npx ts-node src/api-server.ts &
npx ts-node src/services/realtime-analytics-service.ts &
npx ts-node src/api-server-v2.ts &
cd ../frontend
npm run dev &
sleep 10
# Test complete data flow
curl -X POST http://localhost:3001/api/v1/valuations \
-H "Content-Type: application/json" \
-d '{"domain":"integration-test.eth"}' | jq .
# Check if event appears in real-time system
curl http://localhost:3002/api/realtime/events?limit=5 | jq .
# Kill all processes
pkill -f "ts-node"
pkill -f "npm run dev"# Connect to database (if using PostgreSQL)
psql postgresql://localhost:5432/domascope
# Check tables
\dt
# Sample queries
SELECT COUNT(*) FROM domain_features;
SELECT domain, rarity_score FROM domain_features ORDER BY rarity_score DESC LIMIT 10;
SELECT tld, COUNT(*) FROM domain_features GROUP BY tld;# Invalid domain format
curl -X POST http://localhost:3001/api/v1/valuations \
-H "Content-Type: application/json" \
-d '{"domain":"invalid-domain"}'
# Missing API key (for Track 5)
curl http://localhost:3003/api/v1/stats
# Invalid API key
curl -H "X-API-Key: invalid-key" http://localhost:3003/api/v1/stats
# Rate limit testing
for i in {1..200}; do
curl -H "X-API-Key: demo-key-12345" http://localhost:3003/api/v1/stats
done# View logs with timestamps
npx ts-node src/api-server.ts 2>&1 | while read line; do echo "$(date): $line"; done
# Monitor real-time analytics
npx ts-node src/services/realtime-analytics-service.ts 2>&1 | grep -E "(Event|Analytics|Error)"# Create monitoring script
cat > monitor-services.sh << 'EOF'
#!/bin/bash
while true; do
echo "=== $(date) ==="
echo "Track 1 API: $(curl -s http://localhost:3001/health | jq -r .status 2>/dev/null || echo 'DOWN')"
echo "Track 4 Real-time: $(curl -s http://localhost:3002/health | jq -r .status 2>/dev/null || echo 'DOWN')"
echo "Track 5 Enhanced API: $(curl -s http://localhost:3003/health | jq -r .status 2>/dev/null || echo 'DOWN')"
echo "Frontend: $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 2>/dev/null || echo 'DOWN')"
echo ""
sleep 30
done
EOF
chmod +x monitor-services.sh
./monitor-services.shcd backend
npx playwright test
# Run specific test suites
npx playwright test --grep "Track 1"
npx playwright test --grep "Real-time"
npx playwright test --grep "ML Models"
# Run with UI for debugging
npx playwright test --ui
# Generate test report
npx playwright show-report-
Port Already in Use:
lsof -ti:3001 | xargs kill -9 lsof -ti:3002 | xargs kill -9 lsof -ti:3003 | xargs kill -9
-
Environment Variables Missing:
# Create .env file echo "DOMA_API_KEY=your-doma-api-key" > backend/.env echo "DATABASE_URL=postgresql://localhost:5432/domascope" >> backend/.env
-
Dependencies Issues:
cd backend && rm -rf node_modules package-lock.json && npm install cd frontend && rm -rf node_modules package-lock.json && npm install
-
TypeScript Compilation Errors:
cd backend npx tsc --noEmit --skipLibCheck
Your system is working correctly if:
- ✅ All API endpoints return 200 status codes
- ✅ Domain valuations return scores between 0-100
- ✅ WebSocket connections establish successfully
- ✅ Real-time events are processed and broadcast
- ✅ Frontend loads and displays data
- ✅ ML models provide consistent predictions
- ✅ Database queries return expected data
- ✅ Rate limiting works as configured
- ✅ All Playwright tests pass
- ✅ System handles errors gracefully