Environment Setup
Configure your development environment with the required environment variables and settings for Polyblock.
Prerequisites
Ensure you have the following installed:
Node.js (v18+)
Required for running the Next.js frontend and WebSocket service.
node --versionnpm or yarn
Package manager for installing dependencies.
npm --versionDocker Desktop
Required for running TimescaleDB database.
docker --versionGit
For version control and cloning the repository.
git --versionEnvironment Variables
Polyblock requires several environment variables to function properly:
DATABASE_URL
Connection string for TimescaleDB.
postgresql://Polyblock:YOUR_PASSWORD_HERE@localhost:5432/PolyblockNEXT_PUBLIC_WEBSOCKET_SERVER_URL
WebSocket server URL for real-time data.
ws://localhost:8081WEBSOCKET_SERVER_HTTP_URL
HTTP URL for the WebSocket service.
http://localhost:8081PLATFORM_FEE_WALLET_ADDRESS
Platform fee wallet address for collecting trading fees.
0xc612E8925bE07E8F836C26F37E74780D4d012241Creating .env.local
Create a .env.local file in the project root:
cat > .env.local << 'EOF'
DATABASE_URL=postgresql://Polyblock:YOUR_PASSWORD_HERE@localhost:5432/Polyblock
NEXT_PUBLIC_WEBSOCKET_SERVER_URL=ws://localhost:8081
WEBSOCKET_SERVER_HTTP_URL=http://localhost:8081
PLATFORM_FEE_WALLET_ADDRESS=0xc612E8925bE07E8F836C26F37E74780D4d012241
EOFVerification
Verify your environment is configured correctly:
# Check environment file exists
ls -la .env.local
# View contents (be careful with sensitive data)
cat .env.local | grep -E "DATABASE_URL|WEBSOCKET"Secrets hygiene
Treat database URLs and signing keys like production secrets even on a laptop. Use separate databases per developer when possible so test data never overlaps. Before sharing screen recordings or support bundles, scrub .env.local values and rotate anything that might have leaked.
CI pipelines should inject secrets from the provider's secret store, not hard-code them in workflow YAML. Document which variables are required for each service (web, websocket, workers) so new contributors can boot the stack without guessing optional flags.
