# saroj-tech799/vehicle-management-system architecture

> Architecture diagram of the GitHub repository saroj-tech799/vehicle-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saroj-tech799/vehicle-management-system
- Repository: https://github.com/saroj-tech799/vehicle-management-system

## Overview

This is a browser-based fleet management system. Authenticated users enter through the routed application shell and manage vehicles, drivers, projects, assignments, transfers, daily logs, fuel, maintenance, expenses, fines, and LPO requests; reports provide financial and operational analysis. The shared API layer reads and writes Supabase data and maintains local persistence/extensions. Sampled source confirms several write paths and report reads; other page internals and some route-level interactions were not sampled, so their internal data wiring is not asserted.

Main entry points: [`src/App.tsx`](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/App.tsx) (Application router), [`src/lib/api.ts`](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/api.ts) (Data API and cache), [`src/lib/supabase.ts`](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/supabase.ts) (Supabase client), [`src/pages/LPORequests.tsx`](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/LPORequests.tsx) (LPO requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Shell"]
  node_app["Application router<br/>[App.tsx]"]
  node_login["Sign-in<br/>[Login.tsx]"]
  node_layout["Navigation shell<br/>[Layout.tsx]"]
end

subgraph group_fleet["Fleet and Projects"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_vehicles["Vehicles and drivers<br/>[Vehicles.tsx]"]
  node_projects["Projects<br/>[Projects.tsx]"]
  node_import["Spreadsheet import"]
  node_dedup["Project reconciliation"]
end

subgraph group_operations["Fleet Operations"]
  node_assignments["Assignments<br/>[Assignments.tsx]"]
  node_transfers["Transfers<br/>[Transfers.tsx]"]
  node_logs["Daily logs<br/>[DailyLogs.tsx]"]
  node_fuel["Fuel records<br/>[Fuel.tsx]"]
  node_maintenance["Maintenance<br/>[Maintenance.tsx]"]
  node_expenses["Expenses<br/>[Expenses.tsx]"]
  node_fines["Traffic fines<br/>[TrafficFines.tsx]"]
end

subgraph group_insight["Reports and LPO"]
  node_lpo["LPO requests<br/>[LPORequests.tsx]"]
  node_reports["Financial reports<br/>[Reports.tsx]"]
  node_lpoexport["LPO document export<br/>[lpoExport.ts]"]
end

subgraph group_data["Persistence"]
  node_api["Data API and cache<br/>[api.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
  node_supabase[("Supabase")]
  node_browserstore[("Browser local storage")]
end

node_user(("Fleet user"))

node_user -->|"opens"| node_app
node_app -->|"routes unauthenticated"| node_login
node_app -->|"renders authenticated shell"| node_layout
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_vehicles
node_app -->|"routes"| node_assignments
node_app -->|"routes"| node_transfers
node_app -->|"routes"| node_logs
node_app -->|"routes"| node_fuel
node_app -->|"routes"| node_maintenance
node_app -->|"routes"| node_expenses
node_app -->|"routes"| node_fines
node_app -->|"routes"| node_lpo
node_app -->|"routes"| node_reports
node_app -->|"checks session"| node_supabaseclient
node_layout -->|"reads session and signs out"| node_supabaseclient
node_vehicles -->|"creates and updates records"| node_api
node_lpo -->|"updates requests"| node_api
node_reports -->|"fetches report data"| node_api
node_import -->|"creates imported records"| node_api
node_dedup -->|"reads and reconciles records"| node_api
node_lpo -.->|"exports documents"| node_lpoexport
node_api -->|"uses client"| node_supabaseclient
node_supabaseclient -->|"auth and data access"| node_supabase
node_api -->|"caches and persists extensions"| node_browserstore

click node_app "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/App.tsx"
click node_login "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Login.tsx"
click node_layout "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/components/Layout.tsx"
click node_dashboard "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Dashboard.tsx"
click node_vehicles "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Vehicles.tsx"
click node_projects "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Projects.tsx"
click node_assignments "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Assignments.tsx"
click node_transfers "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Transfers.tsx"
click node_logs "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/DailyLogs.tsx"
click node_fuel "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Fuel.tsx"
click node_maintenance "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Maintenance.tsx"
click node_expenses "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Expenses.tsx"
click node_fines "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/TrafficFines.tsx"
click node_lpo "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/LPORequests.tsx"
click node_reports "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Reports.tsx"
click node_lpoexport "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/utils/lpoExport.ts"
click node_import "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/components/ui/ExcelImportButton.tsx"
click node_dedup "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/projectDeduplication.ts"
click node_api "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/api.ts"
click node_supabaseclient "https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/supabase.ts"

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_login,node_layout,node_user toneBlue
class node_dashboard,node_vehicles,node_projects,node_import,node_dedup toneAmber
class node_assignments,node_transfers,node_logs,node_fuel,node_maintenance,node_expenses,node_fines toneMint
class node_lpo,node_reports,node_lpoexport toneRose
class node_api,node_supabaseclient,node_supabase,node_browserstore toneIndigo
```

## Components

### Access and Shell

- [Application router](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Login.tsx): `src/pages/Login.tsx`
- [Navigation shell](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/components/Layout.tsx): `src/components/Layout.tsx`

### Fleet and Projects

- [Dashboard](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Vehicles and drivers](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Vehicles.tsx): `src/pages/Vehicles.tsx`
- [Projects](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Projects.tsx): `src/pages/Projects.tsx`
- [Spreadsheet import](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/components/ui/ExcelImportButton.tsx): `src/components/ui/ExcelImportButton.tsx`
- [Project reconciliation](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/projectDeduplication.ts): `src/lib/projectDeduplication.ts`

### Fleet Operations

- [Assignments](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Assignments.tsx): `src/pages/Assignments.tsx`
- [Transfers](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Transfers.tsx): `src/pages/Transfers.tsx`
- [Daily logs](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/DailyLogs.tsx): `src/pages/DailyLogs.tsx`
- [Fuel records](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Fuel.tsx): `src/pages/Fuel.tsx`
- [Maintenance](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Maintenance.tsx): `src/pages/Maintenance.tsx`
- [Expenses](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Expenses.tsx): `src/pages/Expenses.tsx`
- [Traffic fines](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/TrafficFines.tsx): `src/pages/TrafficFines.tsx`

### Reports and LPO

- [LPO requests](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/LPORequests.tsx): `src/pages/LPORequests.tsx`
- [Financial reports](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [LPO document export](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/utils/lpoExport.ts): `src/utils/lpoExport.ts`

### Persistence

- [Data API and cache](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Supabase client](https://github.com/saroj-tech799/vehicle-management-system/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase**
- **Browser local storage**

### Other components

- **Fleet user**

## Connections

- Fleet user → Application router: opens
- Application router → Sign-in: routes unauthenticated
- Application router → Navigation shell: renders authenticated shell
- Application router → Dashboard: routes
- Application router → Vehicles and drivers: routes
- Application router → Assignments: routes
- Application router → Transfers: routes
- Application router → Daily logs: routes
- Application router → Fuel records: routes
- Application router → Maintenance: routes
- Application router → Expenses: routes
- Application router → Traffic fines: routes
- Application router → LPO requests: routes
- Application router → Financial reports: routes
- Application router → Supabase client: checks session
- Navigation shell → Supabase client: reads session and signs out
- Vehicles and drivers → Data API and cache: creates and updates records
- LPO requests → Data API and cache: updates requests
- Financial reports → Data API and cache: fetches report data
- Spreadsheet import → Data API and cache: creates imported records
- Project reconciliation → Data API and cache: reads and reconciles records
- LPO requests → LPO document export: exports documents
- Data API and cache → Supabase client: uses client
- Supabase client → Supabase: auth and data access
- Data API and cache → Browser local storage: caches and persists extensions
