# rohith05012005/optiload architecture

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

- Interactive diagram: https://gitdiagram.com/rohith05012005/optiload
- Repository: https://github.com/rohith05012005/optiload

## Overview

OptiLoad 3D is a multi-modal logistics operations platform. Its principal workflow is to create and manage shipments, optimize cargo loading and routes, then monitor fleet activity and shipment risk. The README also describes air/sea optimizers, vision-based dimension scanning, forecasting, anomaly detection, a logistics copilot, and live telemetry. Edges below follow explicit imports/calls or README statements; some frontend integrations and unsampled features are shown only as documented capabilities.

Main entry points: [`backend/main.py`](https://github.com/rohith05012005/optiload/blob/main/backend/main.py) (FastAPI gateway), [`App.tsx`](https://github.com/rohith05012005/optiload/blob/main/App.tsx) (Web app), [`backend/database.py`](https://github.com/rohith05012005/optiload/blob/main/backend/database.py) (SQL database), [`backend/routers/ai_chat_router.py`](https://github.com/rohith05012005/optiload/blob/main/backend/routers/ai_chat_router.py) (Logistics copilot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Operations UI"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_booking["Shipment booking<br/>[BookService.tsx]"]
  node_dashboards["Operations dashboards<br/>[AdminDashboard.tsx]"]
  node_driver["Driver console"]
  node_loadui["Cargo optimizers<br/>[Optimizer.tsx]"]
  node_airsea["Air and sea tools<br/>[AirOptimizer.tsx]"]
  node_visionui["Dimension scanner"]
  node_authctx["Authentication state<br/>[AuthContext.tsx]"]
end

subgraph group_api["API and Data"]
  node_firestore["Operational data service"]
  node_firebase[("Firebase<br/>[firebase.ts]")]
  node_backend["FastAPI gateway<br/>[main.py]"]
  node_authroutes["Auth endpoints<br/>[auth_router.py]"]
  node_fleetship["Fleet and shipment endpoints"]
  node_db[("SQL database<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
end

subgraph group_ai["AI Services"]
  node_delay["Delay prediction<br/>[delay_model.py]"]
  node_anomaly["Anomaly detection"]
  node_demand["Demand forecasting<br/>[demand_lstm.py]"]
  node_vision["Cargo vision model<br/>[cargo_vision.py]"]
  node_chat["Logistics copilot<br/>[ai_chat_router.py]"]
  node_aiopt["AI route and packing"]
end

subgraph group_ops["Optimization and Tracking"]
  node_packing["3D packing engine<br/>[packer.ts]"]
  node_routing["Route planning<br/>[routing.ts]"]
  node_telemetry["Live telemetry"]
  node_remote["Presentation remote<br/>[server.py]"]
end

node_operator(("Logistics user"))

node_operator -->|"uses"| node_webapp
node_webapp -->|"opens"| node_booking
node_webapp -->|"routes to"| node_dashboards
node_webapp -->|"routes to"| node_driver
node_webapp -->|"routes to"| node_loadui
node_webapp -->|"routes to"| node_airsea
node_booking -->|"stores bookings"| node_firestore
node_dashboards -->|"reads and updates"| node_firestore
node_driver -->|"reads and updates"| node_firestore
node_firestore -->|"uses"| node_firebase
node_loadui -->|"calls"| node_packing
node_airsea -->|"calls"| node_packing
node_operator -.->|"scans cargo"| node_visionui
node_visionui -.->|"requests dimensions"| node_vision
node_operator -.->|"uses API"| node_backend
node_backend -->|"registers"| node_authroutes
node_backend -->|"registers"| node_fleetship
node_backend -->|"creates tables"| node_db
node_authroutes -->|"queries users"| node_db
node_fleetship -.->|"queries records"| node_db
node_models -->|"defines tables"| node_db
node_backend -->|"registers"| node_aiopt
node_backend -->|"registers"| node_chat
node_chat -->|"reads operations data"| node_db
node_chat -->|"invokes prediction"| node_delay
node_chat -->|"invokes forecast"| node_demand
node_aiopt -.->|"dispatches routing"| node_routing
node_aiopt -.->|"dispatches packing"| node_packing
node_backend -->|"registers"| node_telemetry
node_driver -.->|"sends GPS updates"| node_telemetry
node_dashboards -.->|"subscribes updates"| node_telemetry
node_operator -.->|"controls presentation"| node_remote
node_operator -.->|"plans routes"| node_routing
node_operator -.->|"monitors risk"| node_anomaly

click node_webapp "https://github.com/rohith05012005/optiload/blob/main/App.tsx"
click node_booking "https://github.com/rohith05012005/optiload/blob/main/pages/BookService.tsx"
click node_dashboards "https://github.com/rohith05012005/optiload/blob/main/pages/AdminDashboard.tsx"
click node_driver "https://github.com/rohith05012005/optiload/blob/main/pages/DriverDashboard.tsx"
click node_loadui "https://github.com/rohith05012005/optiload/blob/main/pages/Optimizer.tsx"
click node_airsea "https://github.com/rohith05012005/optiload/blob/main/pages/AirOptimizer.tsx"
click node_visionui "https://github.com/rohith05012005/optiload/blob/main/components/CameraDimensionScanner.tsx"
click node_authctx "https://github.com/rohith05012005/optiload/blob/main/contexts/AuthContext.tsx"
click node_firestore "https://github.com/rohith05012005/optiload/blob/main/services/firestoreService.ts"
click node_firebase "https://github.com/rohith05012005/optiload/blob/main/services/firebase.ts"
click node_backend "https://github.com/rohith05012005/optiload/blob/main/backend/main.py"
click node_authroutes "https://github.com/rohith05012005/optiload/blob/main/backend/routers/auth_router.py"
click node_fleetship "https://github.com/rohith05012005/optiload/blob/main/backend/routers/shipments_router.py"
click node_db "https://github.com/rohith05012005/optiload/blob/main/backend/database.py"
click node_models "https://github.com/rohith05012005/optiload/blob/main/backend/models.py"
click node_packing "https://github.com/rohith05012005/optiload/blob/main/services/packer.ts"
click node_routing "https://github.com/rohith05012005/optiload/blob/main/services/routing.ts"
click node_telemetry "https://github.com/rohith05012005/optiload/blob/main/backend/routers/telemetry_router.py"
click node_delay "https://github.com/rohith05012005/optiload/blob/main/ml/models/delay_model.py"
click node_anomaly "https://github.com/rohith05012005/optiload/blob/main/ml/models/anomaly_detector.py"
click node_demand "https://github.com/rohith05012005/optiload/blob/main/ml/models/demand_lstm.py"
click node_vision "https://github.com/rohith05012005/optiload/blob/main/ml/models/cargo_vision.py"
click node_chat "https://github.com/rohith05012005/optiload/blob/main/backend/routers/ai_chat_router.py"
click node_aiopt "https://github.com/rohith05012005/optiload/blob/main/backend/routers/ai_optimization_router.py"
click node_remote "https://github.com/rohith05012005/optiload/blob/main/presentation_remote/server.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_webapp,node_booking,node_dashboards,node_driver,node_loadui,node_airsea,node_visionui,node_authctx,node_operator toneBlue
class node_firestore,node_firebase,node_backend,node_authroutes,node_fleetship,node_db,node_models toneAmber
class node_delay,node_anomaly,node_demand,node_vision,node_chat,node_aiopt toneMint
class node_packing,node_routing,node_telemetry,node_remote toneRose
```

## Components

### Operations UI

- [Web app](https://github.com/rohith05012005/optiload/blob/main/App.tsx): `App.tsx`
- [Shipment booking](https://github.com/rohith05012005/optiload/blob/main/pages/BookService.tsx): `pages/BookService.tsx`
- [Operations dashboards](https://github.com/rohith05012005/optiload/blob/main/pages/AdminDashboard.tsx): `pages/AdminDashboard.tsx`
- [Driver console](https://github.com/rohith05012005/optiload/blob/main/pages/DriverDashboard.tsx): `pages/DriverDashboard.tsx`
- [Cargo optimizers](https://github.com/rohith05012005/optiload/blob/main/pages/Optimizer.tsx): `pages/Optimizer.tsx`
- [Air and sea tools](https://github.com/rohith05012005/optiload/blob/main/pages/AirOptimizer.tsx): `pages/AirOptimizer.tsx`
- [Dimension scanner](https://github.com/rohith05012005/optiload/blob/main/components/CameraDimensionScanner.tsx): `components/CameraDimensionScanner.tsx`
- [Authentication state](https://github.com/rohith05012005/optiload/blob/main/contexts/AuthContext.tsx): `contexts/AuthContext.tsx`

### API and Data

- [Operational data service](https://github.com/rohith05012005/optiload/blob/main/services/firestoreService.ts): `services/firestoreService.ts`
- [Firebase](https://github.com/rohith05012005/optiload/blob/main/services/firebase.ts): `services/firebase.ts`
- [FastAPI gateway](https://github.com/rohith05012005/optiload/blob/main/backend/main.py): `backend/main.py`
- [Auth endpoints](https://github.com/rohith05012005/optiload/blob/main/backend/routers/auth_router.py): `backend/routers/auth_router.py`
- [Fleet and shipment endpoints](https://github.com/rohith05012005/optiload/blob/main/backend/routers/shipments_router.py): `backend/routers/shipments_router.py`
- [SQL database](https://github.com/rohith05012005/optiload/blob/main/backend/database.py): `backend/database.py`
- [Domain records](https://github.com/rohith05012005/optiload/blob/main/backend/models.py): `backend/models.py`

### AI Services

- [Delay prediction](https://github.com/rohith05012005/optiload/blob/main/ml/models/delay_model.py): `ml/models/delay_model.py`
- [Anomaly detection](https://github.com/rohith05012005/optiload/blob/main/ml/models/anomaly_detector.py): `ml/models/anomaly_detector.py`
- [Demand forecasting](https://github.com/rohith05012005/optiload/blob/main/ml/models/demand_lstm.py): `ml/models/demand_lstm.py`
- [Cargo vision model](https://github.com/rohith05012005/optiload/blob/main/ml/models/cargo_vision.py): `ml/models/cargo_vision.py`
- [Logistics copilot](https://github.com/rohith05012005/optiload/blob/main/backend/routers/ai_chat_router.py): `backend/routers/ai_chat_router.py`
- [AI route and packing](https://github.com/rohith05012005/optiload/blob/main/backend/routers/ai_optimization_router.py): `backend/routers/ai_optimization_router.py`

### Optimization and Tracking

- [3D packing engine](https://github.com/rohith05012005/optiload/blob/main/services/packer.ts): `services/packer.ts`
- [Route planning](https://github.com/rohith05012005/optiload/blob/main/services/routing.ts): `services/routing.ts`
- [Live telemetry](https://github.com/rohith05012005/optiload/blob/main/backend/routers/telemetry_router.py): `backend/routers/telemetry_router.py`
- [Presentation remote](https://github.com/rohith05012005/optiload/blob/main/presentation_remote/server.py): `presentation_remote/server.py`

### Other components

- **Logistics user**

## Connections

- Logistics user → Web app: uses
- Web app → Shipment booking: opens (evidence: `App.tsx`)
- Web app → Operations dashboards: routes to (evidence: `App.tsx`)
- Web app → Driver console: routes to (evidence: `App.tsx`)
- Web app → Cargo optimizers: routes to (evidence: `App.tsx`)
- Web app → Air and sea tools: routes to (evidence: `App.tsx`)
- Shipment booking → Operational data service: stores bookings (evidence: `pages/BookService.tsx`)
- Operations dashboards → Operational data service: reads and updates (evidence: `pages/AdminDashboard.tsx`)
- Driver console → Operational data service: reads and updates (evidence: `pages/DriverDashboard.tsx`)
- Operational data service → Firebase: uses (evidence: `services/firestoreService.ts`)
- Cargo optimizers → 3D packing engine: calls (evidence: `pages/Optimizer.tsx`)
- Air and sea tools → 3D packing engine: calls (evidence: `pages/AirOptimizer.tsx`)
- Logistics user → Dimension scanner: scans cargo
- Dimension scanner → Cargo vision model: requests dimensions
- Logistics user → FastAPI gateway: uses API
- FastAPI gateway → Auth endpoints: registers (evidence: `backend/main.py`)
- FastAPI gateway → Fleet and shipment endpoints: registers (evidence: `backend/main.py`)
- FastAPI gateway → SQL database: creates tables (evidence: `backend/main.py`)
- Auth endpoints → SQL database: queries users (evidence: `backend/routers/auth_router.py`)
- Fleet and shipment endpoints → SQL database: queries records (evidence: `backend/routers/shipments_router.py`)
- Domain records → SQL database: defines tables (evidence: `backend/models.py`)
- FastAPI gateway → AI route and packing: registers (evidence: `backend/main.py`)
- FastAPI gateway → Logistics copilot: registers (evidence: `backend/main.py`)
- Logistics copilot → SQL database: reads operations data (evidence: `backend/routers/ai_chat_router.py`)
- Logistics copilot → Delay prediction: invokes prediction (evidence: `backend/routers/ai_chat_router.py`)
- Logistics copilot → Demand forecasting: invokes forecast (evidence: `backend/routers/ai_chat_router.py`)
- AI route and packing → Route planning: dispatches routing (evidence: `backend/routers/ai_optimization_router.py`)
- AI route and packing → 3D packing engine: dispatches packing (evidence: `backend/routers/ai_optimization_router.py`)
- FastAPI gateway → Live telemetry: registers (evidence: `backend/main.py`)
- Driver console → Live telemetry: sends GPS updates
- Operations dashboards → Live telemetry: subscribes updates
- Logistics user → Presentation remote: controls presentation
- Logistics user → Route planning: plans routes
- Logistics user → Anomaly detection: monitors risk
