# azmedia2006/quan-ly-doi-xe- architecture

> Architecture diagram of the GitHub repository azmedia2006/quan-ly-doi-xe-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azmedia2006/quan-ly-doi-xe-
- Repository: https://github.com/azmedia2006/quan-ly-doi-xe-

## Overview

FleetManage Pro is a fleet-management web application: staff sign in, use protected React screens to manage vehicles, drivers and trip dispatch, then record related expenses, maintenance and incidents; dashboards, reports and notifications expose operational results. The frontend calls a Django REST API, with domain records modeled in separate Django apps. The README documents PostgreSQL and operational monitoring/logging, but deployment files and those runtime integrations are absent from the supplied tree. Several domain screens and routes are visible in App.tsx but their implementation was not sampled, so their API connections are not asserted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/App.tsx) (App routing), [`frontend/src/services/api.ts`](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/services/api.ts) (API client), [`backend/apps/vehicles/models.py`](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/vehicles/models.py) (Vehicle records), [`backend/apps/fuel_expenses/models.py`](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/fuel_expenses/models.py) (Expense records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App routing<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Auth state<br/>[AuthContext.tsx]"]
  node_login["Sign in<br/>[LoginPage.tsx]"]
  node_users_ui["User administration<br/>[UsersPage.tsx]"]
  node_settings_ui["Settings<br/>[SettingsPage.tsx]"]
end

subgraph group_fleet["Fleet operations"]
  node_vehicles_ui["Vehicle screens<br/>[VehiclesPage.tsx]"]
  node_drivers_ui["Driver screens<br/>[DriversPage.tsx]"]
  node_schedules_ui["Trip scheduling<br/>[SchedulesPage.tsx]"]
  node_vehicles[("Vehicle records<br/>[models.py]")]
  node_drivers[("Driver records<br/>[models.py]")]
  node_schedules[("Trip records<br/>[models.py]")]
end

subgraph group_records["Operational records"]
  node_maintenance_ui["Maintenance screens"]
  node_expenses_ui["Expense screens<br/>[ExpensesPage.tsx]"]
  node_incidents_ui["Incident screens<br/>[IncidentsPage.tsx]"]
  node_notifications_ui["Notifications"]
  node_maintenance[("Maintenance records<br/>[models.py]")]
  node_expenses[("Expense records<br/>[models.py]")]
  node_incidents[("Incident records<br/>[models.py]")]
  node_notifications["Notification service<br/>[signals.py]"]
end

subgraph group_api["Backend API"]
  node_api_client["API client<br/>[api.ts]"]
  node_accounts_api["Accounts API<br/>[views.py]"]
end

node_staff(("Fleet staff"))
node_pg[("PostgreSQL")]

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_vehicles_ui
node_app -->|"routes to"| node_drivers_ui
node_app -->|"routes to"| node_schedules_ui
node_app -->|"routes to"| node_maintenance_ui
node_app -->|"routes to"| node_expenses_ui
node_app -->|"routes to"| node_incidents_ui
node_app -->|"routes to"| node_notifications_ui
node_app -->|"routes to"| node_users_ui
node_app -->|"routes to"| node_settings_ui
node_auth -->|"calls"| node_api_client
node_login -.->|"uses"| node_auth
node_vehicles_ui -.->|"uses"| node_api_client
node_drivers_ui -.->|"uses"| node_api_client
node_schedules_ui -.->|"uses"| node_api_client
node_maintenance_ui -.->|"uses"| node_api_client
node_expenses_ui -->|"calls"| node_api_client
node_incidents_ui -->|"calls"| node_api_client
node_settings_ui -->|"calls"| node_api_client
node_api_client -.->|"requests"| node_accounts_api
node_accounts_api -.->|"reads/writes"| node_pg
node_vehicles -.->|"persists"| node_pg
node_drivers -.->|"linked trips"| node_vehicles
node_schedules -->|"references"| node_vehicles
node_schedules -->|"assigns"| node_drivers
node_maintenance -->|"references"| node_vehicles
node_expenses -->|"references"| node_vehicles
node_expenses -->|"references"| node_drivers
node_expenses -->|"references"| node_schedules

click node_app "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/App.tsx"
click node_auth "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/context/AuthContext.tsx"
click node_login "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/LoginPage.tsx"
click node_api_client "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/services/api.ts"
click node_dashboard "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_reports "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_vehicles_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/VehiclesPage.tsx"
click node_drivers_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/DriversPage.tsx"
click node_schedules_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/SchedulesPage.tsx"
click node_maintenance_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/MaintenancePage.tsx"
click node_expenses_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/ExpensesPage.tsx"
click node_incidents_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/IncidentsPage.tsx"
click node_notifications_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/NotificationsPage.tsx"
click node_users_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/UsersPage.tsx"
click node_settings_ui "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_accounts_api "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/accounts/views.py"
click node_vehicles "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/vehicles/models.py"
click node_drivers "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/drivers/models.py"
click node_schedules "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/schedules/models.py"
click node_maintenance "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/maintenance/models.py"
click node_expenses "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/fuel_expenses/models.py"
click node_incidents "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/incidents/models.py"
click node_notifications "https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/notifications/signals.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_app,node_dashboard,node_reports toneBlue
class node_auth,node_login,node_users_ui,node_settings_ui,node_pg toneAmber
class node_vehicles_ui,node_drivers_ui,node_schedules_ui,node_vehicles,node_drivers,node_schedules toneMint
class node_maintenance_ui,node_expenses_ui,node_incidents_ui,node_notifications_ui,node_maintenance,node_expenses,node_incidents,node_notifications toneRose
class node_api_client,node_accounts_api,node_staff toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Reports](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/ReportsPage.tsx): `frontend/src/pages/ReportsPage.tsx`

