|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Loading prices...
Configuration

Running Locally

Complete guide to running all Polyblock services locally for development.

Quick Start

Use the automated startup script to launch all services:

bash scripts/startup.sh

This script will:

1. Start TimescaleDB — Launches Docker container for the database
2. Build WebSocket Service — Compiles TypeScript and starts ws-service on port 8081
3. Start Next.js — Launches the frontend on port 3000
4. Verify Services — Checks all services are running correctly

Manual Startup

Start services manually in separate terminal windows:

# Terminal 1: Database
docker-compose up -d timescaledb

# Terminal 2: WebSocket Service
cd ws-service
npm install
npm run build
HTTP_PORT=8081 npm run start

# Terminal 3: Next.js Frontend
cd /path/to/Polyblock-main
npm install
npm run dev
Kill any existing processes on ports 3000 and 8081 before starting:
lsof -ti :3000 :8081 | xargs kill -9

Verify Services

Check all services are running:

# Check database
docker-compose ps timescaledb

# Check WebSocket service
curl http://localhost:8081/health
# Expected: {"status":"ok"}

# Check Next.js
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000
# Expected: 200

Then open http://localhost:3000 in your browser.

Common Issues

WebSocket connection errors in browser

Ensure ws-service is running on port 8081 and .env.local has correct NEXT_PUBLIC_WEBSOCKET_SERVER_URL.

No market data loading

The ws-service needs to be running to fetch market data. Check its logs for connection errors.

Database connection failed

Verify TimescaleDB container is healthy and DATABASE_URL is correct.

TypeScript build errors

Run npm install in ws-service directory to ensure all dependencies are installed.

Next.js supports hot reload. For ws-service changes, you'll need to rebuild (npm run build) and restart.