How saipavan-28/foodbanksystem works
FoodBridge coordinates food donors, NGOs/shelters, volunteers and administrators through donation and relief requests, volunteer assignment, pickup/delivery tracking and completion. The UI routes role-based portals through shared application state; that state uses REST services against an Express/MongoDB backend, with Socket.IO for live tracking and chat/notifications. Geolocation and Golden Hour urgency are supporting capabilities. The graph reflects only visible calls or imports and explicit excerpts; unshown routes and integrations are not assumed to connect.
Main entry points: FoodBridgeContext.tsx Shared workflow state · App.tsx Role router · server.js HTTP and socket server · VolunteerApp.tsx Volunteer app
Components 34
Role-based application
- Role router
src/App.tsx - Donor portal
src/pages/DonorPortal.tsx - NGO portal
src/pages/NGOPortal.tsx - Volunteer app
src/pages/VolunteerApp.tsx - Admin center
src/pages/AdminCommandCenter.tsx - Public landing
src/pages/PublicLanding.tsx - Login and registration
src/pages/LoginPage.tsx
Food rescue workflow
- Shared workflow state
src/context/FoodBridgeContext.tsx - Volunteer matching card
src/components/MatchingDeliveryBoyCard.tsx - Volunteer safety quiz
src/components/VolunteerQuizModal.tsx
API and persistence
- REST client
src/services/api.ts - HTTP and socket server
server/server.js - Authentication routes
server/routes/authRoutes.js - Request routes
server/routes/requestRoutes.js - Volunteer routes
server/routes/volunteerRoutes.js - Chat routes
server/routes/chatRoutes.js - Notification routes
server/routes/notificationRoutes.js - Tracking endpoint
server/routes/trackingRoutes.js - User records
server/models/User.js - Donation requests
server/models/DonationRequest.js - Volunteer records
server/models/Volunteer.js
Live coordination
- Chat records
server/models/Chat.js - Notification records
server/models/Notification.js - Socket client
src/services/socket.ts - Live delivery tracking
src/components/LiveTrackingModal.tsx - Live chat
src/components/LiveChatModal.tsx
Shared capabilities
- Geolocation and distance
src/utils/geoUtils.ts - Location picker
src/components/LocationPickerMap.tsx - Golden Hour timer
src/components/GoldenHourBadge.tsx - Profile editor
src/components/ProfileEditor.tsx - Domain types
src/types/foodbridge.ts
Other components
- Donor / NGO / volunteer
- Administrator
- OpenStreetMap Nominatim
Connections 45
- Donor / NGO / volunteer → Role router: uses
src/App.tsx - Administrator → Role router: uses
src/App.tsx - Role router → Shared workflow state: provides state
src/App.tsx - Role router → Donor portal: routes role
src/App.tsx - Role router → NGO portal: routes role
src/App.tsx - Role router → Volunteer app: routes role
src/App.tsx - Role router → Admin center: routes role
src/App.tsx - Role router → Public landing: routes default
src/App.tsx - Role router → Login and registration: routes login
src/App.tsx - Donor portal → Shared workflow state: updates requests
src/pages/DonorPortal.tsx - NGO portal → Shared workflow state: submits needs
src/pages/NGOPortal.tsx - Volunteer app → Shared workflow state: updates missions
src/pages/VolunteerApp.tsx - Admin center → Shared workflow state: manages requests
src/pages/AdminCommandCenter.tsx - Login and registration → Shared workflow state: authenticates
src/pages/LoginPage.tsx - Shared workflow state → REST client: calls REST
src/context/FoodBridgeContext.tsx - REST client → HTTP and socket server: sends API requests
- HTTP and socket server → Authentication routes: mounts routes
server/server.js - HTTP and socket server → Request routes: mounts routes
server/server.js - HTTP and socket server → Volunteer routes: mounts routes
server/server.js - HTTP and socket server → Chat routes: mounts routes
server/server.js - HTTP and socket server → Notification routes: mounts routes
server/server.js - HTTP and socket server → Tracking endpoint: mounts routes
server/server.js - Authentication routes → User records: reads and writes
server/routes/authRoutes.js - Request routes → Donation requests: reads and writes
server/routes/requestRoutes.js - Request routes → Volunteer records: releases assignment
server/routes/requestRoutes.js - Volunteer routes → Volunteer records: manages
server/routes/volunteerRoutes.js - Chat routes → Chat records: stores messages
server/routes/chatRoutes.js - Notification routes → Notification records: stores alerts
server/routes/notificationRoutes.js - HTTP and socket server → Socket client: exchanges events
- Live delivery tracking → Socket client: subscribes
src/components/LiveTrackingModal.tsx - Live delivery tracking → Geolocation and distance: calculates distance
src/components/LiveTrackingModal.tsx - Live chat → Shared workflow state: uses shared state
src/components/LiveChatModal.tsx - Location picker → Geolocation and distance: geocodes locations
src/components/LocationPickerMap.tsx - Geolocation and distance → OpenStreetMap Nominatim: searches and resolves
src/utils/geoUtils.ts - Shared workflow state → Geolocation and distance: uses distance
src/context/FoodBridgeContext.tsx - Donor portal → Golden Hour timer: renders urgency
src/pages/DonorPortal.tsx - NGO portal → Golden Hour timer: renders urgency
src/pages/NGOPortal.tsx - Volunteer app → Golden Hour timer: renders urgency
src/pages/VolunteerApp.tsx - Admin center → Volunteer matching card: renders matching
src/pages/AdminCommandCenter.tsx - Login and registration → Volunteer safety quiz: renders quiz
src/pages/LoginPage.tsx - Volunteer app → Volunteer safety quiz: renders quiz
src/pages/VolunteerApp.tsx - NGO portal → Profile editor: renders editor
src/pages/NGOPortal.tsx - Donor portal → Profile editor: renders editor
src/pages/DonorPortal.tsx - Shared workflow state → Domain types: uses domain types
src/context/FoodBridgeContext.tsx - Volunteer app → Domain types: uses domain types
src/pages/VolunteerApp.tsx