When disaster strikes, seconds matter. This system broadcasts geo-tagged alerts to all connected users in real time — showing affected radius, safe zones, evacuation routes, and step-by-step safety instructions on an interactive map.
|
🗺️ Interactive Map
|
⚡ Real-Time Updates
|
|
🌪️ Disaster Types
|
🛡️ Safety Tools
|
| Live Map View | Alert Details |
|---|---|
![]() |
![]() |
git clone https://github.com/aasimansari1/disaster-alert-system.git
cd disaster-alert-system
# Backend
cd server
cp .env.example .env # add MONGO_URI and JWT_SECRET
npm install
npm start # → http://localhost:5000
# Frontend (new terminal)
cd ../client
npm install
npm start # → http://localhost:3000# server/.env
MONGO_URI=mongodb://localhost:27017/disaster-alerts
JWT_SECRET=your-secret-key
PORT=5000
NODE_ENV=development
# Optional — email notifications on critical alerts
MAIL_HOST=smtp.gmail.com
MAIL_USER=your@gmail.com
MAIL_PASS=your-app-password Browser A Browser B Browser C
│ │ │
└──────────────┬──────────────────────────────────┘
│ Socket.IO (real-time)
▼
┌─────────────────┐
│ Node.js / │
│ Express │
│ Socket.IO │
└────────┬────────┘
│
▼
┌─────────────────┐
│ MongoDB │
│ (alerts, users,│
│ safe zones) │
└─────────────────┘
New alert posted → Socket.IO broadcasts to ALL connected clients instantly
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register user |
| POST | /api/auth/login |
Login, returns JWT |
| GET | /api/alerts |
Get all active alerts |
| POST | /api/alerts |
Create new alert (auth required) |
| GET | /api/alerts/:id |
Get alert details |
| PATCH | /api/alerts/:id |
Update alert status |
| GET | /api/alerts/nearby |
Alerts within radius of coords |
disaster-alert-system/
├── client/ # React frontend
│ └── src/
│ ├── components/
│ │ ├── Map/ # React Leaflet map + markers
│ │ ├── Alerts/ # Alert list, detail, filters
│ │ ├── Charts/ # Chart.js disaster analytics
│ │ └── Layout/ # Navbar, sidebar
│ ├── context/ # Auth, Socket context
│ ├── hooks/ # useAlerts, useSocket, useLocation
│ ├── pages/ # Dashboard, Map, Alerts, Login
│ └── services/ # Axios API client
└── server/
├── config/ # MongoDB connection
├── controllers/ # Alert, auth, user logic
├── middleware/ # JWT auth, rate limiting, helmet
├── models/ # Alert (geo + severity), User
├── routes/ # alerts, auth, users
├── socket/ # Socket.IO event handlers
└── index.js # Entry point
| Layer | Technology |
|---|---|
| Frontend | React 18, React Leaflet, Chart.js, Framer Motion |
| Real-Time | Socket.IO (client + server) |
| Backend | Node.js, Express.js |
| Database | MongoDB, Mongoose (GeoJSON 2dsphere index) |
| Auth | JWT, bcryptjs |
| Security | Helmet, express-rate-limit, express-validator |
| Notifications | Nodemailer (email alerts) |
- Push notifications (PWA / Firebase)
- SMS alerts via Twilio
- Government API integration for verified alerts
- Offline mode (service worker)
- Multi-language support
git checkout -b feature/your-feature
git commit -m 'Add your feature'
git push origin feature/your-featureMIT © Mohd Aasim Ansari
Built to keep people safe. If this is useful to you, please ⭐ star the repo!

