How hemachandhar-a/snuc_quickq works
Hostel Mess Hub is a role-based, real-time queue intelligence platform. Staff and simulated or optional video sensors provide operational inputs; the backend models queue state, wait forecasts, incidents, fairness and sustainability, then exposes REST analytics and live events. Students see queue, alerts and sustainability information; staff monitor and manage operations; administrators review forecasts, heatmaps, audits and KPIs. The README documents major capabilities not all shown in sampled source; those are represented at their documented subsystem paths. Some unsampled wiring is therefore left unasserted or dashed.
Main entry points: index.js HTTP and socket server · socketHandler.js Live event delivery · intelligenceEngine.js Queue intelligence · router.jsx Role routing
Components 26
Role-based web app
- Student views
frontend/src/pages/Student - Staff console
frontend/src/pages/Staff - Admin analytics
frontend/src/pages/Admin - Login and roles
frontend/src/pages/Login/LoginPage.jsx - Auth state
frontend/src/store/authStore.js - Live state
frontend/src/store/realtimeStore.js - REST client
frontend/src/api/client.js - Socket client
frontend/src/api/socket.js - Role routing
frontend/src/router.jsx
Backend API
- HTTP and socket server
backend/src/index.js - Authentication API
backend/src/routes/auth.js - System API
backend/src/routes/system.js - Staff operations API
backend/src/routes/staff.js - AI endpoints
backend/src/routes/ai.js - Analytics API
backend/src/routes/analytics.js
Queue operations
- Queue intelligence
backend/src/services/intelligenceEngine.js - Simulation sensors
backend/src/services/simulatedSensors.js - Video detection
backend/src/services/detectionService.js - YOLO detector
backend/python/yolo_detect.py - Operational events
backend/src/services/eventBus.js - Live event delivery
backend/src/socket/socketHandler.js
Intelligence and analytics
- Rule-based predictions
backend/src/services/mlPlaceholder.js - Sustainability simulation
backend/src/services/sustainabilitySim.js - In-memory analytics
backend/src/store/analyticsStore.js
State and detection
- SQLite state and feeds
backend/src/db/index.js
Other components
- Student, staff, admin
Connections 42
- Student, staff, admin → Role routing: opens app
frontend/src/router.jsx - Role routing → Login and roles: routes to
frontend/src/router.jsx - Role routing → Student views: routes to
frontend/src/router.jsx - Role routing → Staff console: routes to
frontend/src/router.jsx - Role routing → Admin analytics: routes to
frontend/src/router.jsx - Login and roles → Auth state: sets credentials
frontend/src/store/authStore.js - Login and roles → REST client: calls login
frontend/src/pages/Login/LoginPage.jsx - Student views → REST client: requests data
frontend/src/pages/Student/Home/StudentHome.jsx - Staff console → REST client: requests operations
frontend/src/pages/Staff/Dashboard/StaffDashboard.jsx - Admin analytics → REST client: requests analytics
frontend/src/pages/Admin/Overview/AdminOverview.jsx - HTTP and socket server → Authentication API: mounts route
backend/src/index.js - HTTP and socket server → System API: mounts route
backend/src/index.js - HTTP and socket server → Staff operations API: mounts route
backend/src/index.js - HTTP and socket server → AI endpoints: mounts route
backend/src/index.js - HTTP and socket server → Analytics API: mounts route
backend/src/index.js - HTTP and socket server → Live event delivery: attaches handlers
backend/src/index.js - HTTP and socket server → Simulation sensors: starts simulation
backend/src/index.js - HTTP and socket server → Video detection: starts detection
backend/src/index.js - Staff operations API → Queue intelligence: manages incidents
backend/src/routes/staff.js - Staff operations API → SQLite state and feeds: reads and writes
backend/src/routes/staff.js - Staff operations API → In-memory analytics: reads analytics
backend/src/routes/staff.js - System API → Queue intelligence: reads status
backend/src/routes/system.js - AI endpoints → Rule-based predictions: delegates predictions
backend/src/routes/ai.js - Analytics API → In-memory analytics: serves analytics
- Simulation sensors → Queue intelligence: updates queue
backend/src/services/simulatedSensors.js - Queue intelligence → Rule-based predictions: calculates waits
backend/src/services/intelligenceEngine.js - Queue intelligence → SQLite state and feeds: reads staff state
backend/src/services/intelligenceEngine.js - Queue intelligence → Operational events: emits events
backend/src/services/intelligenceEngine.js - Simulation sensors → Operational events: emits updates
backend/src/services/simulatedSensors.js - Video detection → Operational events: publishes detections
backend/src/services/detectionService.js - Video detection → YOLO detector: runs detector
README.md - Live event delivery → Operational events: subscribes events
backend/src/socket/socketHandler.js - Live event delivery → Queue intelligence: reads initial state
backend/src/socket/socketHandler.js - Live event delivery → SQLite state and feeds: reads staff state
backend/src/socket/socketHandler.js - Live event delivery → Rule-based predictions: computes initial wait
backend/src/socket/socketHandler.js - HTTP and socket server → In-memory analytics: records events
backend/src/index.js - Simulation sensors → Sustainability simulation: uses sustainability logic
backend/src/services/simulatedSensors.js - REST client → HTTP and socket server: HTTP requests
- Socket client → Live event delivery: receives live events
README.md - Live event delivery → Live state: updates live state
- Live state → Student views: supplies live data
frontend/src/pages/Student/Home/StudentHome.jsx - Live state → Staff console: supplies live data
frontend/src/pages/Staff/Dashboard/StaffDashboard.jsx