A real-time monitoring dashboard for the Prime Number Distributed System. This React + Vite application displays live statistics about workers, jobs, and prime number discoveries.
- 📊 Real-time job and worker monitoring
- 🔢 Live prime number count tracking
⚠️ System alerts and notifications- 📈 Visual charts and statistics
- 🔄 Auto-refresh capabilities
Before running this project, ensure you have:
- Node.js - v20.19+ or v22.12+ (Download Node.js)
- npm - Comes with Node.js
- Prime Coordinator - Running locally or accessible via network
# Navigate to the project directory
cd prime-dashboard
# Install dependencies
npm installCreate a .env file in the project root with your coordinator connection details:
VITE_COORDINATOR_HOST=localhost
VITE_COORDINATOR_PORT=9000For remote coordinator or Ngrok tunnel:
VITE_COORDINATOR_HOST=your-ngrok-url.ngrok-free.dev
VITE_COORDINATOR_PORT=443npm run devThe dashboard will be available at http://localhost:5173
| Script | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build for production (outputs to dist/) |
npm run preview |
Preview production build locally |
npm run lint |
Run ESLint to check code quality |
-
Start your Prime Coordinator:
# In a separate terminal cd /path/to/prime-coordinator ./bin/coordinator -config configs/config.yaml
-
Start the dashboard:
npm run dev
-
Open your browser: Navigate to
http://localhost:5173
# Build the application
npm run build
# Preview the build
npm run previewprime-dashboard/
├── public/ # Static assets
├── src/
│ ├── assets/ # Images and icons
│ ├── App.jsx # Main dashboard component
│ ├── App.css # Dashboard styles
│ ├── main.jsx # Application entry point
│ └── index.css # Global styles
├── .env # Environment variables (create this)
├── package.json # Dependencies and scripts
└── vite.config.js # Vite configuration
Problem: "Failed to connect to API" or similar errors
Solutions:
- Verify the coordinator is running:
curl http://localhost:9000/status - Check
.envfile has correctVITE_COORDINATOR_HOSTandVITE_COORDINATOR_PORT - Restart the dev server after changing
.env: Stop withCtrl+C, thennpm run dev
Problem: Another process is using port 5173
Solution:
# Kill the process on port 5173 (Mac/Linux)
lsof -ti:5173 | xargs kill -9
# Or use a different port
npm run dev -- --port 3000Problem: npm install errors
Solutions:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json:rm -rf node_modules package-lock.json - Reinstall:
npm install
- React 19.1 - UI framework
- Vite 7.1 - Build tool and dev server
- Axios - HTTP client for API requests
- Recharts - Charting library
- Lucide React - Icon library
For production deployment instructions (Netlify, Ngrok, etc.), see DEPLOYMENT.md.
- Follow the existing code style
- Run
npm run lintbefore committing - Test all changes locally with
npm run dev
This project is part of a distributed systems coursework.