# condabeta/routerest architecture

> Architecture diagram of the GitHub repository condabeta/routerest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/condabeta/routerest
- Repository: https://github.com/condabeta/routerest

## Overview

RouteRest is a web-based truck trip planner that turns driver location and cycle-hour inputs into an HOS-aware route, stop schedule, trip summary, and daily ELD logs. The main flow runs from the React form through the Django planning endpoint, location lookup, road routing, and HOS simulation; the result is saved and returned for map, directions, itinerary, compliance, and log-sheet views. The README also documents PDF export. Edges reflect the excerpts, SOURCE INDEX references, or README; unsampled internals are not inferred.

Main entry points: [`backend/trips/views.py`](https://github.com/condabeta/routerest/blob/main/backend/trips/views.py) (Planning endpoint), [`frontend/src/App.jsx`](https://github.com/condabeta/routerest/blob/main/frontend/src/App.jsx) (Results coordinator), [`frontend/src/api.js`](https://github.com/condabeta/routerest/blob/main/frontend/src/api.js) (API client), [`frontend/src/components/TripForm.jsx`](https://github.com/condabeta/routerest/blob/main/frontend/src/components/TripForm.jsx) (Trip form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Trip planning UI"]
  node_tripform["Trip form<br/>[TripForm.jsx]"]
  node_locationinput["Location autocomplete<br/>[LocationInput.jsx]"]
  node_webapi["API client<br/>[api.js]"]
  node_app["Results coordinator<br/>[App.jsx]"]
  node_map["Route map<br/>[RouteMap.jsx]"]
  node_directions["Route directions"]
  node_summary["Trip summary<br/>[TripSummary.jsx]"]
  node_timeline["Stops itinerary<br/>[StopsTimeline.jsx]"]
  node_compliance["Compliance summary<br/>[ComplianceCard.jsx]"]
  node_logs["Daily log sheets<br/>[LogSheets.jsx]"]
  node_loggrid["ELD log grid<br/>[LogSheet.jsx]"]
  node_pdf["PDF export<br/>[LogSheets.jsx]"]
end

subgraph group_backend["Planning services"]
  node_plannerapi["Planning endpoint<br/>[views.py]"]
  node_serializer["Input validation<br/>[serializers.py]"]
  node_geocoding["Geocoding and suggestions<br/>[geocoding.py]"]
  node_routing["Road routing<br/>[routing.py]"]
  node_hos["HOS planner and logs<br/>[hos_planner.py]"]
end

subgraph group_integrations["External services"]
  node_osm{{"Photon / Nominatim"}}
  node_osrm{{"OSRM"}}
end

subgraph group_records["Trip records"]
  node_triprecord[("Trip record<br/>[models.py]")]
end

node_driver(("Driver"))

node_driver -->|"enters trip"| node_tripform
node_tripform -->|"collects locations"| node_locationinput
node_locationinput -->|"requests suggestions"| node_webapi
node_webapi -->|"posts plan"| node_plannerapi
node_webapi -->|"requests autocomplete"| node_plannerapi
node_plannerapi -->|"validates input"| node_serializer
node_plannerapi -->|"geocodes locations"| node_geocoding
node_plannerapi -->|"gets suggestions"| node_geocoding
node_geocoding -->|"queries places"| node_osm
node_plannerapi -->|"gets route"| node_routing
node_routing -->|"requests directions"| node_osrm
node_plannerapi -->|"simulates HOS plan"| node_hos
node_plannerapi -->|"saves plan"| node_triprecord
node_plannerapi -.->|"returns plan"| node_webapi
node_app -->|"requests plan"| node_webapi
node_app -->|"renders form"| node_tripform
node_app -->|"renders route"| node_map
node_app -->|"renders directions"| node_directions
node_app -->|"renders summary"| node_summary
node_app -->|"renders itinerary"| node_timeline
node_app -->|"renders compliance"| node_compliance
node_app -->|"renders logs"| node_logs
node_logs -->|"renders sheets"| node_loggrid
node_driver -.->|"downloads logs"| node_pdf

click node_tripform "https://github.com/condabeta/routerest/blob/main/frontend/src/components/TripForm.jsx"
click node_locationinput "https://github.com/condabeta/routerest/blob/main/frontend/src/components/LocationInput.jsx"
click node_webapi "https://github.com/condabeta/routerest/blob/main/frontend/src/api.js"
click node_app "https://github.com/condabeta/routerest/blob/main/frontend/src/App.jsx"
click node_map "https://github.com/condabeta/routerest/blob/main/frontend/src/components/RouteMap.jsx"
click node_directions "https://github.com/condabeta/routerest/blob/main/frontend/src/components/RouteInstructions.jsx"
click node_summary "https://github.com/condabeta/routerest/blob/main/frontend/src/components/TripSummary.jsx"
click node_timeline "https://github.com/condabeta/routerest/blob/main/frontend/src/components/StopsTimeline.jsx"
click node_compliance "https://github.com/condabeta/routerest/blob/main/frontend/src/components/ComplianceCard.jsx"
click node_logs "https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheets.jsx"
click node_loggrid "https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheet.jsx"
click node_plannerapi "https://github.com/condabeta/routerest/blob/main/backend/trips/views.py"
click node_serializer "https://github.com/condabeta/routerest/blob/main/backend/trips/serializers.py"
click node_geocoding "https://github.com/condabeta/routerest/blob/main/backend/trips/services/geocoding.py"
click node_routing "https://github.com/condabeta/routerest/blob/main/backend/trips/services/routing.py"
click node_hos "https://github.com/condabeta/routerest/blob/main/backend/trips/services/hos_planner.py"
click node_triprecord "https://github.com/condabeta/routerest/blob/main/backend/trips/models.py"
click node_pdf "https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheets.jsx"

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_tripform,node_locationinput,node_webapi,node_app,node_map,node_directions,node_summary,node_timeline,node_compliance,node_logs,node_loggrid,node_pdf toneBlue
class node_plannerapi,node_serializer,node_geocoding,node_routing,node_hos toneAmber
class node_osm,node_osrm toneMint
class node_triprecord toneRose
class node_driver toneIndigo
```

## Components

### Trip planning UI

- [Trip form](https://github.com/condabeta/routerest/blob/main/frontend/src/components/TripForm.jsx): `frontend/src/components/TripForm.jsx`
- [Location autocomplete](https://github.com/condabeta/routerest/blob/main/frontend/src/components/LocationInput.jsx): `frontend/src/components/LocationInput.jsx`
- [API client](https://github.com/condabeta/routerest/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Results coordinator](https://github.com/condabeta/routerest/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Route map](https://github.com/condabeta/routerest/blob/main/frontend/src/components/RouteMap.jsx): `frontend/src/components/RouteMap.jsx`
- [Route directions](https://github.com/condabeta/routerest/blob/main/frontend/src/components/RouteInstructions.jsx): `frontend/src/components/RouteInstructions.jsx`
- [Trip summary](https://github.com/condabeta/routerest/blob/main/frontend/src/components/TripSummary.jsx): `frontend/src/components/TripSummary.jsx`
- [Stops itinerary](https://github.com/condabeta/routerest/blob/main/frontend/src/components/StopsTimeline.jsx): `frontend/src/components/StopsTimeline.jsx`
- [Compliance summary](https://github.com/condabeta/routerest/blob/main/frontend/src/components/ComplianceCard.jsx): `frontend/src/components/ComplianceCard.jsx`
- [Daily log sheets](https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheets.jsx): `frontend/src/components/LogSheets.jsx`
- [ELD log grid](https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheet.jsx): `frontend/src/components/LogSheet.jsx`
- [PDF export](https://github.com/condabeta/routerest/blob/main/frontend/src/components/LogSheets.jsx): `frontend/src/components/LogSheets.jsx`

### Planning services

- [Planning endpoint](https://github.com/condabeta/routerest/blob/main/backend/trips/views.py): `backend/trips/views.py`
- [Input validation](https://github.com/condabeta/routerest/blob/main/backend/trips/serializers.py): `backend/trips/serializers.py`
- [Geocoding and suggestions](https://github.com/condabeta/routerest/blob/main/backend/trips/services/geocoding.py): `backend/trips/services/geocoding.py`
- [Road routing](https://github.com/condabeta/routerest/blob/main/backend/trips/services/routing.py): `backend/trips/services/routing.py`
- [HOS planner and logs](https://github.com/condabeta/routerest/blob/main/backend/trips/services/hos_planner.py): `backend/trips/services/hos_planner.py`

### External services

- **Photon / Nominatim**
- **OSRM**

### Trip records

- [Trip record](https://github.com/condabeta/routerest/blob/main/backend/trips/models.py): `backend/trips/models.py`

### Other components

- **Driver**

## Connections

- Driver → Trip form: enters trip (evidence: `README.md`)
- Trip form → Location autocomplete: collects locations (evidence: `frontend/src/components/TripForm.jsx`)
- Location autocomplete → API client: requests suggestions (evidence: `frontend/src/components/LocationInput.jsx`)
- API client → Planning endpoint: posts plan (evidence: `frontend/src/api.js`)
- API client → Planning endpoint: requests autocomplete (evidence: `frontend/src/api.js`)
- Planning endpoint → Input validation: validates input (evidence: `backend/trips/views.py`)
- Planning endpoint → Geocoding and suggestions: geocodes locations (evidence: `backend/trips/views.py`)
- Planning endpoint → Geocoding and suggestions: gets suggestions (evidence: `backend/trips/views.py`)
- Geocoding and suggestions → Photon / Nominatim: queries places (evidence: `backend/trips/services/geocoding.py`)
- Planning endpoint → Road routing: gets route (evidence: `backend/trips/views.py`)
- Road routing → OSRM: requests directions (evidence: `backend/trips/services/routing.py`)
- Planning endpoint → HOS planner and logs: simulates HOS plan (evidence: `backend/trips/views.py`)
- Planning endpoint → Trip record: saves plan (evidence: `backend/trips/views.py`)
- Planning endpoint → API client: returns plan
- Results coordinator → API client: requests plan (evidence: `frontend/src/App.jsx`)
- Results coordinator → Trip form: renders form (evidence: `frontend/src/App.jsx`)
- Results coordinator → Route map: renders route (evidence: `frontend/src/App.jsx`)
- Results coordinator → Route directions: renders directions (evidence: `frontend/src/App.jsx`)
- Results coordinator → Trip summary: renders summary (evidence: `frontend/src/App.jsx`)
- Results coordinator → Stops itinerary: renders itinerary (evidence: `frontend/src/App.jsx`)
- Results coordinator → Compliance summary: renders compliance (evidence: `frontend/src/App.jsx`)
- Results coordinator → Daily log sheets: renders logs (evidence: `frontend/src/App.jsx`)
- Daily log sheets → ELD log grid: renders sheets (evidence: `frontend/src/components/LogSheets.jsx`)
- Driver → PDF export: downloads logs (evidence: `README.md`)