### Identity and access

- [Auth state](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Sign in](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [User administration](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/UsersPage.tsx): `frontend/src/pages/UsersPage.tsx`
- [Settings](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`

### Fleet operations

- [Vehicle screens](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/VehiclesPage.tsx): `frontend/src/pages/VehiclesPage.tsx`
- [Driver screens](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/DriversPage.tsx): `frontend/src/pages/DriversPage.tsx`
- [Trip scheduling](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/SchedulesPage.tsx): `frontend/src/pages/SchedulesPage.tsx`
- [Vehicle records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/vehicles/models.py): `backend/apps/vehicles/models.py`
- [Driver records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/drivers/models.py): `backend/apps/drivers/models.py`
- [Trip records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/schedules/models.py): `backend/apps/schedules/models.py`

### Operational records

- [Maintenance screens](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/MaintenancePage.tsx): `frontend/src/pages/MaintenancePage.tsx`
- [Expense screens](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/ExpensesPage.tsx): `frontend/src/pages/ExpensesPage.tsx`
- [Incident screens](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/IncidentsPage.tsx): `frontend/src/pages/IncidentsPage.tsx`
- [Notifications](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/pages/NotificationsPage.tsx): `frontend/src/pages/NotificationsPage.tsx`
- [Maintenance records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/maintenance/models.py): `backend/apps/maintenance/models.py`
- [Expense records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/fuel_expenses/models.py): `backend/apps/fuel_expenses/models.py`
- [Incident records](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/incidents/models.py): `backend/apps/incidents/models.py`
- [Notification service](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/notifications/signals.py): `backend/apps/notifications/signals.py`

### Backend API

- [API client](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Accounts API](https://github.com/azmedia2006/quan-ly-doi-xe-/blob/main/backend/apps/accounts/views.py): `backend/apps/accounts/views.py`

### Other components

- **Fleet staff**
- **PostgreSQL**

## Connections

- Fleet staff → App routing: uses (evidence: `README.md`)
- App routing → Auth state: provides auth (evidence: `frontend/src/App.tsx`)
- App routing → Sign in: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Reports: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Vehicle screens: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Driver screens: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Trip scheduling: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Maintenance screens: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Expense screens: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Incident screens: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Notifications: routes to (evidence: `frontend/src/App.tsx`)
- App routing → User administration: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Settings: routes to (evidence: `frontend/src/App.tsx`)
- Auth state → API client: calls (evidence: `frontend/src/context/AuthContext.tsx`)
- Sign in → Auth state: uses
- Vehicle screens → API client: uses
- Driver screens → API client: uses
- Trip scheduling → API client: uses
- Maintenance screens → API client: uses
- Expense screens → API client: calls (evidence: `frontend/src/pages/ExpensesPage.tsx`)
- Incident screens → API client: calls (evidence: `frontend/src/pages/IncidentsPage.tsx`)
- Settings → API client: calls (evidence: `frontend/src/pages/SettingsPage.tsx`)
- API client → Accounts API: requests
- Accounts API → PostgreSQL: reads/writes
- Vehicle records → PostgreSQL: persists
- Driver records → Vehicle records: linked trips
- Trip records → Vehicle records: references (evidence: `backend/apps/schedules/models.py`)
- Trip records → Driver records: assigns (evidence: `backend/apps/schedules/models.py`)
- Maintenance records → Vehicle records: references (evidence: `backend/apps/maintenance/models.py`)
- Expense records → Vehicle records: references (evidence: `backend/apps/fuel_expenses/models.py`)
- Expense records → Driver records: references (evidence: `backend/apps/fuel_expenses/models.py`)
- Expense records → Trip records: references (evidence: `backend/apps/fuel_expenses/models.py`)
