A comprehensive real-time monitoring and incident management system powered by AI for event security and crowd management. The system provides live video analysis, automated threat detection, and role-based incident response coordination.
- Real-time Video Monitoring - Live video feed analysis with AI-powered detection
- Automated Incident Detection - AI identifies fires, crowd surges, medical emergencies, and security threats
- Role-based Access Control - Admin, Operator, and Responder roles with specific permissions
- Interactive Zone Mapping - Geographic incident visualization with Leaflet maps
- Real-time Notifications - WebSocket-powered instant alerts and updates
- Incident Management - Complete lifecycle tracking from detection to resolution
- Computer Vision - Object detection and scene analysis
- Threat Classification - Automatic severity assessment and confidence scoring
- Bounding Box Detection - Visual highlighting of detected objects/incidents
- Smart Alerts - Context-aware notification system
- Admin - System configuration, user management, full access
- Operator - Monitor feeds, manage incidents, coordinate responses
- Responder - Receive assignments, update incident status, field operations
- Node.js with Express.js framework
- MongoDB for data persistence
- Socket.IO for real-time communication
- JWT authentication with role-based authorization
- Nodemailer for email notifications
- Helmet for security headers
- Rate limiting for API protection
- React 19 with modern hooks
- Vite for fast development and building
- Tailwind CSS for responsive styling
- Zustand for state management
- React Router for navigation
- Leaflet for interactive maps
- Recharts for data visualization
- Framer Motion for animations
- Node.js (v18 or higher)
- MongoDB (v6 or higher)
- npm or yarn package manager
git clone <repository-url>cd backend
npm install# Copy the environment template
cp .env.example .env
# Edit .env with your configuration
nano .envRequired Environment Variables:
# Server Configuration
NODE_ENV=development
PORT=3000
# Database
MONGO_URI=mongodb://localhost:27017/auth_tutorial
# JWT Secret (generate a strong secret)
JWT_SECRET=your_super_secret_jwt_key_here
# Client URL
CLIENT_URL=http://localhost:5173
# Email Configuration (optional for development)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
EMAIL_FROM=your_email@gmail.com
# Google Maps API (for enhanced mapping features)
GOOGLE_MAPS_API_KEY=your_google_maps_api_key# Start MongoDB service
# On macOS with Homebrew:
brew services start mongodb/brew/mongodb-community
# On Ubuntu:
sudo systemctl start mongod
# Seed sample data (optional)
npm run seed-monitoringnpm run devThe backend will start on http://localhost:3000
# In a new terminal
cd ../frontend
npm installnpm run devThe frontend will start on http://localhost:5173
AI_EVENT_MONITOR/
βββ backend/ # Node.js/Express backend
β βββ controllers/ # Request handlers
β βββ models/ # MongoDB schemas
β βββ routes/ # API endpoints
β βββ middleware/ # Authentication & security
β βββ services/ # Business logic
β βββ utils/ # Helper functions
β βββ nodemailer/ # Email services
β βββ scripts/ # Database seeding
β βββ index.js # Server entry point
β
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ admin/ # Admin-specific components
β β β βββ auth/ # Authentication forms
β β β βββ layout/ # Layout components
β β β βββ maps/ # Map components
β β β βββ monitoring/ # Monitoring dashboards
β β β βββ ui/ # Base UI components
β β βββ pages/ # Route components
β β β βββ admin/ # Admin pages
β β β βββ auth/ # Auth pages
β β β βββ dashboard/ # Dashboard pages
β β β βββ operator/ # Operator pages
β β β βββ responder/ # Responder pages
β β βββ services/ # API services
β β βββ store/ # State management
β β βββ utils/ # Helper functions
β β βββ App.jsx # Main app component
β βββ package.json
β
βββ README.md # This file
- Navigate to
/signup - Choose role: Admin, Operator, or Responder
- Complete email verification
- Access role-specific dashboard
- Admin: Full system access, user management, system configuration
- Operator: Monitor incidents, manage responses, coordinate teams
- Responder: Receive assignments, update status, field operations
- Access real-time video feeds from multiple zones
- AI-powered object detection and threat identification
- Visual bounding boxes around detected objects
- Confidence scoring for AI predictions
- Automatic incident creation from AI detections
- Manual incident reporting
- Status tracking: Active β Assigned β In Progress β Resolved
- Priority levels and severity classification
- Response time tracking
- Interactive map with incident markers
- Zone-specific filtering and monitoring
- Geographic clustering of incidents
- Real-time location updates
- WebSocket-powered instant alerts
- Role-based notification filtering
- Email notifications for critical incidents
- Sound alerts for urgent situations
- Incident statistics and trends
- Response time analytics
- Zone-wise incident distribution
- Performance metrics
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginGET /api/auth/check-auth- Verify authenticationPOST /api/auth/logout- User logoutPOST /api/auth/forgot-password- Password reset requestPOST /api/auth/reset-password/:token- Reset password
GET /api/dashboard/admin- Admin dashboard dataGET /api/dashboard/operator- Operator dashboard dataGET /api/dashboard/responder- Responder dashboard data
GET /api/monitoring/incidents- Get incidentsPOST /api/monitoring/incidents- Create incidentPUT /api/monitoring/incidents/:id- Update incidentDELETE /api/monitoring/incidents/:id- Delete incident
incident:created- New incident detectedincident:updated- Incident status changedincident:assigned- Incident assigned to responderalert:critical- Critical alert notification
npm run dev # Start development server
npm run start # Start production server
npm run seed-monitoring # Seed sample data
npm run test:notifications # Test email systemnpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint1. Backend won't start - JWT_SECRET missing
# Ensure .env file exists and contains JWT_SECRET
cp .env.example .env
# Edit .env and add a strong JWT_SECRET2. MongoDB connection failed
# Start MongoDB service
brew services start mongodb/brew/mongodb-community # macOS
sudo systemctl start mongod # Linux3. Frontend API calls failing
- Verify backend is running on port 3000
- Check CORS configuration in backend
- Ensure cookies are enabled in browser
4. Email notifications not working
- Configure EMAIL_* variables in .env
- Use app-specific passwords for Gmail
- Check email provider SMTP settings
5. WebSocket connection issues
- Verify Socket.IO configuration
- Check firewall settings
- Ensure both frontend and backend are running
Enable debug logging by setting:
NODE_ENV=development- Set
NODE_ENV=production - Configure production MongoDB URI
- Set secure JWT_SECRET
- Configure email service
- Enable HTTPS
- Set up process manager (PM2)
- Build the application:
npm run build - Deploy to static hosting (Vercel, Netlify)
- Configure environment variables
- Update API URLs for production
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the ISC License.
For support and questions:
- Create an issue in the repository
- Check the troubleshooting section
- Review the API documentation
Built with β€οΈ for enhanced event security and monitoring