How kevinvargis/bottled-water-delivery-management-system works
Purpose and topology
This is a packaged-drinking-water delivery-management system with three deployable parts: a React web portal for company, manager, supervisor, and customer roles; an Expo/React Native delivery-team app; and a Node/Express API backed by modeled persistence. The root README describes the operational workflow; source is split under src/Web-App, src/App, and src/server.
Entry points and runtimes
• Web client: Create React App bootstrap at src/Web-App/src/index.js, application routing/composition in src/Web-App/src/App.js.
• Mobile client: Expo entry component src/App/App.js; screen-based React Native UI under src/App/src/screens.
• Backend: Node/Express process starts at src/server/server.js.
• Dependency manifests exist separately at src/Web-App/package.json, src/App/package.json, and src/server/package.json, indicating independently runnable frontend, mobile, and API projects.
Identity, roles, and access boundary
The system’s core hierarchy is company → managers → supervisors → customers/delivery staff. User/domain representation is centered in src/server/models/User.js, role-specific models such as src/server/models/Company.js and src/server/models/Supervisor.js, and user endpoints in src/server/routes/api/users.js.
Web authentication state is managed through Redux-like action/reducer/store layers: src/Web-App/src/actions/authActions.js, src/Web-App/src/reducers/authReducer.js, and src/Web-App/src/store.js. Protected web access is enforced at src/Web-App/src/components/private-route/PrivateRoute.js; bearer-token attachment is isolated in src/Web-App/src/utils/setAuthToken.js. Server authentication configuration is represented by src/server/config/passport.js.
Administrative web workflows
Role-specific web areas partition management responsibilities:
• Company creates managers and views its dashboard: src/Web-App/src/components/company/CreateManager.js, src/Web-App/src/components/company/Dashboard.js.
• Managers provision operational resources and staff—customers, drivers, delivery boys, supervisors, vehicles—through src/Web-App/src/components/manager (for example CreateCustomer.js, CreateVehicle.js).
• Supervisors create/assign routes and inspect inventory via src/Web-App/src/components/supervisor/CreateRoute.js, AssignRoute.js, and Inventory.js.
• Customers request cans, submit complaints, view subscriptions/QR codes through src/Web-App/src/components/customer/RequestCans.js, RegisterComplaint.js, and ViewQr.js.
Delivery execution and mobile flow
The Expo app serves delivery personnel rather than office roles. Its principal stages are sign-in, attendance/team participation, trip selection/viewing, QR scanning, delivery progress, and profile: src/App/src/screens/SignInScreen.js, AttendanceScreen.js, TripScreen.js, ScanScreen.js, and ProgressScreen.js. Shared mobile components include trip switching and delivery-card presentation in src/App/src/components/SwitchTripView.js and DeliScreenCard.js.
Operationally, driver and vehicle QR pairing creates a daily trip; delivery staff join a vehicle/trip; the team scans a customer QR and records filled-can delivery, empty-can pickup, and damage. This client workflow is a boundary to server-side trip, delivery, vehicle, and customer records.
Operational domain and persistence model
Mongoose-style server models define the system of record for fleet and fulfillment: src/server/models/Vehicle.js, src/server/models/Route.js, src/server/models/Trip.js, src/server/models/Deliveries.js, and src/server/models/Inventory.js. Trip lifecycle distinctions are explicitly modeled in src/server/models/Initialtrip.js and src/server/models/Intermediatetrip.js, likely supporting vehicle/team assignment changes during a day. Complaints and customer subscriptions/orders are represented by src/server/models/Complaint.js and src/server/models/Kharidaar.js.
API boundary and input control
REST endpoints are organized by principal actor at src/server/routes/api/customers.js, src/server/routes/api/drivers.js, src/server/routes/api/managers.js, src/server/routes/api/supervisors.js, and src/server/routes/api/boys.js. Validation is separated before domain handling, notably src/server/validation/login.js, src/server/validation/routecreation.js, and src/server/validation/inventoryupdate.js. Credentials/configuration are isolated in src/server/config/keys.js; its contents and the actual database/provider are not visible from the supplied tree.
Main entry points: customers.js Actor REST endpoints · server.js Express server · App.js Role-based portal · Trip.js Trip lifecycle
Components 16
Web Portal
React administration portal for office and customer roles.
- Web bootstrap
src/Web-App/src/index.js - Role-based portal · Composes company, manager, supervisor, and customer areas.
src/Web-App/src/App.js - Auth state · Stores web authentication state and token handling.
src/Web-App/src/actions/authActions.js - Protected routes
src/Web-App/src/components/private-route/PrivateRoute.js - Administrative workflows · Company, manager, supervisor, and customer operations.
src/Web-App/src/components/manager
Delivery App
Expo app used by delivery teams.
- Mobile entry
src/App/App.js - Delivery workflow · Sign-in, attendance, trips, QR scan, and delivery progress.
src/App/src/screens/ScanScreen.js
Node API
Express API and modeled operational system of record.
- Express server
src/server/server.js - Authentication · Authenticates bearer-token requests.
src/server/config/passport.js - Actor REST endpoints · Customer, driver, manager, supervisor, and delivery-staff APIs.
src/server/routes/api/customers.js - Request validation · Validates login, route creation, and inventory updates before handling.
src/server/validation/login.js - Users and hierarchy · Company-to-manager-to-supervisor-to-customer/staff role model.
src/server/models/User.js - Fleet and routes · Vehicles and delivery routes.
src/server/models/Vehicle.js - Trip lifecycle · Daily trips, including initial and intermediate assignment stages.
src/server/models/Trip.js - Deliveries and inventory · Tracks can delivery, empty pickup, damage, and stock.
src/server/models/Deliveries.js - Customer service records · Subscriptions/orders and complaints.
src/server/models/Kharidaar.js
Connections 19
- Web bootstrap → Role-based portal: mounts
- Role-based portal → Protected routes: guards role areas
- Auth state → Protected routes: supplies session
- Role-based portal → Auth state: sign-in actions
- Protected routes → Administrative workflows: permits access
- Administrative workflows → Express server: REST requests
- Mobile entry → Delivery workflow: renders screens
- Delivery workflow → Express server: trip and scan updates
- Express server → Authentication: authenticates
- Express server → Actor REST endpoints: dispatches
- Actor REST endpoints → Request validation: validates input
- Actor REST endpoints → Users and hierarchy: manages identities
- Actor REST endpoints → Fleet and routes: manages fleet
- Actor REST endpoints → Trip lifecycle: creates and joins trips
- Actor REST endpoints → Deliveries and inventory: records fulfillment
- Actor REST endpoints → Customer service records: handles orders and complaints
- Trip lifecycle → Fleet and routes: assigns vehicle and route
- Trip lifecycle → Deliveries and inventory: drives delivery records
- Users and hierarchy → Customer service records: relates customers