Performance Monitoring Platform - A comprehensive full-stack application for real-time performance monitoring, regression detection, and Git-tracked baseline management.
- Real-time Metrics Ingestion - Collect latency, throughput, and performance data
- Regression Detection - Hybrid z-score + baseline comparison algorithms
- Git-Tracked Baselines - Version-controlled per-user performance baselines stored as JSON
- Unix Perf Integration - CPU cycles, cache misses, instruction counts
- Automated Analysis Worker - Background processing every 60 seconds
- Comprehensive Reports - Aggregated analysis with actionable insights
- Secure Authentication - JWT-based auth with HTTP-only cookies
- Rate Limiting - DDoS protection with express-rate-limit
- Input Validation - Joi schemas for all API endpoints
- Security Headers - Helmet middleware for production-ready security
- Modern Landing Page - Beautiful gradient hero with feature showcase
- System Dashboard - Real-time overview of all monitored services
- Service Details - Deep dive into individual service performance
- Interactive Charts - Recharts-powered latency and performance visualizations
- Regression Alerts - Critical and warning-level performance notifications
- Reports & Baselines - Browse historical data and Git baselines
- Skeleton Loading - Smooth UX with animated loading states
- Performance Optimized - React.memo, useMemo, custom hooks
- Responsive Design - Mobile, tablet, and desktop support
- Redux State Management - Centralized auth and API state
- Node.js v18+ (recommended: v20+)
- MongoDB v5+ (local or Atlas)
- Git (for baseline management)
- npm or yarn
git clone https://github.com/yourusername/perfsight.git
cd PerfSightcd backend
npm installCreate a .env file in the backend directory:
NODE_ENV=development
PORT=5000
MONGO_URI=mongodb://localhost:27017/perfsight
JWT_SECRET=your_jwt_secret_key_here
# MongoDB TTL retention (days). Default: 30
DATA_RETENTION_DAYS=30For MongoDB Atlas:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/perfsight?retryWrites=true&w=majoritycd ../frontend
npm installTerminal 1 - Backend Server:
cd backend
npm run devServer runs on: http://localhost:5000
Terminal 2 - Analysis Worker (Optional):
cd backend
npm run workerTerminal 3 - Frontend Dev Server:
cd frontend
npm run devFrontend runs on: http://localhost:3000
Build Frontend:
cd frontend
npm run buildRun Production Server:
cd backend
NODE_ENV=production npm startApp runs on: http://localhost:5000 (serves both API and frontend)
PerfSight/
βββ backend/
β βββ src/
β β βββ config/
β β β βββ db.js # MongoDB connection
β β βββ middleware/
β β β βββ authMiddleware.js # JWT authentication
β β β βββ errorMiddleware.js # Error handling
β β βββ modules/
β β β βββ users/ # User authentication
β β β βββ metrics/ # Metric ingestion
β β β βββ analysis/ # Rolling window analysis
β β β βββ regression/ # Regression detection
β β β βββ baseline/ # Git baseline management
β β β βββ perf/ # Unix perf metrics
β β β βββ report/ # Aggregated reports
β β β βββ dashboard/ # Dashboard API
β β βββ workers/
β β β βββ analysis.worker.js # Background analysis
β β βββ app.js # Express app config
β β βββ server.js # Server entry point
β βββ .env.example
β βββ package.json
β βββ server.js # Main entry point
β
βββ frontend/
β βββ src/
β β βββ api/
β β β βββ axiosClient.js # Axios configuration
β β βββ components/
β β β βββ dashboard/ # ServiceCard, LoadingState
β β β βββ service/ # SummaryCard, PerfMetricsCard
β β β βββ charts/ # LatencyChart, RangeSelector
β β β βββ alerts/ # AlertBanner, SeverityBadge
β β β βββ reports/ # ReportTable
β β β βββ baselines/ # BaselineCard, BaselineList
β β β βββ skeletons/ # Loading skeletons
β β β βββ layout/ # Header, Sidebar, DashboardLayout
β β βββ hooks/
β β β βββ api/ # Custom data-fetching hooks
β β β βββ useScrollToTop.js # Navigation scroll utility
β β βββ pages/
β β β βββ Dashboard.jsx # System overview
β β β βββ ServiceDetails.jsx # Service deep dive
β β β βββ Reports.jsx # Reports browser
β β β βββ Baselines.jsx # Git baselines
β β β βββ Perf.jsx # Perf metrics
β β βββ screens/
β β β βββ HomeScreen.jsx # Landing page
β β β βββ LoginScreen.jsx # Authentication
β β β βββ RegisterScreen.jsx # User registration
β β βββ slices/
β β β βββ authSlice.js # Auth state
β β β βββ apiSlice.js # RTK Query
β β βββ App.jsx
β β βββ main.jsx
β β βββ store.js # Redux store
β βββ index.html
β βββ vite.config.js
β βββ package.json
β
βββ baselines/ # Per-user baselines: <userId>/<service>.json
β βββ README.md # Baseline docs
β
βββ README.md # This file
POST /api/users- Register new userPOST /api/users/auth- Login userPOST /api/users/logout- Logout userGET /api/users/profile- Get user profile (protected)PUT /api/users/profile- Update user profile (protected)
POST /api/metrics- Ingest metric (protected)GET /api/metrics/recent?service=:service- Get recent metrics (protected)GET /api/metrics/timeseries- Get latency timeseries (protected)GET /api/metrics/endpoint-summary- Get endpoint summary (protected)GET /api/metrics/overview- Get system overview (protected)
GET /api/baselines- Get current user's baseline services (protected)GET /api/baselines/:service- Get current user's baseline for service (protected)POST /api/baselines/:service- Update current user's baseline (protected)
POST /api/perf- Ingest perf metric (protected)GET /api/perf/timeseries- Get perf timeseries (protected)
POST /api/reports/:service- Create report (protected)GET /api/reports/:service- Get reports for service (protected)
GET /api/dashboard/overview/:service- Get service overview (protected)GET /api/dashboard/system-health- Get system health (protected)GET /api/dashboard/latency-chart/:service- Get latency chart data (protected)
curl -X POST http://localhost:5000/api/metrics \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"service": "api-gateway",
"endpoint": "/users",
"method": "GET",
"latency": 45.3,
"statusCode": 200
}'curl -X POST http://localhost:5000/api/perf \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"service": "api-gateway",
"cpuCycles": 1234567890,
"cacheMisses": 12345,
"instructions": 9876543210
}'- JWT Authentication - Secure token-based authentication
- HTTP-Only Cookies - Prevents XSS attacks
- Rate Limiting - 20 requests per 15 minutes on auth routes
- Helmet.js - Security headers (CSP, HSTS, etc.)
- CORS - Configured for development and production
- Input Validation - Joi schemas prevent NoSQL injection
- Password Hashing - bcrypt with salt rounds
- React 19 - Latest React with concurrent features
- Vite 6.3.5 - Lightning-fast build tool
- Redux Toolkit - State management
- React Router v6 - Client-side routing
- Bootstrap 5 - Responsive UI framework
- Recharts - Interactive charts
- Axios - HTTP client
- React Toastify - Toast notifications
- Node.js - JavaScript runtime
- Express 4.18 - Web framework
- MongoDB - NoSQL database
- Mongoose 7.1 - ODM for MongoDB
- JWT - JSON Web Tokens
- Joi - Schema validation
- Helmet - Security middleware
- bcryptjs - Password hashing
- React.memo for expensive components
- useMemo for derived computations
- Custom hooks for data fetching
- Skeleton loading states
- Code splitting ready
- Optimized bundle size
- Background workers for analysis
- Indexed MongoDB queries
- Rate limiting
- Request size limits (10kb)
- Connection pooling
- Bundle size warning (>500KB) - Consider implementing code splitting for production
- Worker runs independently - Ensure MongoDB is running before starting worker
- Baseline directory must exist - Create
baselines/folder if missing
- Metric Collection - Services send metrics via POST /api/metrics
- Analysis Worker - Runs every 60s, computes rolling window analysis
- Regression Detection - Hybrid z-score + baseline comparison
- Report Generation - Aggregates analysis, baselines, regressions, perf data
- Dashboard Display - Frontend visualizes data with charts and alerts
- Baseline Management - Commit per-user baselines (
baselines/<userId>/<service>.json) to Git for version control
NODE_ENV=development|production
PORT=5000
MONGO_URI=mongodb://localhost:27017/perfsight
JWT_SECRET=your_secret_key- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
Shubham
- Express.js team for the robust web framework
- React team for the amazing UI library
- MongoDB team for the flexible database
- All open-source contributors
Built with β€οΈ for performance monitoring