# rakesh-hb/evtoolkit architecture

> Architecture diagram of the GitHub repository rakesh-hb/evtoolkit, 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/rakesh-hb/evtoolkit
- Repository: https://github.com/rakesh-hb/evtoolkit

## Overview

EV Toolkit is a React application for managing electric-vehicle ownership records. Users enter through authentication and navigation, choose vehicles, maintain service, insurance, charging, tyre, and document records, then review analytics or manage account and backup settings. The graph preserves these major feature areas from the source index; the README is only the Vite template and does not document product capabilities. Several page and service connections are supported by the source index rather than inspected implementation excerpts.

Main entry points: [`src/lib/supabase.ts`](https://github.com/rakesh-hb/evtoolkit/blob/main/src/lib/supabase.ts) (Supabase client), [`src/services/subscriptionService.ts`](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/subscriptionService.ts) (Plan and limits), [`src/App.tsx`](https://github.com/rakesh-hb/evtoolkit/blob/main/src/App.tsx) (Application router), [`src/pages/ServiceHistory.tsx`](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/ServiceHistory.tsx) (Service history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and identity"]
  node_app["Application router<br/>[App.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
end

subgraph group_vehicle["Vehicle setup"]
  node_primary["Primary vehicle context"]
  node_vehicledata["Vehicle catalogue<br/>[index.ts]"]
  node_vehicleprefs["Vehicle preferences"]
  node_customvehicle["Custom vehicles"]
end

subgraph group_records["Ownership records"]
  node_servicepage["Service history<br/>[ServiceHistory.tsx]"]
  node_serviceservice["Service records"]
  node_insurancepage["Insurance records<br/>[Insurance.tsx]"]
  node_insuranceservice["Insurance records API"]
  node_tracker["Charging tracker<br/>[Tracker.tsx]"]
  node_charging["Charging sessions<br/>[chargingService.ts]"]
  node_documents["Document vault<br/>[DocumentVault.tsx]"]
  node_tyres["Tyre history<br/>[TyreHistory.tsx]"]
  node_attachments["Receipt attachments"]
  node_drafts["Form drafts"]
end

subgraph group_insights["Reports and analytics"]
  node_analytics["Analytics<br/>[Analytics.tsx]"]
  node_reports["Report generation<br/>[ReportGenerator.ts]"]
  node_reporttoolbar["Report controls<br/>[ReportToolbar.tsx]"]
end

subgraph group_account["Account and data"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_settings["Settings<br/>[Settings.tsx]"]
  node_backup["Backup and restore<br/>[backupService.ts]"]
  node_subscription["Plan and limits"]
end

node_user(("EV owner"))

node_user -->|"uses"| node_app
node_app -->|"reads state"| node_auth
node_app -->|"routes to"| node_servicepage
node_app -.->|"routes to"| node_insurancepage
node_app -.->|"routes to"| node_tracker
node_app -->|"routes to"| node_analytics
node_primary -->|"reads session"| node_auth
node_primary -->|"loads and saves"| node_vehicleprefs
node_servicepage -->|"manages records"| node_serviceservice
node_servicepage -->|"uses vehicle"| node_primary
node_servicepage -->|"saves drafts"| node_drafts
node_servicepage -->|"downloads files"| node_attachments
node_servicepage -->|"checks limits"| node_subscription
node_insurancepage -->|"manages records"| node_insuranceservice
node_insurancepage -->|"uses catalogue"| node_vehicledata
node_insurancepage -->|"uses custom vehicles"| node_customvehicle
node_insurancepage -->|"uses attachments"| node_attachments
node_insurancepage -->|"checks plan"| node_subscription
node_tracker -->|"manages sessions"| node_charging
node_tracker -->|"uses vehicle"| node_primary
node_tracker -->|"uses catalogue"| node_vehicledata
node_tracker -->|"uses attachments"| node_attachments
node_documents -.->|"plan limits"| node_subscription
node_tyres -.->|"plan limits"| node_subscription
node_analytics -->|"renders controls"| node_reporttoolbar
node_analytics -->|"checks plan"| node_subscription
node_reporttoolbar -->|"uses client"| node_supabase
node_settings -->|"backs up and restores"| node_backup
node_settings -->|"manages vehicles"| node_customvehicle
node_settings -->|"checks plan"| node_subscription
node_backup -->|"collects sessions"| node_charging
node_backup -->|"collects records"| node_serviceservice
node_backup -->|"collects records"| node_insuranceservice
node_backup -->|"restores data"| node_supabase
node_serviceservice -->|"accesses data"| node_supabase
node_insuranceservice -.->|"accesses data"| node_supabase
node_charging -->|"accesses data"| node_supabase
node_vehicleprefs -->|"accesses data"| node_supabase
node_customvehicle -->|"accesses data"| node_supabase
node_subscription -->|"checks subscription"| node_supabase
node_reports -.->|"supports reports"| node_analytics

click node_app "https://github.com/rakesh-hb/evtoolkit/blob/main/src/App.tsx"
click node_auth "https://github.com/rakesh-hb/evtoolkit/blob/main/src/context/AuthContext.tsx"
click node_supabase "https://github.com/rakesh-hb/evtoolkit/blob/main/src/lib/supabase.ts"
click node_primary "https://github.com/rakesh-hb/evtoolkit/blob/main/src/context/PrimaryVehicleContext.tsx"
click node_vehicledata "https://github.com/rakesh-hb/evtoolkit/blob/main/src/data/vehicles/index.ts"
click node_vehicleprefs "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/primaryVehicleService.ts"
click node_customvehicle "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/customVehicleService.ts"
click node_servicepage "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/ServiceHistory.tsx"
click node_serviceservice "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/serviceHistoryService.ts"
click node_insurancepage "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Insurance.tsx"
click node_insuranceservice "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/insuranceService.ts"
click node_tracker "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Tracker.tsx"
click node_charging "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/chargingService.ts"
click node_documents "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/DocumentVault.tsx"
click node_tyres "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/TyreHistory.tsx"
click node_analytics "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Analytics.tsx"
click node_reports "https://github.com/rakesh-hb/evtoolkit/blob/main/src/reports/ReportGenerator.ts"
click node_reporttoolbar "https://github.com/rakesh-hb/evtoolkit/blob/main/src/components/reports/ReportToolbar.tsx"
click node_settings "https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Settings.tsx"
click node_backup "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/backupService.ts"
click node_subscription "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/subscriptionService.ts"
click node_attachments "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/attachmentService.ts"
click node_drafts "https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/formDraftService.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_auth toneBlue
class node_primary,node_vehicledata,node_vehicleprefs,node_customvehicle toneAmber
class node_servicepage,node_serviceservice,node_insurancepage,node_insuranceservice,node_tracker,node_charging,node_documents,node_tyres,node_attachments,node_drafts toneMint
class node_analytics,node_reports,node_reporttoolbar toneRose
class node_supabase,node_settings,node_backup,node_subscription,node_user toneIndigo
```

## Components

### App and identity

- [Application router](https://github.com/rakesh-hb/evtoolkit/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication state](https://github.com/rakesh-hb/evtoolkit/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`

### Vehicle setup

- [Primary vehicle context](https://github.com/rakesh-hb/evtoolkit/blob/main/src/context/PrimaryVehicleContext.tsx): `src/context/PrimaryVehicleContext.tsx`
- [Vehicle catalogue](https://github.com/rakesh-hb/evtoolkit/blob/main/src/data/vehicles/index.ts): `src/data/vehicles/index.ts`
- [Vehicle preferences](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/primaryVehicleService.ts): `src/services/primaryVehicleService.ts`
- [Custom vehicles](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/customVehicleService.ts): `src/services/customVehicleService.ts`

### Ownership records

- [Service history](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/ServiceHistory.tsx): `src/pages/ServiceHistory.tsx`
- [Service records](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/serviceHistoryService.ts): `src/services/serviceHistoryService.ts`
- [Insurance records](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Insurance.tsx): `src/pages/Insurance.tsx`
- [Insurance records API](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/insuranceService.ts): `src/services/insuranceService.ts`
- [Charging tracker](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Tracker.tsx): `src/pages/Tracker.tsx`
- [Charging sessions](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/chargingService.ts): `src/services/chargingService.ts`
- [Document vault](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/DocumentVault.tsx): `src/pages/DocumentVault.tsx`
- [Tyre history](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/TyreHistory.tsx): `src/pages/TyreHistory.tsx`
- [Receipt attachments](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/attachmentService.ts): `src/services/attachmentService.ts`
- [Form drafts](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/formDraftService.ts): `src/services/formDraftService.ts`

### Reports and analytics

- [Analytics](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Analytics.tsx): `src/pages/Analytics.tsx`
- [Report generation](https://github.com/rakesh-hb/evtoolkit/blob/main/src/reports/ReportGenerator.ts): `src/reports/ReportGenerator.ts`
- [Report controls](https://github.com/rakesh-hb/evtoolkit/blob/main/src/components/reports/ReportToolbar.tsx): `src/components/reports/ReportToolbar.tsx`

### Account and data

- [Supabase client](https://github.com/rakesh-hb/evtoolkit/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Settings](https://github.com/rakesh-hb/evtoolkit/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`
- [Backup and restore](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/backupService.ts): `src/services/backupService.ts`
- [Plan and limits](https://github.com/rakesh-hb/evtoolkit/blob/main/src/services/subscriptionService.ts): `src/services/subscriptionService.ts`

### Other components

- **EV owner**

## Connections

- EV owner → Application router: uses
- Application router → Authentication state: reads state (evidence: `src/App.tsx`)
- Application router → Service history: routes to (evidence: `src/App.tsx`)
- Application router → Insurance records: routes to (evidence: `src/App.tsx`)
- Application router → Charging tracker: routes to (evidence: `src/App.tsx`)
- Application router → Analytics: routes to (evidence: `src/App.tsx`)
- Primary vehicle context → Authentication state: reads session (evidence: `src/context/PrimaryVehicleContext.tsx`)
- Primary vehicle context → Vehicle preferences: loads and saves (evidence: `src/context/PrimaryVehicleContext.tsx`)
- Service history → Service records: manages records (evidence: `src/pages/ServiceHistory.tsx`)
- Service history → Primary vehicle context: uses vehicle (evidence: `src/pages/ServiceHistory.tsx`)
- Service history → Form drafts: saves drafts (evidence: `src/pages/ServiceHistory.tsx`)
- Service history → Receipt attachments: downloads files (evidence: `src/pages/ServiceHistory.tsx`)
- Service history → Plan and limits: checks limits (evidence: `src/pages/ServiceHistory.tsx`)
- Insurance records → Insurance records API: manages records (evidence: `src/pages/Insurance.tsx`)
- Insurance records → Vehicle catalogue: uses catalogue (evidence: `src/pages/Insurance.tsx`)
- Insurance records → Custom vehicles: uses custom vehicles (evidence: `src/pages/Insurance.tsx`)
- Insurance records → Receipt attachments: uses attachments (evidence: `src/pages/Insurance.tsx`)
- Insurance records → Plan and limits: checks plan (evidence: `src/pages/Insurance.tsx`)
- Charging tracker → Charging sessions: manages sessions (evidence: `src/pages/Tracker.tsx`)
- Charging tracker → Primary vehicle context: uses vehicle (evidence: `src/pages/Tracker.tsx`)
- Charging tracker → Vehicle catalogue: uses catalogue (evidence: `src/pages/Tracker.tsx`)
- Charging tracker → Receipt attachments: uses attachments (evidence: `src/pages/Tracker.tsx`)
- Document vault → Plan and limits: plan limits
- Tyre history → Plan and limits: plan limits
- Analytics → Report controls: renders controls (evidence: `src/pages/Analytics.tsx`)
- Analytics → Plan and limits: checks plan (evidence: `src/pages/Analytics.tsx`)
- Report controls → Supabase client: uses client (evidence: `src/components/reports/ReportToolbar.tsx`)
- Settings → Backup and restore: backs up and restores (evidence: `src/pages/Settings.tsx`)
- Settings → Custom vehicles: manages vehicles (evidence: `src/pages/Settings.tsx`)
- Settings → Plan and limits: checks plan (evidence: `src/pages/Settings.tsx`)
- Backup and restore → Charging sessions: collects sessions (evidence: `src/services/backupService.ts`)
- Backup and restore → Service records: collects records (evidence: `src/services/backupService.ts`)
- Backup and restore → Insurance records API: collects records (evidence: `src/services/backupService.ts`)
- Backup and restore → Supabase client: restores data (evidence: `src/services/backupService.ts`)
- Service records → Supabase client: accesses data (evidence: `src/services/serviceHistoryService.ts`)
- Insurance records API → Supabase client: accesses data
- Charging sessions → Supabase client: accesses data (evidence: `src/services/chargingService.ts`)
- Vehicle preferences → Supabase client: accesses data (evidence: `src/services/primaryVehicleService.ts`)
- Custom vehicles → Supabase client: accesses data (evidence: `src/services/customVehicleService.ts`)
- Plan and limits → Supabase client: checks subscription (evidence: `src/services/subscriptionService.ts`)
- Report generation → Analytics: supports reports
