How oshone-system/fleetsystem works
Fleet Khata is a truck-fleet operations portal. Staff sign in, maintain fleet and party records, plan routes, record gate-out and gate-in, then review trip sheets, settlements, alerts and reports. GPS updates can feed live route alerts and gate-in distance checks; vehicle documents have expiry alerts. The graph uses the root backend/frontend/shared tree, which matches the README. The duplicate fleet-khata-pern tree appears to be a parallel copy. Some feature wiring is documented but its implementation was not sampled, so uncertain calls are omitted.
Main entry points: api.js API client · app.js Express API · crud.js Database access · trips.js Trip workflow
Components 30
Web portal
- Portal entry
frontend/src/main.jsx - App state
frontend/src/lib/store.jsx - API client
frontend/src/lib/api.js
Fleet operations
- Gate out
frontend/src/pages/GateOut.jsx - Gate in
frontend/src/pages/GateIn.jsx - Trips and sheets
frontend/src/pages/Trips.jsx - Dashboard
frontend/src/pages/Dashboard.jsx - Fleet and parties
frontend/src/pages/Parties.jsx - Vehicle documents
frontend/src/pages/Documents.jsx - Reports
frontend/src/pages/Reports.jsx - Users and roles
frontend/src/pages/Users.jsx - Master records
backend/src/routes/master.js - Trip workflow
backend/src/routes/trips.js - Document handling
backend/src/routes/docs.js - Reports and alerts
backend/src/routes/reports.js
Tracking services
- GPS endpoints
backend/src/routes/gps.js - Route planning
backend/src/services/routePlanner.js - Live GPS checks
backend/src/services/liveGps.js - Vendor polling
backend/src/services/gpsVendor.js - Alert handling
backend/src/services/alerts.js - Expiry schedule
backend/src/jobs/cron.js
API and data
- Express API
backend/src/app.js - Authentication and roles
backend/src/routes/auth.js - Trip calculations context
backend/src/services/context.js - Fleet calculations
shared/calc.js - Database access
backend/src/db/crud.js - PostgreSQL
Other components
- Fleet staff
- GPS provider
- Google Maps
Connections 35
- Fleet staff → Portal entry: uses
- Portal entry → App state: provides state
- App state → API client: requests data
- Gate out → API client: submits gate-out
- Gate in → API client: submits gate-in
- Trips and sheets → API client: loads trips
- Dashboard → API client: loads dashboard
- Fleet and parties → API client: manages records
- Vehicle documents → API client: uploads documents
- Reports → API client: requests reports
- Users and roles → API client: manages users
- API client → Express API: HTTP requests
- Express API → Authentication and roles: mounts routes
- Express API → Master records: mounts routes
- Express API → Trip workflow: mounts routes
- Express API → Document handling: mounts routes
- Express API → Reports and alerts: mounts routes
- Express API → GPS endpoints: mounts routes
- Authentication and roles → Database access: reads and writes
- Master records → Database access: reads and writes
- Trip workflow → Database access: reads and writes
- Trip workflow → Trip calculations context: loads calculations
- Trip calculations context → Fleet calculations: calculates trips
- Document handling → Database access: stores metadata
- Reports and alerts → Database access: reads report data
- GPS endpoints → Database access: stores GPS points
- GPS endpoints → Live GPS checks: processes locations
- GPS endpoints → GPS provider: accepts webhook
- Vendor polling → GPS provider: polls locations
- Vendor polling → Live GPS checks: provides locations
- Trip workflow → Route planning: plans routes
- Route planning → Google Maps: gets distance
- Expiry schedule → Alert handling: checks expiry
- Live GPS checks → Alert handling: raises deviations
- Database access → PostgreSQL: queries