# covaimetertaxi-byte/cmt-vendor-portal architecture

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

- Interactive diagram: https://gitdiagram.com/covaimetertaxi-byte/cmt-vendor-portal
- Repository: https://github.com/covaimetertaxi-byte/cmt-vendor-portal

## Overview

This is a taxi-vendor portal for vendor access, ride dispatch, invoice creation, and company setup. The main workflow is vendor sign-in, entering a passenger number and choosing an immediate or scheduled dispatch, then optionally creating a bill from pasted ride text or manually. Billing supports preview, PDF download, and WhatsApp sharing; settings store company details locally. Source excerpts establish the billing parser, Firebase-backed vendor checks, and local profile storage. Some App wiring and unsampled views are only represented where the tree and sampled usage support them.

Main entry points: [`src/App.tsx`](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx) (Portal shell), [`src/services/vendorAuth.ts`](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/services/vendorAuth.ts) (Session validation), [`src/components/BillingView.tsx`](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/BillingView.tsx) (Invoice editor), [`src/components/LoginView.tsx`](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/LoginView.tsx) (Vendor sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Vendor access"]
  node_login["Vendor sign-in<br/>[LoginView.tsx]"]
  node_auth["Session validation<br/>[vendorAuth.ts]"]
  node_firebaseconfig["Firebase setup<br/>[firebase.ts]"]
  node_firestore[("Firestore vendors")]
end

subgraph group_dispatch["Ride dispatch"]
  node_app["Portal shell<br/>[App.tsx]"]
  node_rideentry["Ride details<br/>[App.tsx]"]
  node_dispatchfeedback["Dispatch feedback<br/>[App.tsx]"]
  node_sms["SMS / WhatsApp"]
end

subgraph group_billing["Billing"]
  node_billingview["Invoice editor<br/>[BillingView.tsx]"]
  node_parser["Receipt parser<br/>[textParser.ts]"]
  node_invoice["Invoice data<br/>[billing.ts]"]
  node_pdf["PDF export<br/>[BillingView.tsx]"]
end

subgraph group_profile["Company and offline"]
  node_settings["Company settings<br/>[SettingsView.tsx]"]
  node_storage["Profile storage<br/>[storage.ts]"]
  node_localstorage[("Browser storage")]
  node_offline["Offline indicator"]
  node_serviceworker["Offline cache worker<br/>[sw.js]"]
end

node_vendor(("Vendor"))
node_browser(("Browser"))

node_vendor -->|"uses"| node_app
node_app -->|"shows"| node_login
node_login -->|"checks credentials"| node_auth
node_app -->|"checks session"| node_auth
node_app -->|"logs out"| node_auth
node_auth -->|"gets database"| node_firebaseconfig
node_auth -->|"reads / updates"| node_firestore
node_app -->|"renders"| node_rideentry
node_rideentry -->|"updates"| node_dispatchfeedback
node_rideentry -.->|"opens dispatch"| node_sms
node_app -->|"shows billing"| node_billingview
node_billingview -->|"parses pasted text"| node_parser
node_billingview -->|"edits"| node_invoice
node_billingview -->|"generates export"| node_pdf
node_app -->|"shows settings"| node_settings
node_settings -->|"saves profile"| node_storage
node_storage -->|"reads / writes"| node_localstorage
node_browser -->|"intercepts requests"| node_serviceworker
node_serviceworker -->|"serves cached response"| node_browser
node_app -->|"renders status"| node_offline

click node_app "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx"
click node_login "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/LoginView.tsx"
click node_auth "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/services/vendorAuth.ts"
click node_firebaseconfig "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/config/firebase.ts"
click node_rideentry "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx"
click node_dispatchfeedback "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx"
click node_billingview "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/BillingView.tsx"
click node_parser "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/utils/textParser.ts"
click node_invoice "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/types/billing.ts"
click node_pdf "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/BillingView.tsx"
click node_settings "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/SettingsView.tsx"
click node_storage "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/utils/storage.ts"
click node_offline "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/OfflineIndicator.tsx"
click node_serviceworker "https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/public/sw.js"

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_auth,node_firebaseconfig,node_firestore,node_browser toneBlue
class node_app,node_rideentry,node_dispatchfeedback,node_sms toneAmber
class node_billingview,node_parser,node_invoice,node_pdf toneMint
class node_settings,node_storage,node_localstorage,node_offline,node_serviceworker toneRose
class node_vendor toneIndigo
```

## Components

### Vendor access

- [Vendor sign-in](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/LoginView.tsx): `src/components/LoginView.tsx`
- [Session validation](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/services/vendorAuth.ts): `src/services/vendorAuth.ts`
- [Firebase setup](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/config/firebase.ts): `src/config/firebase.ts`
- **Firestore vendors**

### Ride dispatch

- [Portal shell](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx): `src/App.tsx`
- [Ride details](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx): `src/App.tsx`
- [Dispatch feedback](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/App.tsx): `src/App.tsx`
- **SMS / WhatsApp**

### Billing

- [Invoice editor](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/BillingView.tsx): `src/components/BillingView.tsx`
- [Receipt parser](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/utils/textParser.ts): `src/utils/textParser.ts`
- [Invoice data](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/types/billing.ts): `src/types/billing.ts`
- [PDF export](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/BillingView.tsx): `src/components/BillingView.tsx`

### Company and offline

- [Company settings](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/SettingsView.tsx): `src/components/SettingsView.tsx`
- [Profile storage](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/utils/storage.ts): `src/utils/storage.ts`
- **Browser storage**
- [Offline indicator](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/src/components/OfflineIndicator.tsx): `src/components/OfflineIndicator.tsx`
- [Offline cache worker](https://github.com/covaimetertaxi-byte/cmt-vendor-portal/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Vendor**
- **Browser**

## Connections

- Vendor → Portal shell: uses
- Portal shell → Vendor sign-in: shows
- Vendor sign-in → Session validation: checks credentials
- Portal shell → Session validation: checks session
- Portal shell → Session validation: logs out
- Session validation → Firebase setup: gets database
- Session validation → Firestore vendors: reads / updates
- Portal shell → Ride details: renders
- Ride details → Dispatch feedback: updates
- Ride details → SMS / WhatsApp: opens dispatch
- Portal shell → Invoice editor: shows billing
- Invoice editor → Receipt parser: parses pasted text
- Invoice editor → Invoice data: edits
- Invoice editor → PDF export: generates export
- Portal shell → Company settings: shows settings
- Company settings → Profile storage: saves profile
- Profile storage → Browser storage: reads / writes
- Browser → Offline cache worker: intercepts requests
- Offline cache worker → Browser: serves cached response
- Portal shell → Offline indicator: renders status
