A comprehensive emergency services application with real-time location tracking, emergency contacts management, dynamic emergency service discovery, and a powerful admin dashboard system.
- OTP-based Registration - Secure email verification during signup
- JWT Authentication - Token-based secure authentication
- Password Reset - OTP-based password recovery system
- Protected Routes - Secure access to user-specific features
- Admin Authentication - Separate admin login with OTP verification
- Admin Registration - OTP-based admin signup with email verification
- Comprehensive Dashboard - Overview, users, alerts, analytics, and system health
- User Management - View, activate/deactivate users with reasons
- Alert Management - Monitor and update emergency alert statuses
- Analytics & Charts - Visual data representation with Chart.js
- System Health Monitoring - Real-time system status and performance metrics
- Data Export - CSV export functionality for reports
- Multi-language Support - English, Arabic, and Hindi
- Dynamic Language Switching - Collapsible language tray with flags
- Translated UI Elements - All major pages and components translated
- RTL Support - Right-to-left layout for Arabic
- Seamless Language Toggle - Instant language switching without page reload
- Real-time GPS Tracking - Automatic user location detection
- Emergency Services Map - Interactive map with nearby emergency services
- POI Integration - Dynamic discovery of emergency services via OpenStreetMap
- Distance Calculation - Real-time distance to emergency services
- Add/Remove Contacts - Manage emergency contact list
- Contact Validation - Email-based contact verification
- Dashboard Statistics - Track contact count and alert history
- Inline Contact Form - Seamless contact addition with validation
- One-Click Alert - Send emergency alerts to all contacts
- Location Sharing - Automatically include user's current location
- Email Notifications - Instant email alerts to emergency contacts
- Alert History - Track all sent emergency alerts
- Alert Status Management - Active, resolved, and false alarm statuses
- Seeded Data - 16 verified emergency services in Qatar
- POI Search - Dynamic discovery via OverstreetMap API
- Service Categories - Police, Fire, Hospital, Poison Control
- Interactive Map - Click to call emergency services
- Color-coded Cards - Detailed service information with quick actions
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcryptjs - Password hashing
- Nodemailer - Email services
- CORS - Cross-origin resource sharing
- React - UI framework
- React Router - Client-side routing
- React Leaflet - Interactive maps
- Axios - HTTP client
- Tailwind CSS - Styling
- React Hot Toast - Notifications
- React i18next - Internationalization
- Chart.js - Data visualization
- React Chart.js - Chart.js React wrapper
- OpenStreetMap - Base map tiles
- Overpass API - POI data for emergency services
- Geolocation API - User location detection
SafeStep/
βββ backend/
β βββ controllers/
β β βββ adminController.js # Admin dashboard logic
β β βββ authController.js # Authentication logic
β β βββ emergencyAlertController.js # Alert management
β β βββ emergencyContactController.js # Contact management
β β βββ emergencyServiceController.js # Services API
β β βββ userController.js # User management
β βββ middleware/
β β βββ adminAuth.js # Admin authentication
β β βββ auth.js # JWT authentication
β βββ models/
β β βββ Admin.js # Admin schema
β β βββ EmergencyAlert.js # Alert schema
β β βββ EmergencyContact.js # Contact schema
β β βββ EmergencyService.js # Service schema
β β βββ Otp.js # OTP schema
β β βββ User.js # User schema
β βββ routes/
β β βββ admin.js # Admin endpoints
β β βββ auth.js # Auth endpoints
β β βββ emergencyAlerts.js # Alert endpoints
β β βββ emergencyContacts.js # Contact endpoints
β β βββ emergencyServices.js # Service endpoints
β β βββ user.js # User endpoints
β βββ utils/
β β βββ emergencyMailer.js # Emergency email service
β β βββ generateOtp.js # OTP generation
β β βββ mailer.js # Email service
β β βββ userConfirmationMailer.js # User confirmation emails
β βββ seedEmergencyServices.js # Database seeding
β βββ server.js # Main server file
β βββ package.json
βββ frontend/
β βββ public/
β β βββ locales/ # Translation files
β β β βββ en/ # English translations
β β β βββ ar/ # Arabic translations
β β β βββ hi/ # Hindi translations
β β βββ ...
β βββ src/
β β βββ components/
β β β βββ EmergencyServicesMap.jsx # Interactive map
β β β βββ ProtectedRoute.jsx # Route protection
β β βββ context/
β β β βββ AuthContext.jsx # Authentication context
β β βββ pages/
β β β βββ AdminDashboard.jsx # Admin dashboard
β β β βββ AdminLogin.jsx # Admin login
β β β βββ AdminSignup.jsx # Admin signup
β β β βββ ChangePassword.jsx # Password reset
β β β βββ Dashboard.jsx # Main dashboard
β β β βββ Landing.jsx # Landing page
β β β βββ Login.jsx # Login page
β β β βββ Register.jsx # Registration page
β β βββ services/
β β β βββ api.js # API configuration
β β βββ i18n/
β β β βββ i18n.js # i18n configuration
β β βββ App.jsx # Main app component
β β βββ main.jsx # App entry point
β βββ package.json
βββ README.md
- Node.js (v14 or higher)
- MongoDB
- Gmail account (for email services)
- Clone and navigate to backend
cd backend- Install dependencies
npm install- Environment Configuration
Create a
.envfile in the backend directory:
MONGODB_URI=mongodb://localhost:27017/safestep
JWT_SECRET=your_jwt_secret_here
EMAIL_USER=your_gmail@gmail.com
EMAIL_PASS=your_gmail_app_password- Seed the database
npm run seed- Start the server
npm start- Navigate to frontend
cd frontend- Install dependencies
npm install- Start the development server
npm run devEmail Input β OTP Verification β Account Creation β Dashboard Access
Admin Signup β OTP to paul2744walker@gmail.com β Verification β Admin Dashboard Access
Add Contact β Email Validation β Contact Saved β Dashboard Update
User Location β Alert Button β Email Notifications β Alert History β Admin Review
User Location β Map Display β POI Search β Service Information
Language Tray β Flag Selection β Instant UI Translation β RTL Support (Arabic)
POST /api/auth/register- Direct user registrationPOST /api/auth/login- User loginPOST /api/auth/send-otp- Send registration OTPPOST /api/auth/verify-otp- Verify registration OTPPOST /api/auth/send-reset-password-otp- Send password reset OTPPOST /api/auth/verify-reset-password-otp- Verify password reset OTPPOST /api/auth/reset-password- Reset password
POST /api/admin/send-otp- Send admin signup OTPPOST /api/admin/verify-otp- Verify admin signup OTPPOST /api/admin/login- Admin loginGET /api/admin/stats- Get dashboard statisticsGET /api/admin/users- Get all users with paginationGET /api/admin/alerts- Get all alerts with paginationPATCH /api/admin/users/:id/status- Update user statusPATCH /api/admin/alerts/:id/status- Update alert statusGET /api/admin/analytics- Get analytics dataGET /api/admin/system-health- Get system health metricsGET /api/admin/export- Export data as CSV
GET /api/user/dashboard-stats- Get user statistics
GET /api/emergency-contacts- Get user's contactsPOST /api/emergency-contacts- Add new contactDELETE /api/emergency-contacts/:id- Remove contact
POST /api/emergency-alerts- Send emergency alert
GET /api/emergency-services/nearby- Get nearby services
- 5 Police Stations - Doha Central, West Bay, Al Wakrah, Al Sadd, Al Khor
- 4 Fire Stations - Doha Central, Hamad Airport, Al Wakrah, Al Khor
- 6 Hospitals - Hamad General, Al Wakra, Al Khor, Sidra Medicine, Al Ahli, Al Emadi
- 1 Poison Control Center - Qatar Poison Control Center
- Dynamic Discovery - Real-time emergency service search
- OpenStreetMap Data - Comprehensive global coverage
- Automatic Updates - Always current information
- Multiple Categories - Police, Fire, Hospital, Specialized Services
- Real-time Statistics - Total users, alerts, active alerts, resolved alerts
- Quick Actions - Direct access to user and alert management
- System Status - Live monitoring of application health
- Recent Activity - Latest user registrations and alert activities
- User List - Comprehensive user database with search and pagination
- User Details - Complete user information including registration date
- Status Control - Activate/deactivate users with reason tracking
- Deactivation History - Track when and why users were deactivated
- Bulk Operations - Manage multiple users efficiently
- Alert Monitoring - Real-time emergency alert tracking
- Status Updates - Mark alerts as resolved or false alarms
- Alert Details - Complete alert information with user and location data
- Filtering Options - Filter by status, date range, and user
- Admin Notes - Add notes and comments to alerts
- Chart.js Integration - Interactive charts and graphs
- Alert Trends - Time-based alert analysis
- User Analytics - Registration and activity patterns
- Status Distribution - Visual breakdown of alert statuses
- Hourly Analysis - Peak usage time identification
- Period Selection - Customizable date ranges for analysis
- Performance Metrics - Response times and system load
- Database Status - Connection health and query performance
- Memory Usage - System resource monitoring
- Error Tracking - Application error monitoring
- Uptime Monitoring - System availability tracking
- CSV Export - Download user and alert data
- Filtered Exports - Export specific data subsets
- Report Generation - Automated report creation
- Data Backup - Regular data export capabilities
- English (en) - Primary language with complete translations
- Arabic (ar) - Full RTL support with Arabic translations
- Hindi (hi) - Complete Hindi language support
- Dynamic Language Switching - Instant language changes
- Collapsible Language Tray - Elegant language selector with flags
- RTL Layout Support - Proper right-to-left layout for Arabic
- Contextual Translations - Context-aware translation system
- Fallback System - Graceful fallback to English for missing translations
- Authentication Pages - Login, register, password reset
- Dashboard Elements - All dashboard text and labels
- Emergency Services - Service names and descriptions
- Navigation - Menu items and navigation text
- Notifications - Toast messages and alerts
- Forms - Input labels, placeholders, and validation messages
- Flag Icons - Visual language identification
- Smooth Animations - Elegant expand/collapse transitions
- Fixed Positioning - Always accessible language switcher
- Responsive Design - Works on all screen sizes
- JWT Token Authentication - Secure session management
- Password Hashing - bcrypt encryption
- OTP Verification - Email-based security
- Protected Routes - Role-based access control
- Input Validation - Server-side data validation
- CORS Protection - Cross-origin security
- Registration OTP - Account verification
- Password Reset OTP - Password recovery
- Emergency Alerts - Contact notifications
- User Confirmations - Account status updates
- Gmail SMTP - Reliable email delivery
- App Passwords - Secure authentication
- HTML Templates - Professional formatting
- Error Handling - Graceful failure management
- Responsive Layout - Mobile-first design
- Gradient Backgrounds - Modern visual appeal
- Interactive Maps - Real-time location services
- Toast Notifications - User feedback
- Loading States - Smooth user experience
- Intuitive Navigation - Easy-to-use interface
- Real-time Updates - Live data synchronization
- Error Handling - User-friendly error messages
- Accessibility - Inclusive design principles
- Set up MongoDB Atlas or local MongoDB
- Configure environment variables
- Deploy to Heroku, Vercel, or AWS
- Set up email service credentials
- Build the production version
- Deploy to Netlify, Vercel, or AWS S3
- Configure API endpoint URLs
- Set up custom domain (optional)
# Database
MONGODB_URI=mongodb://localhost:27017/safestep
# Authentication
JWT_SECRET=your_secure_jwt_secret
# Email Service
EMAIL_USER=your_gmail@gmail.com
EMAIL_PASS=your_gmail_app_password
# Server
PORT=5000
NODE_ENV=developmentThe frontend uses a centralized API configuration in src/services/api.js:
- Base URL configuration
- Endpoint management
- Authentication headers
- Error handling
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenStreetMap - Map data and POI information
- React Leaflet - Interactive map components
- Tailwind CSS - Utility-first CSS framework
- MongoDB - Database solution
- Node.js Community - Backend framework and tools
For support and questions:
- Create an issue in the repository
- Check the documentation
Built with β€οΈ by @fowzan2744 for emergency safety and community protection