FlashAid is a comprehensive emergency medical assistance application built using the MERN stack (MongoDB, Express.js, React.js, Node.js). The app connects people in medical emergencies with nearby volunteers and provides AI-powered first aid instructions.
- SOS Emergency Button: One-click emergency request with automatic location detection
- AI-Powered First Aid: Real-time first aid instructions via ChatGPT API integration
- Volunteer Network: Connect with certified medical volunteers in your area
- Real-time Notifications: Instant alerts to volunteers via Socket.IO
- Location-based Matching: Automatic matching of emergency requests with nearby volunteers
- Dual User Types: Regular users and medical volunteers
- Comprehensive Profiles: Medical information, emergency contacts, certifications
- Role-based Access: Different dashboards for users and volunteers
- Secure Authentication: JWT-based authentication with password encryption
- First Aid Knowledge Base: Searchable medical emergency procedures
- Medical Profile Management: Blood type, allergies, medications, conditions
- Emergency Contact System: Automatic notification of family/friends
- Medical Certification Tracking: Volunteer qualifications and certifications
- Volunteer Leaderboard: Recognition system for top helpers
- Response Time Tracking: Performance metrics for volunteers
- Success Rate Monitoring: Completion statistics and ratings
- Points & Badges System: Gamified volunteer engagement
flashaid-backend/
├── server.js # Main server file with Socket.IO
├── package.json # Dependencies and scripts
├── .env.example # Environment variables template
└── src/
├── models/ # MongoDB schemas
│ ├── User.js # User model with medical info
│ ├── EmergencyRequest.js # Emergency request model
│ ├── FirstAidGuide.js # First aid guides model
│ └── Leaderboard.js # Volunteer rankings model
├── routes/ # API endpoints
│ ├── auth.js # Authentication routes
│ ├── emergency.js # Emergency handling routes
│ ├── users.js # User management routes
│ ├── volunteers.js # Volunteer-specific routes
│ ├── firstAid.js # First aid guides routes
│ └── leaderboard.js # Leaderboard routes
├── middleware/ # Custom middleware
│ ├── auth.js # JWT authentication
│ ├── validation.js # Request validation
│ └── errorHandler.js # Error handling
└── utils/ # Utility functions
├── openai.js # ChatGPT integration
├── notifications.js # Notification system
└── validation.js # Data validation helpers
flashaid-frontend/
├── package.json # Dependencies and scripts
├── .env.example # Environment variables template
├── public/ # Static assets
└── src/
├── App.js # Main app component with routing
├── index.js # Entry point
├── components/ # Reusable UI components
│ ├── Navbar/ # Navigation component
│ └── UI/ # UI elements (buttons, spinners, etc.)
├── pages/ # Page components
│ ├── HomePage.js # Landing page with features
│ ├── SOSPage.js # Emergency request interface
│ ├── LoginPage.js # User authentication
│ ├── RegisterPage.js # User registration
│ ├── DashboardPage.js # User dashboard
│ ├── ProfilePage.js # Profile management
│ ├── FirstAidPage.js # First aid guides browser
│ ├── FirstAidGuidePage.js # Individual guide viewer
│ ├── VolunteerDashboard.js # Volunteer interface
│ ├── LeaderboardPage.js # Volunteer rankings
│ └── EmergencyRequestPage.js # Emergency details
├── context/ # React context for state management
│ └── AuthContext.js # Authentication state
├── services/ # API and external services
│ ├── api.js # Backend API calls
│ └── socket.js # Socket.IO client
├── hooks/ # Custom React hooks
├── utils/ # Utility functions
└── styles/ # Global styles
- Node.js (v18+ recommended)
- MongoDB (local or cloud instance)
- OpenAI API key (for first aid instructions)
-
Clone and navigate to backend:
cd flashaid-backend -
Install dependencies:
npm install
-
Environment Configuration:
cp .env.example .env
Configure the following variables in
.env:PORT=5001 MONGODB_URI=mongodb://localhost:27017/flashaid JWT_SECRET=your_super_secret_jwt_key_here JWT_EXPIRE=7d OPENAI_API_KEY=your_openai_api_key_here NODE_ENV=development
-
Start the backend server:
npm start # Server will run on http://localhost:5001
-
Navigate to frontend:
cd flashaid-frontend -
Install dependencies:
npm install
-
Environment Configuration:
cp .env.example .env
Configure the following variables in
.env:REACT_APP_API_URL=http://localhost:5001 REACT_APP_SOCKET_URL=http://localhost:5001
-
Start the frontend server:
npm start # Application will open at http://localhost:3000
-
Start MongoDB:
# If using local MongoDB mongod # Or use MongoDB Atlas cloud service
-
Database will be automatically created when the backend starts
-
Registration/Login:
- Create account with personal and medical information
- Add emergency contacts and medical details
- Set up blood type, allergies, medications
-
Emergency Request:
- Click the SOS button on dashboard or dedicated SOS page
- Location is automatically detected
- Describe the emergency situation
- Receive immediate AI-powered first aid instructions
- Volunteers are automatically notified
-
Dashboard Features:
- View emergency history
- Access first aid guides
- Manage profile and medical information
- Track response times and outcomes
-
Volunteer Registration:
- Sign up with medical certifications
- Specify areas of expertise
- Set availability status
-
Responding to Emergencies:
- Receive real-time notifications
- View emergency details and patient information
- Respond to emergencies in your area
- Mark requests as resolved
-
Volunteer Dashboard:
- Monitor active emergency requests
- Track response history and performance
- Toggle availability status
- View leaderboard rankings
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profile
POST /api/emergency/create- Create emergency requestGET /api/emergency/:id- Get emergency detailsPOST /api/emergency/:id/respond- Volunteer responsePUT /api/emergency/:id/complete- Mark as resolved
GET /api/first-aid- Get all first aid guidesGET /api/first-aid/:id- Get specific guideGET /api/first-aid/categories- Get guide categoriesPOST /api/first-aid/search- Search guides
GET /api/volunteers/requests- Get volunteer requestsPOST /api/volunteers/toggle-availability- Toggle statusGET /api/volunteers/stats- Get volunteer statistics
GET /api/leaderboard- Get volunteer rankingsGET /api/leaderboard/stats- Get leaderboard statistics
newEmergencyRequest- New emergency broadcast to volunteersvolunteerResponse- Volunteer accepts emergencyemergencyUpdate- Status updates for emergencyconnectionStatus- User connection status
volunteers- All active volunteersemergency_{id}- Specific emergency participants
- JWT Authentication: Secure token-based authentication
- Password Encryption: bcrypt hashing for user passwords
- Input Validation: Express-validator for request validation
- CORS Protection: Configured cross-origin resource sharing
- Rate Limiting: API rate limiting to prevent abuse
- Environment Variables: Sensitive data in environment files
cd flashaid-backend
npm testcd flashaid-frontend
npm testThe application is fully responsive and works seamlessly on:
- Desktop computers
- Tablets
- Mobile phones
- Progressive Web App (PWA) capabilities
- Video Call Integration: Direct video consultation with volunteers
- Offline Mode: Basic first aid guides available offline
- Multi-language Support: Internationalization for global use
- Telemedicine Integration: Connect with professional medical services
- Medical History Tracking: Comprehensive health record management
- Insurance Integration: Connect with health insurance providers
- Microservices Architecture: Scale individual components
- Redis Caching: Improve performance with caching layer
- Push Notifications: Mobile app with push notification support
- Machine Learning: Predictive analytics for emergency response
- Blockchain Integration: Secure medical record management
- 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 - see the LICENSE file for details.
For support, please contact:
- Email: support@flashaid.com
- GitHub Issues: Create an issue
- Documentation: Wiki
- OpenAI for GPT API integration
- Socket.IO for real-time communication
- MongoDB for flexible data storage
- React community for amazing UI components
- Medical professionals who provided guidance on first aid procedures