This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the Shardus Enterprise monitor server, a Node.js/Express application that monitors the health and status of nodes in a Shardeum blockchain network. It provides REST APIs for node reporting and a web interface for real-time network visualization.
npm install # Install dependencies
npm run compile # Compile TypeScript to JavaScript
npm start # Start the server (runs build/src/server.js)npm test # Run Jest tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage reportnpm run lint # Run ESLint
npm run format-check # Check Prettier formatting
npm run fix # Auto-fix code style issues
npm run format-fix # Auto-fix formatting issuesnpm run compile # Build TypeScript
npm run clean # Clean build artifacts
npm run release:patch/minor/major # Production releases
npm run release:prerelease # Pre-release versionsThe application runs two Express servers:
- API Server (Port 3000): Handles node reporting and data retrieval endpoints
- GUI Server (Port 3001): Serves web interface with Socket.io for real-time updates
src/server.ts- Main entry point, initializes both serverssrc/app.ts- API server configurationsrc/appGUI.ts- GUI server configurationsrc/class/node.ts- Core data management for all network nodessrc/api/- API route definitionssrc/controller/- Endpoint logic for heartbeat, joining, reports, etc.
- Nodes report status via POST endpoints (
/joining,/joined,/active,/heartbeat) - Monitor validates reports against archiver data
- Node states are tracked: Joining → Syncing → Active → Removed/Crashed
- Data is aggregated and served via GET endpoints for visualization
- Health checks:
/is-alive,/is-healthy - Node reporting:
/api/heartbeat,/api/joining,/api/active - Data retrieval:
/api/report,/api/sync-report,/api/scale-report - See
docs/endpoint.mdfor complete API documentation
- Output directory:
build/ - Source directory:
src/ - Extends Google TypeScript style configuration
- Strict mode is disabled
- Uses Jest with ts-jest for TypeScript support
- Test files:
**/__tests__/**/*.tsand**/?(*.)+(spec|test).ts - Low coverage thresholds currently set (~2-3%)
- Uses log4js with multiple log files in
logs/directory - Main logs:
appData.log,api.log,apiSimpleReport.log
- Requires Node.js 18.19.1 (specified in engines)
- Express for HTTP server
- Socket.io for WebSocket connections
- TypeScript for type safety
- Jest for testing
- ESLint and Prettier for code quality