# mcchukwu/fleet-tracking-web architecture

> Architecture diagram of the GitHub repository mcchukwu/fleet-tracking-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcchukwu/fleet-tracking-web
- Repository: https://github.com/mcchukwu/fleet-tracking-web

## Overview

Fleet Tracking Web is a map-first fleet operations console. Dispatchers and other signed-in users enter through routed, role-guarded pages; feature screens combine API-backed records with live vehicle state and map views. The main domain areas include fleet monitoring, playback, alerts, trips, geofences, drivers, imports, reports, audit, and system health. The README documents the API, live socket, map-adapter, offline-cache, and PWA boundaries; unsampled feature internals are represented at their page level.

Main entry points: [`src/api/client.ts`](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/api/client.ts) (API and query state), [`src/features/shell/components/AppShell.tsx`](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/shell/components/AppShell.tsx) (App shell), [`src/features/map/components/MapPage.tsx`](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/map/components/MapPage.tsx) (Live fleet map), [`src/app/router.tsx`](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/app/router.tsx) (Route guards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_router["Route guards<br/>[router.tsx]"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_login["Sign in<br/>[LoginPage.tsx]"]
end

subgraph group_domain["Fleet operations"]
  node_monitor["Live fleet map<br/>[MapPage.tsx]"]
  node_playback["Trip playback<br/>[PlaybackPage.tsx]"]
  node_alerts["Alerts<br/>[AlertsPage.tsx]"]
  node_trips["Trips<br/>[TripsPage.tsx]"]
  node_geofences["Geofences<br/>[GeofencesPage.tsx]"]
  node_drivers["Drivers<br/>[DriversPage.tsx]"]
  node_imports["Data import<br/>[ImportPage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
  node_audit["Audit log<br/>[AuditPage.tsx]"]
  node_system["System health<br/>[SystemPage.tsx]"]
end

subgraph group_data["Data and live state"]
  node_auth["Session and roles<br/>[AuthProvider.tsx]"]
  node_query["API and query state<br/>[client.ts]"]
  node_live["Live state<br/>[live.ts]"]
  node_socket["Live socket<br/>[LiveProvider.tsx]"]
end

subgraph group_mapping["Maps and offline"]
  node_mapadapter["Map adapter<br/>[types.ts]"]
  node_maplibre["MapLibre provider<br/>[index.ts]"]
  node_offline[("Offline persistence<br/>[persistedCache.ts]")]
  node_pwa["PWA support<br/>[register.ts]"]
end

subgraph group_support["Shared experience"]
  node_errors["Error handling<br/>[normalize.ts]"]
  node_styleguide["Style guide<br/>[StyleGuidePage.tsx]"]
  node_frame["Page layout<br/>[PageFrame.tsx]"]
  node_toast["Toast notifications<br/>[Toast.tsx]"]
end

node_dispatcher(("Fleet user"))
node_api["Fleet API"]
node_websocket["Fleet WebSocket"]

node_dispatcher -->|"opens console"| node_router
node_router -->|"routes unauthenticated"| node_login
node_router -->|"routes signed-in"| node_shell
node_shell -->|"hosts feature pages"| node_monitor
node_shell -->|"hosts style guide"| node_styleguide
node_login -->|"authenticates"| node_auth
node_monitor -->|"queries server state"| node_query
node_playback -->|"queries server state"| node_query
node_alerts -->|"queries server state"| node_query
node_trips -->|"queries server state"| node_query
node_geofences -->|"queries server state"| node_query
node_drivers -->|"queries server state"| node_query
node_imports -->|"uses API data"| node_query
node_reports -->|"queries server state"| node_query
node_audit -->|"queries server state"| node_query
node_system -->|"queries server state"| node_query
node_query -->|"requests"| node_api
node_monitor -->|"reads live positions"| node_live
node_socket -->|"updates positions"| node_live
node_socket -->|"connects"| node_websocket
node_monitor -->|"renders map"| node_mapadapter
node_playback -->|"renders playback map"| node_mapadapter
node_mapadapter -->|"uses provider"| node_maplibre
node_query -->|"persists queries"| node_offline
node_pwa -->|"enables offline cache"| node_offline
node_maplibre -->|"caches PMTiles ranges"| node_offline
node_query -->|"normalizes failures"| node_errors
node_shell -->|"frames pages"| node_frame
node_shell -->|"provides notifications"| node_toast

click node_router "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/app/router.tsx"
click node_shell "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/shell/components/AppShell.tsx"
click node_login "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/login/components/LoginPage.tsx"
click node_monitor "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/map/components/MapPage.tsx"
click node_playback "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/playback/components/PlaybackPage.tsx"
click node_alerts "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/alerts/components/AlertsPage.tsx"
click node_trips "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/trips/components/TripsPage.tsx"
click node_geofences "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/geofences/components/GeofencesPage.tsx"
click node_drivers "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/drivers/components/DriversPage.tsx"
click node_imports "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/import/components/ImportPage.tsx"
click node_reports "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/reports/components/ReportsPage.tsx"
click node_audit "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/audit/components/AuditPage.tsx"
click node_system "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/system/components/SystemPage.tsx"
click node_auth "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/auth/AuthProvider.tsx"
click node_query "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/api/client.ts"
click node_live "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/stores/live.ts"
click node_socket "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/live/LiveProvider.tsx"
click node_mapadapter "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/map/types.ts"
click node_maplibre "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/map/providers/maplibre/index.ts"
click node_offline "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/api/persistedCache.ts"
click node_pwa "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/pwa/register.ts"
click node_errors "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/errors/normalize.ts"
click node_styleguide "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/styleguide/StyleGuidePage.tsx"
click node_frame "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/ui/PageFrame.tsx"
click node_toast "https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/ui/Toast.tsx"

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_router,node_shell,node_login,node_dispatcher toneBlue
class node_monitor,node_playback,node_alerts,node_trips,node_geofences,node_drivers,node_imports,node_reports,node_audit,node_system toneAmber
class node_auth,node_query,node_live,node_socket,node_api toneMint
class node_mapadapter,node_maplibre,node_offline,node_pwa toneRose
class node_errors,node_styleguide,node_frame,node_toast,node_websocket toneIndigo
```

## Components

### Application shell

- [Route guards](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/app/router.tsx): `src/app/router.tsx`
- [App shell](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/shell/components/AppShell.tsx): `src/features/shell/components/AppShell.tsx`
- [Sign in](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/login/components/LoginPage.tsx): `src/features/login/components/LoginPage.tsx`

### Fleet operations

- [Live fleet map](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/map/components/MapPage.tsx): `src/features/map/components/MapPage.tsx`
- [Trip playback](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/playback/components/PlaybackPage.tsx): `src/features/playback/components/PlaybackPage.tsx`
- [Alerts](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/alerts/components/AlertsPage.tsx): `src/features/alerts/components/AlertsPage.tsx`
- [Trips](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/trips/components/TripsPage.tsx): `src/features/trips/components/TripsPage.tsx`
- [Geofences](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/geofences/components/GeofencesPage.tsx): `src/features/geofences/components/GeofencesPage.tsx`
- [Drivers](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/drivers/components/DriversPage.tsx): `src/features/drivers/components/DriversPage.tsx`
- [Data import](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/import/components/ImportPage.tsx): `src/features/import/components/ImportPage.tsx`
- [Reports](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/reports/components/ReportsPage.tsx): `src/features/reports/components/ReportsPage.tsx`
- [Audit log](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/audit/components/AuditPage.tsx): `src/features/audit/components/AuditPage.tsx`
- [System health](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/system/components/SystemPage.tsx): `src/features/system/components/SystemPage.tsx`

### Data and live state

- [Session and roles](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/auth/AuthProvider.tsx): `src/auth/AuthProvider.tsx`
- [API and query state](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/api/client.ts): `src/api/client.ts`
- [Live state](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/stores/live.ts): `src/stores/live.ts`
- [Live socket](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/live/LiveProvider.tsx): `src/live/LiveProvider.tsx`

### Maps and offline

- [Map adapter](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/map/types.ts): `src/map/types.ts`
- [MapLibre provider](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/map/providers/maplibre/index.ts): `src/map/providers/maplibre/index.ts`
- [Offline persistence](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/api/persistedCache.ts): `src/api/persistedCache.ts`
- [PWA support](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/pwa/register.ts): `src/pwa/register.ts`

### Shared experience

- [Error handling](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/errors/normalize.ts): `src/errors/normalize.ts`
- [Style guide](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/features/styleguide/StyleGuidePage.tsx): `src/features/styleguide/StyleGuidePage.tsx`
- [Page layout](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/ui/PageFrame.tsx): `src/ui/PageFrame.tsx`
- [Toast notifications](https://github.com/mcchukwu/fleet-tracking-web/blob/main/src/ui/Toast.tsx): `src/ui/Toast.tsx`

### Other components

- **Fleet user**
- **Fleet API**
- **Fleet WebSocket**

## Connections

- Fleet user → Route guards: opens console (evidence: `README.md`)
- Route guards → Sign in: routes unauthenticated (evidence: `src/app/router.tsx`)
- Route guards → App shell: routes signed-in (evidence: `README.md`)
- App shell → Live fleet map: hosts feature pages (evidence: `README.md`)
- App shell → Style guide: hosts style guide (evidence: `README.md`)
- Sign in → Session and roles: authenticates (evidence: `src/auth/AuthProvider.tsx`)
- Live fleet map → API and query state: queries server state (evidence: `README.md`)
- Trip playback → API and query state: queries server state (evidence: `README.md`)
- Alerts → API and query state: queries server state (evidence: `README.md`)
- Trips → API and query state: queries server state (evidence: `README.md`)
- Geofences → API and query state: queries server state (evidence: `README.md`)
- Drivers → API and query state: queries server state (evidence: `README.md`)
- Data import → API and query state: uses API data (evidence: `README.md`)
- Reports → API and query state: queries server state (evidence: `README.md`)
- Audit log → API and query state: queries server state (evidence: `README.md`)
- System health → API and query state: queries server state (evidence: `README.md`)
- API and query state → Fleet API: requests (evidence: `README.md`)
- Live fleet map → Live state: reads live positions (evidence: `README.md`)
- Live socket → Live state: updates positions (evidence: `README.md`)
- Live socket → Fleet WebSocket: connects (evidence: `README.md`)
- Live fleet map → Map adapter: renders map (evidence: `README.md`)
- Trip playback → Map adapter: renders playback map (evidence: `README.md`)
- Map adapter → MapLibre provider: uses provider (evidence: `README.md`)
- API and query state → Offline persistence: persists queries (evidence: `README.md`)
- PWA support → Offline persistence: enables offline cache (evidence: `README.md`)
- MapLibre provider → Offline persistence: caches PMTiles ranges (evidence: `README.md`)
- API and query state → Error handling: normalizes failures (evidence: `src/api/client.ts`)
- App shell → Page layout: frames pages (evidence: `src/app/router.tsx`)
- App shell → Toast notifications: provides notifications
