# tandah-marcelle/gps_tracker_front architecture

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

- Interactive diagram: https://gitdiagram.com/tandah-marcelle/gps_tracker_front
- Repository: https://github.com/tandah-marcelle/gps_tracker_front

## Overview

Camtrack is a React frontend for GPS tracker inventory and installation management, with separate stock-manager and technician workflows. Users authenticate through login or registration with OTP verification; role-guarded routing then presents managers with dashboard and resource-management screens, while technicians view and complete assigned interventions. The screens call a separate REST backend through typed resource APIs and a shared Axios client; this frontend does not access a database. The graph follows explicit imports and documented behavior; unsampled vehicle, dashboard, and auth API details are summarized at their source paths.

Main entry points: [`src/App.tsx`](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/App.tsx) (Role-based routes), [`src/api/axios.ts`](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/axios.ts) (Shared Axios client), [`src/pages/Interventions.tsx`](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Interventions.tsx) (Intervention scheduling), [`src/context/AuthContext.tsx`](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/context/AuthContext.tsx) (Auth state & OTP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; routing"]
  node_login["Login<br/>[Login.tsx]"]
  node_register["Register<br/>[Register.tsx]"]
  node_auth["Auth state &amp; OTP<br/>[AuthContext.tsx]"]
  node_routing["Role-based routes<br/>[App.tsx]"]
  node_guard["Auth &amp; role guard<br/>[ProtectedRoute.tsx]"]
  node_layout["App shell<br/>[AppLayout.tsx]"]
end

subgraph group_operations["Inventory management"]
  node_dashboard["Stock dashboard<br/>[Dashboard.tsx]"]
  node_trackers["Tracker inventory<br/>[Trackers.tsx]"]
  node_tracker_forms["Tracker actions &amp; history"]
  node_tracker_rules["Status transitions<br/>[trackers.ts]"]
  node_clients["Client management<br/>[Clients.tsx]"]
  node_client_form["Client form"]
  node_vehicles["Vehicle management<br/>[Vehicles.tsx]"]
  node_vehicle_form["Vehicle form"]
end

subgraph group_field["Installation workflow"]
  node_manager_interventions["Intervention scheduling<br/>[Interventions.tsx]"]
  node_intervention_form["Intervention form"]
  node_my_interventions["Assigned interventions"]
  node_completion["Intervention completion"]
end

subgraph group_transport["REST integration"]
  node_api_auth["Auth API<br/>[auth.ts]"]
  node_api_dashboard["Dashboard API<br/>[dashboard.ts]"]
  node_api_clients["Clients API<br/>[clients.ts]"]
  node_api_vehicles["Vehicles API<br/>[vehicles.ts]"]
  node_api_trackers["Trackers API<br/>[trackers.ts]"]
  node_api_interventions["Interventions API<br/>[interventions.ts]"]
  node_http_client["Shared Axios client<br/>[axios.ts]"]
end

subgraph group_shared["Shared presentation"]
  node_status_badge["Status badge<br/>[StatusBadge.tsx]"]
  node_debounce["Debounced search"]
  node_ui["UI primitives"]
  node_auth_shell["Auth page shell<br/>[AuthShell.tsx]"]
end

node_user(("Manager or technician"))
node_http{{"Camtrack REST backend"}}

node_user -->|"enters credentials"| node_login
node_user -->|"creates account"| node_register
node_login -->|"requests login and verifies OTP"| node_auth
node_register -->|"registers and verifies OTP"| node_auth
node_auth -->|"calls auth methods"| node_api_auth
node_routing -->|"reads auth state"| node_auth
node_routing -->|"wraps protected screens"| node_guard
node_guard -->|"checks user and role"| node_auth
node_routing -->|"routes to"| node_login
node_routing -->|"routes to"| node_register
node_routing -->|"routes managers to"| node_dashboard
node_routing -->|"routes managers to"| node_trackers
node_routing -->|"routes managers to"| node_clients
node_routing -->|"routes managers to"| node_vehicles
node_routing -->|"routes managers to"| node_manager_interventions
node_routing -->|"routes technicians to"| node_my_interventions
node_routing -->|"wraps protected screens"| node_layout
node_login -->|"renders"| node_auth_shell
node_register -->|"renders"| node_auth_shell
node_dashboard -->|"fetches metrics"| node_api_dashboard
node_trackers -->|"loads and mutates trackers"| node_api_trackers
node_trackers -->|"opens tracker actions"| node_tracker_forms
node_tracker_forms -->|"reads and updates trackers"| node_api_trackers
node_tracker_forms -->|"checks allowed transitions"| node_tracker_rules
node_tracker_forms -->|"renders status"| node_status_badge
node_clients -->|"loads and deletes clients"| node_api_clients
node_clients -->|"opens create or edit"| node_client_form
node_client_form -->|"creates or updates"| node_api_clients
node_vehicles -->|"manages vehicles"| node_api_vehicles
node_vehicles -->|"loads client choices"| node_api_clients
node_vehicles -->|"opens vehicle form"| node_vehicle_form
node_vehicle_form -->|"creates or updates"| node_api_vehicles
node_manager_interventions -->|"loads and schedules"| node_api_interventions
node_manager_interventions -->|"loads client choices"| node_api_clients
node_manager_interventions -->|"loads vehicle choices"| node_api_vehicles
node_manager_interventions -->|"opens scheduler"| node_intervention_form
node_intervention_form -->|"creates intervention"| node_api_interventions
node_my_interventions -->|"loads assignments"| node_api_interventions
node_my_interventions -->|"opens completion flow"| node_completion
node_completion -->|"completes intervention"| node_api_interventions
node_completion -->|"loads available trackers"| node_api_trackers
node_api_auth -->|"sends requests through"| node_http_client
node_api_dashboard -->|"sends requests through"| node_http_client
node_api_clients -->|"sends requests through"| node_http_client
node_api_vehicles -->|"sends requests through"| node_http_client
node_api_trackers -->|"sends requests through"| node_http_client
node_api_interventions -->|"sends requests through"| node_http_client
node_http_client -.->|"calls REST endpoints"| node_http

click node_login "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Login.tsx"
click node_register "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Register.tsx"
click node_auth "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/context/AuthContext.tsx"
click node_routing "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/App.tsx"
click node_guard "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/ProtectedRoute.tsx"
click node_layout "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/AppLayout.tsx"
click node_dashboard "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Dashboard.tsx"
click node_trackers "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Trackers.tsx"
click node_tracker_forms "https://github.com/tandah-marcelle/gps_tracker_front/tree/main/src/components/trackers"
click node_tracker_rules "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/lib/trackers.ts"
click node_clients "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Clients.tsx"
click node_client_form "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/clients/ClientFormModal.tsx"
click node_vehicles "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Vehicles.tsx"
click node_vehicle_form "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/vehicles/VehicleFormModal.tsx"
click node_manager_interventions "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Interventions.tsx"
click node_intervention_form "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/interventions/InterventionFormModal.tsx"
click node_my_interventions "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/MyInterventions.tsx"
click node_completion "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/interventions/CompleteInterventionModal.tsx"
click node_api_auth "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/auth.ts"
click node_api_dashboard "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/dashboard.ts"
click node_api_clients "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/clients.ts"
click node_api_vehicles "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/vehicles.ts"
click node_api_trackers "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/trackers.ts"
click node_api_interventions "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/interventions.ts"
click node_http_client "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/axios.ts"
click node_status_badge "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/StatusBadge.tsx"
click node_debounce "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/hooks/useDebouncedValue.ts"
click node_ui "https://github.com/tandah-marcelle/gps_tracker_front/tree/main/src/components/ui"
click node_auth_shell "https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/auth/AuthShell.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_login,node_register,node_auth,node_routing,node_guard,node_layout toneBlue
class node_dashboard,node_trackers,node_tracker_forms,node_tracker_rules,node_clients,node_client_form,node_vehicles,node_vehicle_form toneAmber
class node_manager_interventions,node_intervention_form,node_my_interventions,node_completion toneMint
class node_api_auth,node_api_dashboard,node_api_clients,node_api_vehicles,node_api_trackers,node_api_interventions,node_http_client toneRose
class node_status_badge,node_debounce,node_ui,node_auth_shell,node_user,node_http toneIndigo
```

## Components

### Access & routing

- [Login](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Login.tsx): `src/pages/Login.tsx`
- [Register](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Register.tsx): `src/pages/Register.tsx`
- [Auth state & OTP](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Role-based routes](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/App.tsx): `src/App.tsx`
- [Auth & role guard](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/ProtectedRoute.tsx): `src/components/ProtectedRoute.tsx`
- [App shell](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/AppLayout.tsx): `src/components/AppLayout.tsx`

### Inventory management

- [Stock dashboard](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Tracker inventory](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Trackers.tsx): `src/pages/Trackers.tsx`
- [Tracker actions & history](https://github.com/tandah-marcelle/gps_tracker_front/tree/main/src/components/trackers): `src/components/trackers`
- [Status transitions](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/lib/trackers.ts): `src/lib/trackers.ts`
- [Client management](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Clients.tsx): `src/pages/Clients.tsx`
- [Client form](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/clients/ClientFormModal.tsx): `src/components/clients/ClientFormModal.tsx`
- [Vehicle management](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Vehicles.tsx): `src/pages/Vehicles.tsx`
- [Vehicle form](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/vehicles/VehicleFormModal.tsx): `src/components/vehicles/VehicleFormModal.tsx`

### Installation workflow

- [Intervention scheduling](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/Interventions.tsx): `src/pages/Interventions.tsx`
- [Intervention form](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/interventions/InterventionFormModal.tsx): `src/components/interventions/InterventionFormModal.tsx`
- [Assigned interventions](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/pages/MyInterventions.tsx): `src/pages/MyInterventions.tsx`
- [Intervention completion](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/interventions/CompleteInterventionModal.tsx): `src/components/interventions/CompleteInterventionModal.tsx`

### REST integration

- [Auth API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/auth.ts): `src/api/auth.ts`
- [Dashboard API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/dashboard.ts): `src/api/dashboard.ts`
- [Clients API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/clients.ts): `src/api/clients.ts`
- [Vehicles API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/vehicles.ts): `src/api/vehicles.ts`
- [Trackers API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/trackers.ts): `src/api/trackers.ts`
- [Interventions API](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/interventions.ts): `src/api/interventions.ts`
- [Shared Axios client](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/api/axios.ts): `src/api/axios.ts`

### Shared presentation

- [Status badge](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/StatusBadge.tsx): `src/components/StatusBadge.tsx`
- [Debounced search](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/hooks/useDebouncedValue.ts): `src/hooks/useDebouncedValue.ts`
- [UI primitives](https://github.com/tandah-marcelle/gps_tracker_front/tree/main/src/components/ui): `src/components/ui`
- [Auth page shell](https://github.com/tandah-marcelle/gps_tracker_front/blob/main/src/components/auth/AuthShell.tsx): `src/components/auth/AuthShell.tsx`

### Other components

- **Manager or technician**
- **Camtrack REST backend**

## Connections

- Manager or technician → Login: enters credentials (evidence: `README.md`)
- Manager or technician → Register: creates account (evidence: `README.md`)
- Login → Auth state & OTP: requests login and verifies OTP (evidence: `src/pages/Login.tsx`)
- Register → Auth state & OTP: registers and verifies OTP (evidence: `src/pages/Register.tsx`)
- Auth state & OTP → Auth API: calls auth methods (evidence: `src/context/AuthContext.tsx`)
- Role-based routes → Auth state & OTP: reads auth state (evidence: `src/App.tsx`)
- Role-based routes → Auth & role guard: wraps protected screens (evidence: `src/App.tsx`)
- Auth & role guard → Auth state & OTP: checks user and role (evidence: `src/components/ProtectedRoute.tsx`)
- Role-based routes → Login: routes to (evidence: `src/App.tsx`)
- Role-based routes → Register: routes to (evidence: `src/App.tsx`)
- Role-based routes → Stock dashboard: routes managers to (evidence: `src/App.tsx`)
- Role-based routes → Tracker inventory: routes managers to (evidence: `src/App.tsx`)
- Role-based routes → Client management: routes managers to (evidence: `src/App.tsx`)
- Role-based routes → Vehicle management: routes managers to (evidence: `src/App.tsx`)
- Role-based routes → Intervention scheduling: routes managers to (evidence: `src/App.tsx`)
- Role-based routes → Assigned interventions: routes technicians to (evidence: `src/App.tsx`)
- Role-based routes → App shell: wraps protected screens (evidence: `src/App.tsx`)
- Login → Auth page shell: renders (evidence: `src/pages/Login.tsx`)
- Register → Auth page shell: renders (evidence: `src/pages/Register.tsx`)
- Stock dashboard → Dashboard API: fetches metrics (evidence: `src/pages/Dashboard.tsx`)
- Tracker inventory → Trackers API: loads and mutates trackers (evidence: `src/pages/Trackers.tsx`)
- Tracker inventory → Tracker actions & history: opens tracker actions (evidence: `src/pages/Trackers.tsx`)
- Tracker actions & history → Trackers API: reads and updates trackers (evidence: `src/components/trackers/ChangeStatusModal.tsx`)
- Tracker actions & history → Status transitions: checks allowed transitions (evidence: `src/components/trackers/ChangeStatusModal.tsx`)
- Tracker actions & history → Status badge: renders status (evidence: `src/components/trackers/ChangeStatusModal.tsx`)
- Client management → Clients API: loads and deletes clients (evidence: `src/pages/Clients.tsx`)
- Client management → Client form: opens create or edit (evidence: `src/pages/Clients.tsx`)
- Client form → Clients API: creates or updates (evidence: `src/components/clients/ClientFormModal.tsx`)
- Vehicle management → Vehicles API: manages vehicles (evidence: `src/pages/Vehicles.tsx`)
- Vehicle management → Clients API: loads client choices (evidence: `src/pages/Vehicles.tsx`)
- Vehicle management → Vehicle form: opens vehicle form (evidence: `src/pages/Vehicles.tsx`)
- Vehicle form → Vehicles API: creates or updates (evidence: `src/components/vehicles/VehicleFormModal.tsx`)
- Intervention scheduling → Interventions API: loads and schedules (evidence: `src/pages/Interventions.tsx`)
- Intervention scheduling → Clients API: loads client choices (evidence: `src/pages/Interventions.tsx`)
- Intervention scheduling → Vehicles API: loads vehicle choices (evidence: `src/pages/Interventions.tsx`)
- Intervention scheduling → Intervention form: opens scheduler (evidence: `src/pages/Interventions.tsx`)
- Intervention form → Interventions API: creates intervention (evidence: `src/components/interventions/InterventionFormModal.tsx`)
- Assigned interventions → Interventions API: loads assignments (evidence: `src/pages/MyInterventions.tsx`)
- Assigned interventions → Intervention completion: opens completion flow (evidence: `src/pages/MyInterventions.tsx`)
- Intervention completion → Interventions API: completes intervention (evidence: `src/components/interventions/CompleteInterventionModal.tsx`)
- Intervention completion → Trackers API: loads available trackers (evidence: `src/components/interventions/CompleteInterventionModal.tsx`)
- Auth API → Shared Axios client: sends requests through (evidence: `src/api/auth.ts`)
- Dashboard API → Shared Axios client: sends requests through (evidence: `src/api/dashboard.ts`)
- Clients API → Shared Axios client: sends requests through (evidence: `src/api/clients.ts`)
- Vehicles API → Shared Axios client: sends requests through (evidence: `src/api/vehicles.ts`)
- Trackers API → Shared Axios client: sends requests through (evidence: `src/api/trackers.ts`)
- Interventions API → Shared Axios client: sends requests through (evidence: `src/api/interventions.ts`)
- Shared Axios client → Camtrack REST backend: calls REST endpoints (evidence: `README.md`)
