A modern real-time server monitoring application built with Angular 21 and Node.js, featuring live system metrics visualization with Chart.js.
- Angular 21: Upgraded from Angular 8 to the latest stable version
- Standalone Components: Modern Angular architecture with standalone components
- TypeScript 5.5: Latest TypeScript with strict mode enabled
- Modern Server: Node.js with ES modules, Socket.io v4, and systeminformation library
- Enhanced UI: Responsive design with modern CSS and dark mode support
- Docker Support: Multi-stage Docker builds for production deployment
- ESLint: Modern linting replacing TSLint
- Improved Performance: Optimized builds and better resource management
- Node.js 20+
- npm 10+
- Docker (optional, for containerized deployment)
-
Clone and Install Dependencies
git clone <repository-url> cd ServerMonitor # Install client dependencies cd Client npm install # Install server dependencies cd ../Server npm install
-
Start Development Servers
# Start the server (in Server directory) npm run dev # Start the Angular client (in Client directory) npm start
-
Access the Application
- Open browser to
http://localhost:4200 - Server runs on port
9500
- Open browser to
-
Production Build
docker-compose up --build
-
Development with Hot Reload
docker-compose -f docker-compose.dev.yml --profile dev up --build
Access the application at:
- Angular Client: http://localhost:4201
- Node.js Server: http://localhost:9501
ServerMonitor/
βββ Client/ # Angular 21 application
β βββ src/
β β βββ app/
β β β βββ app.component.ts # Standalone main component
β β β βββ app.component.html # Modern UI template
β β β βββ app.component.css # Responsive styling
β β β βββ app.routes.ts # Angular 21 routing
β β βββ main.ts # Bootstrap application
β β βββ ...
β βββ package.json # Angular 21 dependencies
β βββ angular.json # Angular CLI configuration
β βββ tsconfig.json # TypeScript 5.5 config
β βββ eslint.config.js # ESLint configuration
βββ Server/ # Node.js backend
β βββ src/
β β βββ index.ts # TypeScript server with Socket.io v4
β βββ dist/ # Compiled JavaScript output
β βββ package.json # Modern Node.js dependencies
β βββ tsconfig.json # TypeScript configuration
βββ Client/
β βββ Dockerfile # Angular 21 production build
β βββ Dockerfile.dev # Angular 21 development build
β βββ nginx.conf # Nginx configuration
βββ Server/
β βββ Dockerfile # Node.js production build
β βββ Dockerfile.dev # Node.js development build
βββ docker-compose.yml # Production Docker orchestration
βββ docker-compose.dev.yml # Development Docker orchestration
βββ start.sh # macOS/Linux startup script
βββ start.bat # Windows startup script
βββ MIGRATION_GUIDE.md # Detailed migration instructions
βββ MIGRATION_CHECKLIST.md # Migration progress tracking
βββ README.md # This file
Server Environment (.env)
PORT=9500
NODE_ENV=development
CORS_ORIGIN=http://localhost:4200Client Environment (src/environments/)
export const environment = {
production: false,
serverUrl: 'http://localhost:9500'
};- CPU Usage: Live CPU utilization with historical data
- Memory Usage: Real-time memory consumption visualization
- System Information: CPU cores, system type, and more
- Connection Status: Visual indicator of server connection
- Responsive Design: Works on desktop, tablet, and mobile
- Dark Mode Support: Automatic dark mode based on system preferences
- Smooth Animations: CSS transitions and hover effects
- Modern Charts: Interactive Chart.js visualizations
- Hot Reload: Fast development with live updates
- Type Safety: Full TypeScript support with strict mode
- Modern Tooling: ESLint, Angular CLI, and modern build pipeline
- Container Ready: Docker support for easy deployment
# Build Angular application
cd Client
npm run build
# Start production server
cd ../Server
npm start# Build and run production container
docker-compose up --build -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down# Development
ng build --configuration development
# Production
ng build --configuration production
# Staging (if configured)
ng build --configuration staging# Check server status
curl http://localhost:9500
# Check application
curl http://localhost:4200# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Run tests
npm test
# Build with watch mode
npm run watch- CORS Configuration: Proper cross-origin resource sharing setup
- Input Validation: Server-side validation for all inputs
- Error Handling: Comprehensive error handling and logging
- Secure WebSocket: Secure Socket.io connections
- Environment Variables: Sensitive data in environment variables
- Bundle Size: Optimized builds with tree-shaking
- Lazy Loading: On-demand component loading
- Change Detection: OnPush strategy where applicable
- Asset Optimization: Compressed and optimized assets
- Efficient Monitoring: Optimized system monitoring intervals
- Memory Management: Proper cleanup and resource management
- Connection Handling: Efficient WebSocket connection management
- Error Recovery: Robust error handling and recovery
- β Angular 8 β Angular 21 upgrade
- β Standalone components implementation
- β Modern server architecture with ES modules
- β Socket.io v4 upgrade
- β systeminformation library integration
- β Enhanced UI with responsive design
- β Docker containerization
- β ESLint implementation
- β TypeScript 5.5 with strict mode
- β Server converted to TypeScript
- β Automated startup scripts for development
- Angular 8 application
- Basic server monitoring
- Socket.io v2
- os-monitor library
- Traditional module-based architecture
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License - see the package.json file for details.
- Port Conflicts: Change ports in docker-compose.yml if needed
- Dependency Issues: Clear node_modules and reinstall:
rm -rf node_modules package-lock.json && npm install - Socket Connection: Ensure CORS is properly configured
- Build Errors: Check Node.js and npm versions meet requirements
If npm install produces many errors, try these steps to debug and recover:
- Verify Node & npm versions:
node -v
npm -v
# If using nvm:
nvm use || nvm install- Clean and reinstall dependencies (safe for development):
./bootstrap.shThis removes node_modules and package-lock.json for each subproject and runs npm install.
- For persistent errors, capture verbose logs for analysis:
cd Client
npm install --verbose > ~/client-npm-install.log 2>&1
cd ../Server
npm install --verbose > ~/server-npm-install.log 2>&1- Peer dependency errors with npm 7+ can be skipped temporarily with:
npm install --legacy-peer-deps- If native modules fail to build (macOS), you may need:
xcode-select --install # Command Line Tools
brew install pkg-config libffi # if brew is used- If errors relate to TypeScript mismatch (Angular requires >=5.9.0), make sure the local TypeScript is updated in
Client/package.jsonand re-run:
cd Client
rm -rf node_modules package-lock.json
npm install
npx tsc -v- If all else fails, clear npm cache and try again:
npm cache clean --force
rm -rf node_modules package-lock.json
npm installIf you want me to inspect, provide the client-npm-install.log or server-npm-install.log from the above commands.
- If you see TypeScript module resolution errors like
Cannot find module '@angular/common/http', updatemoduleResolutioninClient/tsconfig.jsontobundlerornode16and reinstall dependencies:
{
"compilerOptions": {
"moduleResolution": "bundler"
}
}- Check MIGRATION_GUIDE.md for detailed migration information
- Review MIGRATION_CHECKLIST.md for progress tracking
- Open an issue for bugs or feature requests
- Check the Angular and Node.js documentation for version-specific issues