How netalgupta/online-canteen-ordering-system works
Smart Canteen is a student pre-ordering and kitchen-queue system with student, staff, and admin workflows. The documented runtime combines a React client with an Express/MongoDB backend and Socket.IO updates. The graph highlights order placement and queue handling, plus menu, kitchen, administration, authentication, and notifications. Some client-to-server request wiring and several subsystems were not sampled; those relationships are omitted rather than inferred.
Main entry points: order.controller.js Order workflow · AppRouter.jsx Role-based routes · queue.service.js Queue and ETA · Order.model.js Order records
Components 30
Client experience
- Client bootstrap
client/src/App.jsx - Role-based routes
client/src/router/AppRouter.jsx - Student ordering
client/src/pages/student - Kitchen and pickup
client/src/pages/staff - Admin console
client/src/pages/admin - Menu management
client/src/pages/admin/MenuManagerPage.jsx - Client authentication
client/src/context/AuthContext.jsx - Browser storage
client/src/utils/storage.js - HTTP client
client/src/services/api.js - Live update context
client/src/context/SocketContext.jsx
Orders and queue
- Order endpoints
server/src/routes/order.routes.js - Order workflow
server/src/controllers/order.controller.js - Order records
server/src/models/Order.model.js - Queue and ETA
server/src/services/queue.service.js - Pickup QR generation
server/src/utils/qrcode.util.js
Canteen operations
- Menu endpoints
server/src/routes/menu.routes.js - Menu catalog
server/src/controllers/menu.controller.js - Food catalog records
server/src/models/FoodItem.model.js - Kitchen order handling
server/src/controllers/staff.controller.js - Analytics and settings
server/src/controllers/admin.controller.js - Canteen settings
server/src/models/SystemSettings.model.js
Identity and realtime
- Token authentication
server/src/middleware/auth.middleware.js - User accounts
server/src/models/User.model.js - Notifications
server/src/services/notification.service.js - Socket event dispatch
server/src/services/socket.service.js - Socket server
server/src/config/socket.js - HTTP route mounting
server/src/app.js
Other components
- Student
- Staff
- Administrator
Connections 35
- Client bootstrap → Role-based routes: renders routes
client/src/App.jsx - Client bootstrap → Client authentication: provides auth
client/src/App.jsx - Client bootstrap → Live update context: provides realtime
client/src/App.jsx - Role-based routes → Student ordering: routes students
client/src/router/AppRouter.jsx - Role-based routes → Kitchen and pickup: routes staff
client/src/router/AppRouter.jsx - Role-based routes → Admin console: routes admins
client/src/router/AppRouter.jsx - Admin console → Menu management: includes menu editor
- Menu management → HTTP client: uses menu service
client/src/pages/admin/MenuManagerPage.jsx - Client authentication → Browser storage: stores credentials
client/src/context/AuthContext.jsx - Client authentication → HTTP client: sets auth header
client/src/context/AuthContext.jsx - Student → Role-based routes: uses ordering routes
- Staff → Role-based routes: uses staff routes
- Administrator → Role-based routes: uses admin routes
- HTTP route mounting → Order endpoints: mounts endpoints
server/src/app.js - HTTP route mounting → Menu endpoints: mounts endpoints
server/src/app.js - Order endpoints → Order workflow: dispatches requests
server/src/routes/order.routes.js - Menu endpoints → Menu catalog: dispatches requests
server/src/routes/menu.routes.js - Order workflow → Order records: reads and saves
server/src/controllers/order.controller.js - Order workflow → Queue and ETA: calculates queue
server/src/controllers/order.controller.js - Order workflow → Food catalog records: checks availability
server/src/controllers/order.controller.js - Order workflow → Canteen settings: checks operating hours
server/src/controllers/order.controller.js - Order workflow → Pickup QR generation: generates pickup QR
server/src/controllers/order.controller.js - Order workflow → Notifications: creates notices
server/src/controllers/order.controller.js - Queue and ETA → Order records: queries active orders
server/src/services/queue.service.js - Queue and ETA → Canteen settings: reads capacity
server/src/services/queue.service.js - Queue and ETA → Socket event dispatch: broadcasts heat
server/src/services/queue.service.js - Menu catalog → Food catalog records: manages catalog
server/src/controllers/menu.controller.js - Kitchen order handling → Order records: updates order status
server/src/controllers/staff.controller.js - Kitchen order handling → Queue and ETA: recalculates queue
server/src/controllers/staff.controller.js - Kitchen order handling → Notifications: notifies students
server/src/controllers/staff.controller.js - Analytics and settings → Order records: reads analytics
server/src/controllers/admin.controller.js - Analytics and settings → Canteen settings: updates settings
server/src/controllers/admin.controller.js - Token authentication → User accounts: validates account
server/src/middleware/auth.middleware.js - Notifications → Socket event dispatch: emits updates
server/src/services/notification.service.js - Socket event dispatch → Socket server: gets socket server
server/src/services/socket.service.js