A comprehensive, real-time incident reporting and management platform for law enforcement agencies, emergency response teams, and community safety initiatives
Features โข Tech Stack โข Quick Start โข Live Demo โข Documentation โข Contributing
Incident Report is a comprehensive, real-time incident reporting and management platform designed specifically for law enforcement agencies, emergency response teams, and community safety initiatives. Built with modern web technologies, it streamlines the entire incident lifecycle from initial report to resolution.
- โก Real-time Communication - Instant chat between citizens and law enforcement
- ๐ Secure & Anonymous - Report incidents with or without identification
- ๐ฑ Mobile-First Design - Works seamlessly on any device
- ๐ฏ Role-Based Access - Specialized interfaces for different user types
- ๐ Analytics Dashboard - Track response times and crime patterns
- ๐ Multi-Department Support - Coordinate across specialized units
Traditional incident reporting systems are often:
- โ Slow and bureaucratic
- โ Lack real-time communication
- โ Don't support anonymous reporting
- โ Have poor mobile experiences
- โ Provide limited tracking for citizens
Incident Report solves these problems with a modern, user-friendly platform that prioritizes speed, security, and transparency.
Incident Report is a production-ready, enterprise-grade solution that combines real-time communication, intelligent case routing, and comprehensive analytics into one seamless experience. Whether you're handling customer support, incident reports, or emergency response, this platform scales with your needs.
- โก Lightning-Fast Real-Time Communication - Built on Socket.io for instant messaging
- ๐ฏ Smart Case Routing - AI-ready architecture for intelligent agent assignment
- ๐ Rich Analytics Dashboard - Beautiful visualizations with Recharts
- ๐ Enterprise Security - JWT authentication, role-based access control
- ๐จ Modern UI/UX - Built with Tailwind CSS, Radix UI, and Framer Motion
- ๐ฑ Fully Responsive - Works flawlessly on desktop, tablet, and mobile
- ๐ Production Ready - Comprehensive error handling, validation, and testing
- ๐ Fully Documented - Swagger API documentation included
- ๐ Easy Reporting - Submit incidents in under 2 minutes
- ๐ Secure Account Creation - Email OTP verification for account registration
- ๐ Password Recovery - Secure password reset via email OTP verification
- ๐ต๏ธ Anonymous Options - Report without revealing identity
- ๐ฌ Direct Communication - Chat with assigned officers in real-time
- ๐ Location Tracking - Automatic GPS location capture
- ๐ Evidence Upload - Attach photos, videos, and documents
- ๐ Status Notifications - Get updates on your case progress
- ๐ฑ Mobile App - iOS and Android support (coming soon)
- ๐ฏ Smart Assignment - Auto-routing to specialized departments
- ๐ Case Dashboard - Manage all assigned incidents
- ๐ฌ Multi-Channel Communication - Chat, voice notes, file sharing
- ๐ Investigation Tools - Timeline tracking, evidence management
- ๐ค Collaboration - Work with other departments seamlessly
- ๐ Performance Metrics - Track response times and resolution rates
- ๐ Real-time Alerts - Instant notifications for urgent cases
- ๐ Analytics Dashboard - Comprehensive reporting and insights
- ๐ฅ Agent Management - Create, assign, and monitor agents
- ๐ข Department Oversight - Track workload distribution
- ๐๏ธ Priority Management - Escalate critical incidents
- ๐ Trend Analysis - Identify crime patterns and hotspots
- โ๏ธ System Configuration - Customize workflows and settings
- ๐ Audit Logs - Complete activity tracking
- Live Chat System - Instant messaging between customers and agents
- Typing Indicators - See when someone is typing in real-time
- Read Receipts - Track message delivery and read status
- Emoji Support - Rich emoji picker for expressive communication
- File Attachments - Upload and share images via Cloudinary
- Multi-Status Workflow - Pending โ Active โ Resolved/Rejected
- Department-Based Routing - 20+ specialized departments
- Location Tracking - GPS-based location services
- Case History - Complete audit trail of all interactions
- Priority Assignment - Smart prioritization system
- Customer Portal - Submit cases, track status, chat with agents
- Agent Dashboard - Manage assigned cases, real-time chat, analytics
- Supervisor View - Oversee team performance and case distribution
- Admin Panel - Full system control, user management, analytics
- Real-Time Dashboards - Live metrics and KPIs
- Performance Tracking - Response times, resolution rates
- Team Analytics - Agent performance metrics
- Case Statistics - Department-wise breakdowns
- Visual Charts - Beautiful data visualizations
- Real-Time Alerts - Instant notifications for new messages and case updates
- Email Notifications - Automated email alerts via Nodemailer/Resend
- In-App Notifications - Persistent notification center
- Status Updates - Automatic notifications on case status changes
- JWT Authentication - Secure token-based authentication
- OTP Verification - Email-based OTP for account creation and password reset
- Password Hashing - Bcrypt with salt rounds
- Cookie-Based Sessions - Secure HTTP-only cookies
- Role-Based Permissions - Granular access control
- Input Validation - Yup schema validation
| Technology | Purpose | Version |
|---|---|---|
| React 18 | UI Framework | Latest |
| TypeScript | Type Safety | Latest |
| Vite | Build Tool | Latest |
| Tailwind CSS | Styling | Latest |
| Radix UI | Accessible Components | Latest |
| Framer Motion | Animations | Latest |
| React Query | Data Fetching | v5 |
| Zustand | State Management | v5 |
| Socket.io Client | Real-Time Communication | v4 |
| React Router | Routing | v6 |
| React Hook Form | Form Management | Latest |
| Yup | Validation | Latest |
| Recharts | Data Visualization | Latest |
| Sonner | Toast Notifications | Latest |
| Technology | Purpose | Version |
|---|---|---|
| Node.js | Runtime | Latest |
| Express.js | Web Framework | v4 |
| MongoDB | Database | Latest |
| Mongoose | ODM | v8 |
| Socket.io | WebSocket Server | v4 |
| JWT | Authentication | v9 |
| Bcrypt | Password Hashing | Latest |
| Multer | File Upload | Latest |
| Cloudinary | Media Storage | Latest |
| Nodemailer/Resend | Email Service | Latest |
| Swagger | API Documentation | Latest |
- Node.js >= 18.x
- MongoDB >= 6.x (local or Atlas)
- npm or yarn
-
Clone the repository
git clone https://github.com/khalifadalhat/IncidentReport.git cd IncidentReport -
Install dependencies
# Install root dependencies (if any) npm install # Install backend dependencies cd backend npm install # Install frontend dependencies cd ../client npm install
-
Environment Setup
Backend (
backend/.env):# Database MONGODB_URI=mongodb://localhost:27017/incidentreport # JWT JWT_SECRET=your-super-secret-jwt-key-change-this-in-production # Server PORT=5000 NODE_ENV=development # CORS ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000 # Cloudinary (for file uploads) CLOUDINARY_CLOUD_NAME=your-cloud-name CLOUDINARY_API_KEY=your-api-key CLOUDINARY_API_SECRET=your-api-secret # Email (required for OTP functionality) GMAIL_USER=your-email@gmail.com GMAIL_APP_PASSWORD=your-gmail-app-password # Alternative email service (optional) EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USER=your-email@gmail.com EMAIL_PASS=your-app-password RESEND_API_KEY=your-resend-key
Frontend (
client/.env):VITE_API_URL=http://localhost:5000
-
Create Admin User (Optional)
cd backend node createAdmin.js -
Start Development Servers
Terminal 1 - Backend:
cd backend npm startBackend runs on
http://localhost:5000API Docs available athttp://localhost:5000/api-docsTerminal 2 - Frontend:
cd client npm run devFrontend runs on
http://localhost:5173 -
Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
- API Documentation: http://localhost:5000/api-docs
incidentreport/
โโโ client/ # React + TypeScript Frontend
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โ โโโ agent/ # Agent-specific components
โ โ โ โโโ auth/ # Authentication components
โ โ โ โโโ ui/ # Base UI components (Radix UI)
โ โ โ โโโ ...
โ โ โโโ pages/ # Page components
โ โ โ โโโ admin/ # Admin dashboard pages
โ โ โ โโโ agent/ # Agent dashboard pages
โ โ โ โโโ customer/ # Customer portal pages
โ โ โ โโโ supervisor/# Supervisor pages
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ store/ # Zustand state management
โ โ โโโ routes/ # React Router configuration
โ โ โโโ utils/ # Utility functions
โ โ โโโ ...
โ โโโ public/ # Static assets
โ โโโ package.json
โ
โโโ backend/ # Node.js + Express Backend
โ โโโ config/ # Configuration files
โ โ โโโ db.js # MongoDB connection
โ โ โโโ cloudinary.js # Cloudinary setup
โ โโโ controllers/ # Route controllers
โ โโโ models/ # Mongoose models
โ โโโ routes/ # Express routes
โ โโโ middleware/ # Custom middleware
โ โโโ utils/ # Utility functions
โ โโโ server.js # Entry point
โ โโโ swagger.js # API documentation
โ
โโโ README.md
The backend includes comprehensive Swagger/OpenAPI documentation. Once the server is running, visit:
http://localhost:5000/api-docs
User login/register (Customer/Agent/Admin)
POST /api/auth/login- Login user (Customer/Agent/Admin)POST /api/auth/admin/create- Register new Admin
Account Registration with OTP:
POST /api/auth/register/request-otp- Request OTP for account registration (sends 6-digit OTP to email)POST /api/auth/register/verify-otp- Verify OTP for registration (validates email and OTP)POST /api/auth/register- Complete customer registration (after OTP verification)
Password Reset with OTP:
POST /api/auth/forgot-password- Request password reset OTP (sends 6-digit OTP to email)POST /api/auth/forgot-password/verify-otp- Verify password reset OTP (validates email and OTP)POST /api/auth/reset-password- Reset password (after OTP verification)
Password Change (Authenticated):
POST /api/auth/change-password/request-otp- Request OTP for password change (requires authentication)POST /api/auth/change-password- Change password with OTP (requires authentication)
Support cases/tickets management
POST /api/cases- Create new case (Customer only)GET /api/cases- Get all cases (Admin only)GET /api/cases/my- Get my cases (Customer/Agent)PATCH /api/cases/{caseId}/accept- Accept case (Agent only)PATCH /api/cases/{caseId}/status- Update case status (Agent only)PATCH /api/cases/assign- Assign case to agent (Admin only)
Chat history & unread counts
GET /api/chat/history- Get chat history (Customer/Agent)GET /api/chat/case/{caseId}- Get case chat (Customer/Agent)- Note: Real-time messaging is handled via Socket.io (preferred method)
HTTP fallback for messages (real-time via Socket.IO)
GET /api/messages/case/{caseId}- Get messages for case (fallback)
Profile management & agent creation (Admin/Supervisor only)
GET /api/users/profile- Get current user profilePATCH /api/users/profile- Update user profilePOST /api/users/agents- Create new agent (Admin/Supervisor only)GET /api/users/agents- Get all agents (Admin/Supervisor only)
Admin-only endpoints
GET /api/admin/dashboard- Get admin dashboard statsGET /api/admin/users- Get all users (Admin only)GET /api/admin/cases- Get all cases (Admin only)DELETE /api/admin/users/{userId}- Delete user (Admin only)
Note: Additional admin endpoints like
/api/admin/performancemay be available but are not documented in the Swagger API.
User-specific notifications and status updates
GET /api/notifications- Get a list of the user's notificationsGET /api/notifications/unread-count- Get the total count of unread notifications for the userPATCH /api/notifications/{id}/read- Mark a specific notification as readPATCH /api/notifications/mark-all-read- Mark all unread notifications for the current user as readDELETE /api/notifications/{id}- Delete a specific notification by IDDELETE /api/notifications/clear-read- Delete all notifications that have been read by the current user
POST /upload- Upload an image to Cloudinary
- Leaflet Maps Integration - Interactive maps for real-time visualization
- Browser Geolocation API - Users grant permission before location sharing
- Live Updates - Location updates pushed in real time to agents and admins
- Role-Based Visibility - Only authorized agents and admins can access tracking data
Experience the full Incident Report platform with real-time features, role-based dashboards, and comprehensive case management.
The welcoming landing page that introduces visitors to the Incident Report platform.
- User profile management
- Personal information updates
- Choose the appropriate department for your incident
- Multiple specialized departments available
- View all your submitted cases
- Track case status and progress
- Monitor resolution timeline
- Mobile-optimized case management interface
- Responsive design for on-the-go access
- Touch-friendly navigation
- Direct communication with assigned agents
- Real-time messaging via Socket.io
- File and image sharing support
- Mobile-optimized chat interface
- Overview of assigned cases
- Quick access to pending, active, and resolved cases
- Performance metrics and statistics
- Manage all assigned incidents
- Filter by status (pending, active, resolved)
- Quick case details and actions
- Real-time communication with customers
- Multi-case chat management
- File sharing and media support
- Instant message delivery
- Profile configuration
- Account settings and preferences
- Comprehensive analytics and statistics
- System-wide overview
- Key performance indicators
- Manage all users (customers, agents, supervisors)
- Create new agents and admins
- User role assignment and permissions
- View all cases across the system
- Assign cases to agents
- Monitor case resolution rates
- Department-wise case distribution
- Real-time user location visualization using Leaflet
- Accessible to agents and admins on the tracking page
Backend:
npm start # Start development server with nodemonFrontend:
npm run dev # Start Vite dev server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- Frontend: TypeScript with strict mode enabled
- Backend: ES6+ JavaScript
- Linting: ESLint with TypeScript support
- Formatting: Prettier (recommended)
- Environment Variables: Set all required env vars in your hosting platform
- Database: Use MongoDB Atlas for production
- Recommended Platforms:
- Render
- Railway
- Heroku
- AWS EC2
- DigitalOcean
-
Build the project:
cd client npm run build -
Deploy the
distfolder to:- Vercel (recommended)
- Netlify
- AWS S3 + CloudFront
- GitHub Pages
Make sure to update:
ALLOWED_ORIGINSwith your production frontend URLMONGODB_URIwith your production databaseJWT_SECRETwith a strong, random secretCLOUDINARY_*with your production Cloudinary credentials
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass
This project is licensed under the MIT License - see the LICENSE file for details.
- React - The UI library
- Express.js - The web framework
- Socket.io - Real-time communication
- MongoDB - The database
- Tailwind CSS - The CSS framework
- Radix UI - Accessible component primitives
- Vite - The build tool
- Issues: GitHub Issues
- Discussions: GitHub Discussions
If you find this project helpful, please consider giving it a โญ on GitHub! It helps others discover the project and motivates continued development.
Built with โค๏ธ by Dalhat Dalhat falalu










