# syedhaider037/spotter-hos-app architecture

> Architecture diagram of the GitHub repository syedhaider037/spotter-hos-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/syedhaider037/spotter-hos-app
- Repository: https://github.com/syedhaider037/spotter-hos-app

## Overview

HOS Trip Planner turns a driver's current location, pickup, dropoff, and used cycle hours into an HOS-compliant route plan with stops and daily logs. The React app submits that request to the Django planning endpoint, then presents the returned route and schedule as a map, stop timeline, trip summary, limits strip, and ELD-style daily sheets. The backend planner owns simulation and calls routing and HOS-rule services; the frontend owns request handling and result presentation. Source excerpts confirm key call relationships; other documented features are included with only README-supported links.

Main entry points: [`frontend/src/App.js`](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/App.js) (Trip form and controller), [`backend/trip/views.py`](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/views.py) (Plan endpoint), [`backend/trip/services/trip_planner.py`](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/trip_planner.py) (Trip simulation), [`frontend/src/utils/planApi.js`](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/planApi.js) (Plan API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Trip planning interface"]
  node_app["Trip form and controller<br/>[App.js]"]
  node_api_request["Plan API client<br/>[planApi.js]"]
end

subgraph group_api["Planning API"]
  node_django["Django API routing<br/>[urls.py]"]
  node_plan_route["Plan endpoint<br/>[views.py]"]
  node_throttle["Request throttling<br/>[throttles.py]"]
end

subgraph group_planning["Route and HOS planning"]
  node_planner["Trip simulation<br/>[trip_planner.py]"]
  node_routes["Geocoding and routing<br/>[route_service.py]"]
  node_hos["HOS rules<br/>[hos_rules.py]"]
end

subgraph group_presentation["Plan presentation"]
  node_stops_util["Stops and time labels<br/>[stops.js]"]
  node_summary_util["Trip summary calculations<br/>[tripSummary.js]"]
  node_polyline["Polyline decoding<br/>[polyline.js]"]
  node_limits["HOS limits display<br/>[HosLimits.js]"]
  node_summary["Trip summary display<br/>[TripSummary.js]"]
  node_map["Route map and stops<br/>[TripMap.js]"]
  node_preview["Plan preview<br/>[PlanPreview.js]"]
  node_logs["Daily log sheet rendering<br/>[EldLogSheet.js]"]
  node_log_util["Log sheet calculations<br/>[logSheet.js]"]
end

node_driver(("Driver"))
node_ors{{"OpenRouteService"}}

node_driver -->|"enters trip"| node_app
node_app -->|"submits plan"| node_api_request
node_api_request -.->|"sends JSON"| node_django
node_django -->|"routes request"| node_plan_route
node_plan_route -->|"applies throttle"| node_throttle
node_plan_route -->|"calls planner"| node_planner
node_planner -->|"gets route legs"| node_routes
node_planner -->|"checks limits"| node_hos
node_routes -->|"requests geocoding and directions"| node_ors
node_planner -.->|"returns plan"| node_plan_route
node_plan_route -.->|"returns JSON"| node_api_request
node_api_request -.->|"returns result"| node_app
node_app -->|"groups stops"| node_stops_util
node_app -->|"summarizes plan"| node_summary_util
node_summary_util -->|"decodes route"| node_polyline
node_app -->|"renders limits"| node_limits
node_app -->|"renders summary"| node_summary
node_app -->|"renders map"| node_map
node_app -->|"renders preview"| node_preview
node_app -->|"renders daily logs"| node_logs
node_map -->|"decodes route"| node_polyline
node_map -->|"describes stops"| node_stops_util
node_logs -->|"builds sheet"| node_log_util

click node_app "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/App.js"
click node_api_request "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/planApi.js"
click node_django "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/backend/urls.py"
click node_plan_route "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/views.py"
click node_throttle "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/throttles.py"
click node_planner "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/trip_planner.py"
click node_routes "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/route_service.py"
click node_hos "https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/hos_rules.py"
click node_stops_util "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/stops.js"
click node_summary_util "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/tripSummary.js"
click node_polyline "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/polyline.js"
click node_limits "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/HosLimits.js"
click node_summary "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/TripSummary.js"
click node_map "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/TripMap.js"
click node_preview "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/PlanPreview.js"
click node_logs "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/EldLogSheet.js"
click node_log_util "https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/logSheet.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_api_request toneBlue
class node_django,node_plan_route,node_throttle toneAmber
class node_planner,node_routes,node_hos,node_ors toneMint
class node_stops_util,node_summary_util,node_polyline,node_limits,node_summary,node_map,node_preview,node_logs,node_log_util toneRose
class node_driver toneIndigo
```

## Components

### Trip planning interface

- [Trip form and controller](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Plan API client](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/planApi.js): `frontend/src/utils/planApi.js`

### Planning API

- [Django API routing](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/backend/urls.py): `backend/backend/urls.py`
- [Plan endpoint](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/views.py): `backend/trip/views.py`
- [Request throttling](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/throttles.py): `backend/trip/throttles.py`

### Route and HOS planning

- [Trip simulation](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/trip_planner.py): `backend/trip/services/trip_planner.py`
- [Geocoding and routing](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/route_service.py): `backend/trip/services/route_service.py`
- [HOS rules](https://github.com/syedhaider037/spotter-hos-app/blob/main/backend/trip/services/hos_rules.py): `backend/trip/services/hos_rules.py`

### Plan presentation

- [Stops and time labels](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/stops.js): `frontend/src/utils/stops.js`
- [Trip summary calculations](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/tripSummary.js): `frontend/src/utils/tripSummary.js`
- [Polyline decoding](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/polyline.js): `frontend/src/utils/polyline.js`
- [HOS limits display](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/HosLimits.js): `frontend/src/components/HosLimits.js`
- [Trip summary display](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/TripSummary.js): `frontend/src/components/TripSummary.js`
- [Route map and stops](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/TripMap.js): `frontend/src/components/TripMap.js`
- [Plan preview](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/PlanPreview.js): `frontend/src/components/PlanPreview.js`
- [Daily log sheet rendering](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/components/EldLogSheet.js): `frontend/src/components/EldLogSheet.js`
- [Log sheet calculations](https://github.com/syedhaider037/spotter-hos-app/blob/main/frontend/src/utils/logSheet.js): `frontend/src/utils/logSheet.js`

### Other components

- **Driver**
- **OpenRouteService**

## Connections

- Driver → Trip form and controller: enters trip (evidence: `frontend/src/App.js`)
- Trip form and controller → Plan API client: submits plan (evidence: `frontend/src/App.js`)
- Plan API client → Django API routing: sends JSON (evidence: `README.md`)
- Django API routing → Plan endpoint: routes request (evidence: `backend/backend/urls.py`)
- Plan endpoint → Request throttling: applies throttle (evidence: `backend/trip/views.py`)
- Plan endpoint → Trip simulation: calls planner (evidence: `backend/trip/views.py`)
- Trip simulation → Geocoding and routing: gets route legs (evidence: `backend/trip/services/trip_planner.py`)
- Trip simulation → HOS rules: checks limits (evidence: `backend/trip/services/trip_planner.py`)
- Geocoding and routing → OpenRouteService: requests geocoding and directions (evidence: `backend/trip/services/route_service.py`)
- Trip simulation → Plan endpoint: returns plan (evidence: `backend/trip/views.py`)
- Plan endpoint → Plan API client: returns JSON (evidence: `README.md`)
- Plan API client → Trip form and controller: returns result (evidence: `frontend/src/App.js`)
- Trip form and controller → Stops and time labels: groups stops (evidence: `frontend/src/App.js`)
- Trip form and controller → Trip summary calculations: summarizes plan (evidence: `frontend/src/App.js`)
- Trip summary calculations → Polyline decoding: decodes route (evidence: `frontend/src/utils/tripSummary.js`)
- Trip form and controller → HOS limits display: renders limits (evidence: `frontend/src/App.js`)
- Trip form and controller → Trip summary display: renders summary (evidence: `frontend/src/App.js`)
- Trip form and controller → Route map and stops: renders map (evidence: `frontend/src/App.js`)
- Trip form and controller → Plan preview: renders preview (evidence: `frontend/src/App.js`)
- Trip form and controller → Daily log sheet rendering: renders daily logs (evidence: `frontend/src/App.js`)
- Route map and stops → Polyline decoding: decodes route (evidence: `frontend/src/components/TripMap.js`)
- Route map and stops → Stops and time labels: describes stops (evidence: `frontend/src/components/TripMap.js`)
- Daily log sheet rendering → Log sheet calculations: builds sheet (evidence: `frontend/src/components/EldLogSheet.js`)
