# Quick Fix Guide - Explorer Errors **Status**: 🔴 Backend API Server Not Running --- ## Problem All API endpoints are returning HTTP 000 (connection refused) because the backend server is not running. ## Quick Fix (5 minutes) ### Step 1: Set Database Environment Variables ```bash export DB_HOST=localhost export DB_PORT=5432 export DB_USER=explorer export DB_PASSWORD=your_password_here export DB_NAME=explorer export CHAIN_ID=138 export PORT=8080 ``` ### Step 2: Start the Backend Server **Option A: Using the startup script (Recommended)** ```bash cd /home/intlc/projects/proxmox/explorer-monorepo ./scripts/start-backend.sh ``` **Option B: Manual start** ```bash cd /home/intlc/projects/proxmox/explorer-monorepo/backend/api/rest go run main.go ``` ### Step 3: Verify It's Working In another terminal: ```bash # Check health endpoint curl http://localhost:8080/health # Check stats endpoint curl http://localhost:8080/api/v2/stats # Check blocks endpoint curl http://localhost:8080/api/v1/blocks?page=1&page_size=1 ``` ### Step 4: Re-run Diagnostics ```bash cd /home/intlc/projects/proxmox/explorer-monorepo ./scripts/check-logs-and-errors.sh ``` --- ## Expected Results After starting the backend: ✅ `/health` returns: `{"status":"healthy",...}` ✅ `/api/v2/stats` returns statistics ✅ `/api/v1/blocks` returns block list ✅ `/api/v1/transactions` returns transaction list ✅ Frontend loads data correctly --- ## Troubleshooting ### Database Connection Error If you see: `Failed to connect to database` 1. Check if PostgreSQL is running: ```bash sudo systemctl status postgresql ``` 2. Verify database exists: ```bash psql -h localhost -U explorer -l | grep explorer ``` 3. Test connection: ```bash psql -h localhost -U explorer -d explorer -c "SELECT 1;" ``` ### Port Already in Use If port 8080 is already in use: ```bash # Find process using port 8080 lsof -i :8080 # Kill it kill $(lsof -t -i:8080) # Or use a different port export PORT=8081 ``` ### Go Module Errors If you see Go module errors: ```bash cd /home/intlc/projects/proxmox/explorer-monorepo/backend go mod download go mod tidy ``` --- ## Running as a Service (Optional) To run the backend as a systemd service: 1. Create service file: `/etc/systemd/system/explorer-api.service` 2. See `docs/ERROR_REPORT_AND_FIXES.md` for service configuration 3. Enable and start: ```bash sudo systemctl daemon-reload sudo systemctl enable explorer-api sudo systemctl start explorer-api ``` --- ## Full Error Report For complete error analysis, see: `docs/ERROR_REPORT_AND_FIXES.md`