RingNet Dashboard Server
A REST API and web dashboard for monitoring RingNet network topology, nodes, and connections in real-time.
🌐 Live Demo: https://ringnet.cloud
📂 Repository: https://git.manalejandro.com/ale/ringnet
📝 Documentation: https://pad.manalejandro.com/p/2ringsnet
Features
🚀 REST API
- GET /api/nodes - List all registered nodes
- GET /api/nodes/:nodeId - Get specific node details
- GET /api/nodes/:nodeId/connections - Get node connections
- GET /api/network/stats - Network statistics
- GET /api/network/topology - Ring topology data
- POST /api/nodes/register - Register/update node status
- PUT /api/nodes/:nodeId - Update node information
📊 Web Dashboard
- Real-time network statistics
- Interactive ring topology visualization
- Node status monitoring
- Connection health tracking
- Auto-refresh every 5 seconds
Quick Start
1. Start the Dashboard Server
# From the ringnet root directory
npm run start:dashboard
# Or with development mode (auto-restart)
npm run dashboard:dev
# Or directly from server directory
cd server
npm start
The dashboard will be available at: http://localhost:3000
2. Start Nodes with Dashboard Reporting
# Start Oracle node with dashboard reporting
npm run start:oracle -- --port 8080 --dashboard http://localhost:3000
# Start regular nodes
npm run start:node -- --port 8081 --bootstrap localhost:8080 --dashboard http://localhost:3000
npm run start:node -- --port 8082 --bootstrap localhost:8080 --dashboard http://localhost:3000
3. View the Dashboard
Open your browser to http://localhost:3000 to see:
- Network statistics (total nodes, connections, oracle nodes)
- Live list of active nodes
- Interactive ring topology visualization
- Real-time status updates
API Examples
Get Network Statistics
curl http://localhost:3000/api/network/stats
Get All Nodes
curl http://localhost:3000/api/nodes
Get Ring Topology
curl http://localhost:3000/api/network/topology
Register a Node (used automatically by nodes)
curl -X POST http://localhost:3000/api/nodes/register \
-H "Content-Type: application/json" \
-d '{
"nodeId": "abc123...",
"port": 8080,
"isOracle": true,
"ringPosition": 0
}'
Configuration
Environment Variables
PORT- Server port (default: 3000)
Node Configuration
Nodes automatically report to the dashboard when started with the --dashboard parameter:
--dashboard http://localhost:3000
Dashboard Features
Network Statistics
- Total Nodes: Number of active nodes in the network
- Oracle Nodes: Number of Oracle nodes providing enhanced services
- Total Connections: Sum of all peer connections
- Last Updated: Timestamp of the most recent update
Node List
- Real-time status indicators (active/inactive)
- Node type identification (Oracle vs Regular)
- Ring position and port information
- Last seen timestamps
Ring Topology Visualization
- Interactive circular visualization of the ring
- Node positioning based on ring coordinates
- Color-coded Oracle nodes (orange) vs regular nodes (blue)
- Click nodes for detailed information
- Visual representation of the double-ring structure
Auto-Monitoring
- Nodes automatically register and update their status
- Inactive nodes are removed after 5 minutes of no updates
- Real-time updates every 5 seconds
- Graceful handling of network disconnections
Dependencies
- express - Web server framework
- cors - Cross-origin resource sharing
- ws - WebSocket support (for future real-time features)
- chalk - Colored terminal output
Development
Running in Development Mode
npm run dashboard:dev
API Testing
The dashboard includes a health check endpoint:
curl http://localhost:3000/health
Custom Styling
Modify public/index.html to customize the dashboard appearance. The dashboard uses:
- CSS Grid for responsive layout
- CSS backdrop-filter for glassmorphism effects
- Vanilla JavaScript for API interactions
- SVG-based ring visualization
Integration
Nodes automatically report their status when the --dashboard parameter is provided. The reporting includes:
- Node identification and type
- Ring position and topology
- Connection status and peer information
- Network statistics and health data
The dashboard is designed to be lightweight and can run alongside the ring network without affecting performance.