How prabhatbhatiaa/yatrashield works
YatraShield is a role-based incident reporting and response platform. Tourists submit incidents (including SOS), then track updates; responders work assigned incidents, while supervisors/admins review queues, assign responders, and advance statuses. The backend persists users/incidents, computes priority, emits Socket.IO notifications, and periodically escalates overdue work. The frontend provides role-specific dashboards, geolocation/maps, authentication, and safety information. Edges reflect README contracts and shown imports/calls; unsampled paths and runtime wiring are represented conservatively.
Main entry points: App.jsx App routing · server.js API server · incident.controller.js Incident operations · useIncidents.js Incident feed
Components 27
Web experience
- App routing
frontend/src/App.jsx - Auth screens
frontend/src/pages/Login.jsx - Report and SOS
frontend/src/pages/ReportIncident.jsx - Tourist dashboard
frontend/src/pages/TouristDashboard.jsx - Authority dashboard
frontend/src/pages/AuthorityDashboard.jsx - Incident detail
frontend/src/pages/IncidentDetail.jsx - Safety information
frontend/src/pages/SafetyInfo.jsx - Incident maps
frontend/src/components/MapView.jsx
Client services
- Session state
frontend/src/context/AuthContext.jsx - HTTP client
frontend/src/api/api.js - Incident feed
frontend/src/hooks/useIncidents.js - Live socket
frontend/src/api/socket.js
Backend API
- API server
backend/server.js - Auth routes
backend/routes/auth.routes.js - Incident routes
backend/routes/incident.routes.js - User routes
backend/routes/user.routes.js - Authentication
backend/controllers/auth.controller.js - User operations
backend/controllers/user.controller.js
Incident domain
- Incident operations
backend/controllers/incident.controller.js - Priority engine
backend/utils/priorityEngine.js - Overdue escalation
backend/services/escalationService.js - Incident records
backend/models/incident.js - User records
backend/models/user.js
Runtime services
- Mongo connection
backend/config/db.js - Socket.IO service
backend/server.js
Other components
- Platform user
- MongoDB
Connections 39
- Platform user → App routing: uses
frontend/src/App.jsx - App routing → Auth screens: routes to
frontend/src/App.jsx - App routing → Tourist dashboard: routes to
frontend/src/App.jsx - App routing → Report and SOS: routes to
frontend/src/App.jsx - App routing → Authority dashboard: routes to
frontend/src/App.jsx - App routing → Incident detail: routes to
frontend/src/App.jsx - App routing → Safety information: routes to
frontend/src/App.jsx - Platform user → Auth screens: signs in
- Auth screens → Session state: updates session
frontend/src/context/AuthContext.jsx - Session state → HTTP client: calls auth API
frontend/src/context/AuthContext.jsx - Report and SOS → HTTP client: creates incident
- Tourist dashboard → Incident feed: loads incidents
frontend/src/pages/TouristDashboard.jsx - Authority dashboard → Incident feed: loads incidents
frontend/src/pages/AuthorityDashboard.jsx - Authority dashboard → HTTP client: assigns responders
frontend/src/pages/AuthorityDashboard.jsx - Incident detail → Incident feed: loads incident
frontend/src/pages/IncidentDetail.jsx - Incident feed → HTTP client: fetches incidents
frontend/src/hooks/useIncidents.js - Incident feed → Live socket: subscribes events
frontend/src/hooks/useIncidents.js - Tourist dashboard → Incident maps: renders locations
frontend/src/pages/TouristDashboard.jsx - Authority dashboard → Incident maps: renders queue map
frontend/src/pages/AuthorityDashboard.jsx - HTTP client → API server: HTTP requests
- Live socket → Socket.IO service: connects events
- API server → Auth routes: mounts routes
backend/server.js - API server → Incident routes: mounts routes
backend/server.js - API server → User routes: mounts routes
backend/server.js - Auth routes → Authentication: dispatches
backend/routes/auth.routes.js - Incident routes → Incident operations: dispatches
backend/routes/incident.routes.js - User routes → User operations: dispatches
backend/routes/user.routes.js - Incident operations → Priority engine: computes priority
backend/controllers/incident.controller.js - Incident operations → Incident records: reads and writes
backend/controllers/incident.controller.js - Incident operations → User records: looks up responders
backend/controllers/incident.controller.js - Authentication → User records: reads and writes
backend/controllers/auth.controller.js - User operations → User records: reads users
backend/controllers/user.controller.js - API server → Overdue escalation: checks overdue
backend/server.js - Overdue escalation → Incident records: updates incidents
backend/services/escalationService.js - Overdue escalation → User records: reads responders
backend/services/escalationService.js - Mongo connection → MongoDB: connects
- API server → Mongo connection: starts connection
backend/server.js - API server → Socket.IO service: hosts sockets
backend/server.js - Incident operations → Socket.IO service: emits updates
backend/controllers/incident.controller.js