# robinkihiko/energyvictory architecture

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

- Interactive diagram: https://gitdiagram.com/robinkihiko/energyvictory
- Repository: https://github.com/robinkihiko/energyvictory

## Overview

Fuel Flow Pro is a browser-based petrol-station management app. Staff sign in, then use protected pages to record sales and manage station operations; managers review dashboards and reports, export results, and reconcile activity. The source index confirms Supabase-backed pages and offline-sync support, while the excerpts show route protection, authentication, sales receipt wiring, and report exports. The README describes M-Pesa and other capabilities, but the sampled tree contains no payment integration implementation, so those flows are not represented as verified runtime connections.

Main entry points: [`src/App.tsx`](https://github.com/robinkihiko/energyvictory/blob/main/src/App.tsx) (Application routes), [`src/integrations/supabase/client.ts`](https://github.com/robinkihiko/energyvictory/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/pages/Sales.tsx`](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Sales.tsx) (Sales entry), [`src/pages/Reports.tsx`](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Reports.tsx) (Reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_app["Application routes<br/>[App.tsx]"]
  node_auth["Authentication<br/>[useAuth.tsx]"]
  node_login["Sign in<br/>[Login.tsx]"]
  node_users["User administration<br/>[Users.tsx]"]
end

subgraph group_operations["Station operations"]
  node_sales["Sales entry<br/>[Sales.tsx]"]
  node_receipt["Sale receipt<br/>[SaleReceipt.tsx]"]
  node_fuel["Fuel management<br/>[FuelManagement.tsx]"]
  node_pumps["Pump management<br/>[Pumps.tsx]"]
  node_tanks["Tank management<br/>[Tanks.tsx]"]
  node_expenses["Expenses<br/>[Expenses.tsx]"]
  node_branches["Branches<br/>[Branches.tsx]"]
  node_payroll["Payroll<br/>[Payroll.tsx]"]
end

subgraph group_insight["Reporting and controls"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_reports["Reports<br/>[Reports.tsx]"]
  node_export["Report exporters<br/>[exporters.ts]"]
  node_reconciliation["Reconciliation<br/>[Reconciliation.tsx]"]
  node_reversals["Sale reversals"]
end

subgraph group_platform["Data and resilience"]
  node_offline["Offline sync<br/>[useOfflineSync.tsx]"]
  node_queue["Offline queue<br/>[offlineQueue.ts]"]
  node_supabase[("Supabase service")]
  node_client["Supabase client<br/>[client.ts]"]
end

node_staff(("Station staff"))

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_sales
node_app -->|"routes to"| node_fuel
node_app -->|"routes to"| node_expenses
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_users
node_app -->|"routes to"| node_payroll
node_app -->|"routes to"| node_branches
node_app -->|"routes to"| node_pumps
node_app -->|"routes to"| node_tanks
node_app -->|"routes to"| node_reconciliation
node_auth -->|"reads auth and roles"| node_client
node_sales -->|"reads and writes"| node_client
node_sales -->|"renders"| node_receipt
node_sales -->|"uses sync"| node_offline
node_offline -->|"uses queue"| node_queue
node_offline -->|"syncs data"| node_client
node_dashboard -->|"reads metrics"| node_client
node_reports -->|"queries reports"| node_client
node_reports -->|"exports results"| node_export
node_reports -->|"renders panel"| node_reversals
node_client -->|"connects to"| node_supabase
node_fuel -.->|"uses data service"| node_client
node_pumps -->|"uses data service"| node_client
node_tanks -->|"uses data service"| node_client
node_expenses -.->|"uses data service"| node_client
node_branches -->|"uses data service"| node_client
node_payroll -.->|"uses data service"| node_client
node_users -->|"uses data service"| node_client
node_reconciliation -.->|"uses data service"| node_client

click node_app "https://github.com/robinkihiko/energyvictory/blob/main/src/App.tsx"
click node_auth "https://github.com/robinkihiko/energyvictory/blob/main/src/hooks/useAuth.tsx"
click node_login "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Login.tsx"
click node_dashboard "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Dashboard.tsx"
click node_sales "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Sales.tsx"
click node_receipt "https://github.com/robinkihiko/energyvictory/blob/main/src/components/SaleReceipt.tsx"
click node_fuel "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/FuelManagement.tsx"
click node_pumps "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Pumps.tsx"
click node_tanks "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Tanks.tsx"
click node_expenses "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Expenses.tsx"
click node_branches "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Branches.tsx"
click node_payroll "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Payroll.tsx"
click node_users "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Users.tsx"
click node_reports "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Reports.tsx"
click node_export "https://github.com/robinkihiko/energyvictory/blob/main/src/lib/exporters.ts"
click node_reconciliation "https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Reconciliation.tsx"
click node_reversals "https://github.com/robinkihiko/energyvictory/blob/main/src/components/SaleReversalsPanel.tsx"
click node_offline "https://github.com/robinkihiko/energyvictory/blob/main/src/hooks/useOfflineSync.tsx"
click node_queue "https://github.com/robinkihiko/energyvictory/blob/main/src/lib/offlineQueue.ts"
click node_client "https://github.com/robinkihiko/energyvictory/blob/main/src/integrations/supabase/client.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,node_login,node_users toneBlue
class node_sales,node_receipt,node_fuel,node_pumps,node_tanks,node_expenses,node_branches,node_payroll toneAmber
class node_dashboard,node_reports,node_export,node_reconciliation,node_reversals toneMint
class node_offline,node_queue,node_supabase,node_client toneRose
class node_staff toneIndigo
```

## Components

### Access and navigation

- [Application routes](https://github.com/robinkihiko/energyvictory/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/robinkihiko/energyvictory/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Sign in](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Login.tsx): `src/pages/Login.tsx`
- [User administration](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Users.tsx): `src/pages/Users.tsx`

### Station operations

- [Sales entry](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Sales.tsx): `src/pages/Sales.tsx`
- [Sale receipt](https://github.com/robinkihiko/energyvictory/blob/main/src/components/SaleReceipt.tsx): `src/components/SaleReceipt.tsx`
- [Fuel management](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/FuelManagement.tsx): `src/pages/FuelManagement.tsx`
- [Pump management](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Pumps.tsx): `src/pages/Pumps.tsx`
- [Tank management](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Tanks.tsx): `src/pages/Tanks.tsx`
- [Expenses](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Expenses.tsx): `src/pages/Expenses.tsx`
- [Branches](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Branches.tsx): `src/pages/Branches.tsx`
- [Payroll](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Payroll.tsx): `src/pages/Payroll.tsx`

### Reporting and controls

- [Dashboard](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Reports](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Report exporters](https://github.com/robinkihiko/energyvictory/blob/main/src/lib/exporters.ts): `src/lib/exporters.ts`
- [Reconciliation](https://github.com/robinkihiko/energyvictory/blob/main/src/pages/Reconciliation.tsx): `src/pages/Reconciliation.tsx`
- [Sale reversals](https://github.com/robinkihiko/energyvictory/blob/main/src/components/SaleReversalsPanel.tsx): `src/components/SaleReversalsPanel.tsx`

### Data and resilience

- [Offline sync](https://github.com/robinkihiko/energyvictory/blob/main/src/hooks/useOfflineSync.tsx): `src/hooks/useOfflineSync.tsx`
- [Offline queue](https://github.com/robinkihiko/energyvictory/blob/main/src/lib/offlineQueue.ts): `src/lib/offlineQueue.ts`
- **Supabase service**
- [Supabase client](https://github.com/robinkihiko/energyvictory/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`

### Other components

- **Station staff**

## Connections

- Station staff → Application routes: uses
- Application routes → Authentication: provides auth (evidence: `src/App.tsx`)
- Application routes → Sign in: routes to (evidence: `src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `src/App.tsx`)
- Application routes → Sales entry: routes to (evidence: `src/App.tsx`)
- Application routes → Fuel management: routes to (evidence: `src/App.tsx`)
- Application routes → Expenses: routes to (evidence: `src/App.tsx`)
- Application routes → Reports: routes to (evidence: `src/App.tsx`)
- Application routes → User administration: routes to (evidence: `src/App.tsx`)
- Application routes → Payroll: routes to (evidence: `src/App.tsx`)
- Application routes → Branches: routes to (evidence: `src/App.tsx`)
- Application routes → Pump management: routes to (evidence: `src/App.tsx`)
- Application routes → Tank management: routes to (evidence: `src/App.tsx`)
- Application routes → Reconciliation: routes to (evidence: `src/App.tsx`)
- Authentication → Supabase client: reads auth and roles (evidence: `src/hooks/useAuth.tsx`)
- Sales entry → Supabase client: reads and writes (evidence: `src/pages/Sales.tsx`)
- Sales entry → Sale receipt: renders (evidence: `src/pages/Sales.tsx`)
- Sales entry → Offline sync: uses sync (evidence: `src/pages/Sales.tsx`)
- Offline sync → Offline queue: uses queue (evidence: `src/hooks/useOfflineSync.tsx`)
- Offline sync → Supabase client: syncs data (evidence: `src/hooks/useOfflineSync.tsx`)
- Dashboard → Supabase client: reads metrics (evidence: `src/pages/Dashboard.tsx`)
- Reports → Supabase client: queries reports (evidence: `src/pages/Reports.tsx`)
- Reports → Report exporters: exports results (evidence: `src/pages/Reports.tsx`)
- Reports → Sale reversals: renders panel (evidence: `src/pages/Reports.tsx`)
- Supabase client → Supabase service: connects to (evidence: `src/integrations/supabase/client.ts`)
- Fuel management → Supabase client: uses data service
- Pump management → Supabase client: uses data service (evidence: `src/pages/Pumps.tsx`)
- Tank management → Supabase client: uses data service (evidence: `src/pages/Tanks.tsx`)
- Expenses → Supabase client: uses data service
- Branches → Supabase client: uses data service (evidence: `src/pages/Branches.tsx`)
- Payroll → Supabase client: uses data service
- User administration → Supabase client: uses data service (evidence: `src/pages/Users.tsx`)
- Reconciliation → Supabase client: uses data service
