# rithick-srm/revrouteai-v1 architecture

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

- Interactive diagram: https://gitdiagram.com/rithick-srm/revrouteai-v1
- Repository: https://github.com/rithick-srm/revrouteai-v1

## Overview

RevRoute AI is a human-verified logistics leakage audit platform: operational and billing records are submitted, documents can supply AI-extracted suggestions, deterministic audits identify variances, and managers review alerts and track recovery cases. Its manager web portal and driver app use a FastAPI backend with relational persistence. The graph combines sampled source relationships with README-documented capabilities; unsampled route and audit internals are represented at their existing directory paths, without asserting unverified implementation calls.

Main entry points: [`backend/app/main.py`](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/main.py) (API Application), [`backend/app/routes/driver_portal.py`](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/driver_portal.py) (Driver Routes), [`frontend/src/App.jsx`](https://github.com/rithick-srm/revrouteai-v1/blob/master/frontend/src/App.jsx) (Manager Workspace), [`backend/app/routes/audits.py`](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/audits.py) (Audit Execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_manager["Manager Portal"]
  node_manager_ui["Manager Workspace<br/>[App.jsx]"]
  node_manager_api["Manager API Client<br/>[api.js]"]
  node_manager_ops["Fleet Records"]
  node_manager_audit["Audit Views"]
end

subgraph group_driver["Driver Portal"]
  node_driver_ui["Driver App<br/>[AppNavigator.js]"]
  node_driver_auth["Driver Identity<br/>[AuthContext.js]"]
  node_driver_api["Driver API Client<br/>[api.js]"]
  node_driver_submissions["Fuel And Repair"]
end

subgraph group_backend["Backend API"]
  node_backend_entry["API Application<br/>[main.py]"]
  node_auth_routes["Authentication Routes<br/>[auth.py]"]
  node_driver_routes["Driver Routes<br/>[driver_portal.py]"]
  node_record_routes["Operational Routes"]
  node_document_routes["Document Intake<br/>[documents.py]"]
  node_document_processor["OCR Extraction"]
end

subgraph group_audit["Audit And Recovery"]
  node_audit_routes["Audit Execution<br/>[audits.py]"]
  node_audit_services["Audit Rules"]
  node_alerts["Leakage Alerts<br/>[alerts.py]"]
  node_cases["Recovery Cases<br/>[action_cases.py]"]
  node_assistant["Fleet Assistant"]
end

subgraph group_data["Domain And Storage"]
  node_domain_models["Domain Records<br/>[domain.py]"]
  node_schemas["API Schemas<br/>[schemas.py]"]
  node_database[("Relational Database<br/>[session.py]")]
end

node_manager_actor(("Fleet Manager"))
node_driver_actor(("Driver"))

node_manager_actor -->|"uses"| node_manager_ui
node_manager_ui -->|"renders"| node_manager_ops
node_manager_ui -->|"renders"| node_manager_audit
node_manager_ops -->|"requests records"| node_manager_api
node_manager_audit -->|"requests audits"| node_manager_api
node_manager_api -->|"calls API"| node_backend_entry
node_driver_actor -->|"uses"| node_driver_ui
node_driver_ui -->|"provides identity"| node_driver_auth
node_driver_auth -->|"authenticates through"| node_driver_api
node_driver_submissions -->|"submits entries"| node_driver_api
node_driver_api -->|"calls API"| node_backend_entry
node_backend_entry -->|"registers"| node_auth_routes
node_backend_entry -->|"registers"| node_driver_routes
node_backend_entry -->|"registers"| node_record_routes
node_backend_entry -->|"registers"| node_document_routes
node_backend_entry -->|"registers"| node_audit_routes
node_backend_entry -->|"registers"| node_alerts
node_backend_entry -->|"registers"| node_cases
node_backend_entry -->|"registers"| node_assistant
node_driver_routes -->|"uses for extraction"| node_document_processor
node_document_routes -.->|"extracts documents"| node_document_processor
node_audit_routes -.->|"executes rules"| node_audit_services
node_audit_routes -.->|"raises findings"| node_alerts
node_alerts -.->|"tracks recovery"| node_cases
node_auth_routes -->|"reads users"| node_domain_models
node_driver_routes -->|"reads and writes"| node_domain_models
node_driver_routes -->|"uses schemas"| node_schemas
node_backend_entry -->|"configures"| node_database
node_domain_models -->|"declares ORM models"| node_database

click node_manager_ui "https://github.com/rithick-srm/revrouteai-v1/blob/master/frontend/src/App.jsx"
click node_manager_api "https://github.com/rithick-srm/revrouteai-v1/blob/master/frontend/src/services/api.js"
click node_manager_ops "https://github.com/rithick-srm/revrouteai-v1/tree/master/frontend/src/pages"
click node_manager_audit "https://github.com/rithick-srm/revrouteai-v1/tree/master/frontend/src/pages"
click node_driver_ui "https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/navigation/AppNavigator.js"
click node_driver_auth "https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/context/AuthContext.js"
click node_driver_api "https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/services/api.js"
click node_driver_submissions "https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/screens/fuel/FuelOCRReviewScreen.js"
click node_backend_entry "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/main.py"
click node_auth_routes "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/auth.py"
click node_driver_routes "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/driver_portal.py"
click node_record_routes "https://github.com/rithick-srm/revrouteai-v1/tree/master/backend/app/routes"
click node_document_routes "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/documents.py"
click node_document_processor "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/services/document_processor.py"
click node_audit_routes "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/audits.py"
click node_audit_services "https://github.com/rithick-srm/revrouteai-v1/tree/master/backend/app/services"
click node_alerts "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/alerts.py"
click node_cases "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/action_cases.py"
click node_assistant "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/services/assistant_service.py"
click node_domain_models "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/models/domain.py"
click node_schemas "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/schemas/schemas.py"
click node_database "https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/database/session.py"

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_manager_ui,node_manager_api,node_manager_ops,node_manager_audit toneBlue
class node_driver_ui,node_driver_auth,node_driver_api,node_driver_submissions toneAmber
class node_backend_entry,node_auth_routes,node_driver_routes,node_record_routes,node_document_routes,node_document_processor toneMint
class node_audit_routes,node_audit_services,node_alerts,node_cases,node_assistant toneRose
class node_domain_models,node_schemas,node_database,node_manager_actor,node_driver_actor toneIndigo
```

## Components

### Manager Portal

- [Manager Workspace](https://github.com/rithick-srm/revrouteai-v1/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Manager API Client](https://github.com/rithick-srm/revrouteai-v1/blob/master/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Fleet Records](https://github.com/rithick-srm/revrouteai-v1/tree/master/frontend/src/pages): `frontend/src/pages`
- [Audit Views](https://github.com/rithick-srm/revrouteai-v1/tree/master/frontend/src/pages): `frontend/src/pages`

### Driver Portal

- [Driver App](https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/navigation/AppNavigator.js): `driver-app/src/navigation/AppNavigator.js`
- [Driver Identity](https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/context/AuthContext.js): `driver-app/src/context/AuthContext.js`
- [Driver API Client](https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/services/api.js): `driver-app/src/services/api.js`
- [Fuel And Repair](https://github.com/rithick-srm/revrouteai-v1/blob/master/driver-app/src/screens/fuel/FuelOCRReviewScreen.js): `driver-app/src/screens/fuel/FuelOCRReviewScreen.js`

### Backend API

- [API Application](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/main.py): `backend/app/main.py`
- [Authentication Routes](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/auth.py): `backend/app/routes/auth.py`
- [Driver Routes](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/driver_portal.py): `backend/app/routes/driver_portal.py`
- [Operational Routes](https://github.com/rithick-srm/revrouteai-v1/tree/master/backend/app/routes): `backend/app/routes`
- [Document Intake](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/documents.py): `backend/app/routes/documents.py`
- [OCR Extraction](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/services/document_processor.py): `backend/app/services/document_processor.py`

### Audit And Recovery

- [Audit Execution](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/audits.py): `backend/app/routes/audits.py`
- [Audit Rules](https://github.com/rithick-srm/revrouteai-v1/tree/master/backend/app/services): `backend/app/services`
- [Leakage Alerts](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/alerts.py): `backend/app/routes/alerts.py`
- [Recovery Cases](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/routes/action_cases.py): `backend/app/routes/action_cases.py`
- [Fleet Assistant](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/services/assistant_service.py): `backend/app/services/assistant_service.py`

### Domain And Storage

- [Domain Records](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/models/domain.py): `backend/app/models/domain.py`
- [API Schemas](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/schemas/schemas.py): `backend/app/schemas/schemas.py`
- [Relational Database](https://github.com/rithick-srm/revrouteai-v1/blob/master/backend/app/database/session.py): `backend/app/database/session.py`

### Other components

- **Fleet Manager**
- **Driver**

## Connections

- Fleet Manager → Manager Workspace: uses (evidence: `README.md`)
- Manager Workspace → Fleet Records: renders (evidence: `frontend/src/App.jsx`)
- Manager Workspace → Audit Views: renders (evidence: `frontend/src/App.jsx`)
- Fleet Records → Manager API Client: requests records (evidence: `frontend/src/services/api.js`)
- Audit Views → Manager API Client: requests audits (evidence: `frontend/src/services/api.js`)
- Manager API Client → API Application: calls API (evidence: `frontend/src/services/api.js`)
- Driver → Driver App: uses (evidence: `README.md`)
- Driver App → Driver Identity: provides identity (evidence: `driver-app/src/navigation/AppNavigator.js`)
- Driver Identity → Driver API Client: authenticates through (evidence: `driver-app/src/context/AuthContext.js`)
- Fuel And Repair → Driver API Client: submits entries (evidence: `driver-app/src/screens/fuel/FuelOCRReviewScreen.js`)
- Driver API Client → API Application: calls API (evidence: `driver-app/src/services/api.js`)
- API Application → Authentication Routes: registers (evidence: `backend/app/main.py`)
- API Application → Driver Routes: registers (evidence: `backend/app/main.py`)
- API Application → Operational Routes: registers (evidence: `backend/app/main.py`)
- API Application → Document Intake: registers (evidence: `backend/app/main.py`)
- API Application → Audit Execution: registers (evidence: `backend/app/main.py`)
- API Application → Leakage Alerts: registers (evidence: `backend/app/main.py`)
- API Application → Recovery Cases: registers (evidence: `backend/app/main.py`)
- API Application → Fleet Assistant: registers (evidence: `backend/app/main.py`)
- Driver Routes → OCR Extraction: uses for extraction (evidence: `backend/app/routes/driver_portal.py`)
- Document Intake → OCR Extraction: extracts documents
- Audit Execution → Audit Rules: executes rules
- Audit Execution → Leakage Alerts: raises findings
- Leakage Alerts → Recovery Cases: tracks recovery
- Authentication Routes → Domain Records: reads users (evidence: `backend/app/routes/auth.py`)
- Driver Routes → Domain Records: reads and writes (evidence: `backend/app/routes/driver_portal.py`)
- Driver Routes → API Schemas: uses schemas (evidence: `backend/app/routes/driver_portal.py`)
- API Application → Relational Database: configures (evidence: `backend/app/main.py`)
- Domain Records → Relational Database: declares ORM models (evidence: `backend/app/models/domain.py`)
