# raunitkumar30/gigshield architecture

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

- Interactive diagram: https://gitdiagram.com/raunitkumar30/gigshield
- Repository: https://github.com/raunitkumar30/gigshield

## Overview

GigShield is a browser-based parametric insurance platform for delivery riders, with separate rider and admin portals. The rider workflow runs from account creation and onboarding through coverage management and claim submission; administrators monitor the risk pool, investigate disruptions and fraud, and review claims. The shared Store layer mediates rider and claim data with Supabase. The README documents several portal capabilities not visible in sampled code; their links are cited to the README. Some implementation details remain unverified because source excerpts are partial.

Main entry points: [`js/store.js`](https://github.com/raunitkumar30/gigshield/blob/master/js/store.js) (State Manager), [`js/index.js`](https://github.com/raunitkumar30/gigshield/blob/master/js/index.js) (Portal Selector), [`js/rider_dashboard.js`](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_dashboard.js) (Coverage Dashboard), [`js/admin_dashboard.js`](https://github.com/raunitkumar30/gigshield/blob/master/js/admin_dashboard.js) (Admin Overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Portal Entry"]
  node_portal_selector["Portal Selector<br/>[index.js]"]
end

subgraph group_rider["Rider Coverage"]
  node_rider_auth["Rider Authentication<br/>[rider_auth.js]"]
  node_onboarding["Rider Onboarding"]
  node_rider_dashboard["Coverage Dashboard<br/>[rider_dashboard.js]"]
  node_my_claims["Claim History<br/>[my_claims.js]"]
  node_rider_payments["Rider Payments<br/>[rider_payments.js]"]
end

subgraph group_admin["Admin Operations"]
  node_admin_login["Admin Login<br/>[admin_login.js]"]
  node_admin_dashboard["Admin Overview<br/>[admin_dashboard.js]"]
  node_rider_management["Rider Management"]
  node_live_map["Live Disruption Map<br/>[live_map.js]"]
  node_fraud_detection["Fraud Detection<br/>[fraud_detection.js]"]
  node_claims_payouts["Claims and Payouts<br/>[claims_payouts.js]"]
  node_admin_panel["Risk and Health Panel<br/>[admin_panel.js]"]
end

subgraph group_platform["Shared Data and Services"]
  node_store["State Manager<br/>[store.js]"]
  node_supabase[("Supabase")]
  node_weather_api["Open-Meteo Weather and AQI"]
  node_geocoding["OpenStreetMap Geocoding"]
  node_ip_location["IP Location Fallback"]
end

node_rider_actor(("Rider"))
node_admin_actor(("Administrator"))

node_rider_actor -->|"chooses portal"| node_portal_selector
node_admin_actor -->|"chooses portal"| node_portal_selector
node_portal_selector -->|"redirects signed-in rider"| node_rider_dashboard
node_portal_selector -->|"redirects signed-in admin"| node_admin_dashboard
node_rider_actor -->|"signs up or in"| node_rider_auth
node_rider_auth -->|"saves and checks rider"| node_store
node_rider_auth -->|"routes after signup"| node_onboarding
node_onboarding -->|"loads rider profile"| node_store
node_onboarding -->|"continues after setup"| node_rider_dashboard
node_rider_dashboard -->|"reads and updates rider"| node_store
node_rider_dashboard -->|"creates claim"| node_store
node_my_claims -->|"tracks claim history"| node_store
node_rider_payments -->|"shows payment history"| node_store
node_admin_actor -->|"authenticates"| node_admin_login
node_admin_login -->|"enters admin portal"| node_admin_dashboard
node_admin_dashboard -->|"reads rider and claim stats"| node_store
node_rider_management -->|"loads riders and claims"| node_store
node_live_map -->|"updates claim actions"| node_store
node_live_map -->|"fetches weather and AQI"| node_weather_api
node_live_map -->|"fetches fallback location"| node_ip_location
node_fraud_detection -->|"reads and updates claims"| node_store
node_claims_payouts -->|"reads and updates claims"| node_store
node_admin_panel -->|"reads riders and claims"| node_store
node_admin_panel -->|"fetches fallback location"| node_ip_location
node_store -->|"reads and writes data"| node_supabase
node_store -->|"subscribes to realtime"| node_supabase
node_admin_dashboard -->|"reverse geocodes location"| node_geocoding
node_rider_management -->|"reverse geocodes location"| node_geocoding
node_claims_payouts -->|"reverse geocodes location"| node_geocoding

click node_portal_selector "https://github.com/raunitkumar30/gigshield/blob/master/js/index.js"
click node_rider_auth "https://github.com/raunitkumar30/gigshield/blob/master/js/rider_auth.js"
click node_onboarding "https://github.com/raunitkumar30/gigshield/blob/master/js/rider_onboarding.js"
click node_rider_dashboard "https://github.com/raunitkumar30/gigshield/blob/master/js/rider_dashboard.js"
click node_my_claims "https://github.com/raunitkumar30/gigshield/blob/master/js/my_claims.js"
click node_rider_payments "https://github.com/raunitkumar30/gigshield/blob/master/js/rider_payments.js"
click node_admin_login "https://github.com/raunitkumar30/gigshield/blob/master/js/admin_login.js"
click node_admin_dashboard "https://github.com/raunitkumar30/gigshield/blob/master/js/admin_dashboard.js"
click node_rider_management "https://github.com/raunitkumar30/gigshield/blob/master/js/rider_management.js"
click node_live_map "https://github.com/raunitkumar30/gigshield/blob/master/js/live_map.js"
click node_fraud_detection "https://github.com/raunitkumar30/gigshield/blob/master/js/fraud_detection.js"
click node_claims_payouts "https://github.com/raunitkumar30/gigshield/blob/master/js/claims_payouts.js"
click node_admin_panel "https://github.com/raunitkumar30/gigshield/blob/master/js/admin_panel.js"
click node_store "https://github.com/raunitkumar30/gigshield/blob/master/js/store.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_portal_selector toneBlue
class node_rider_auth,node_onboarding,node_rider_dashboard,node_my_claims,node_rider_payments toneAmber
class node_admin_login,node_admin_dashboard,node_rider_management,node_live_map,node_fraud_detection,node_claims_payouts,node_admin_panel toneMint
class node_store,node_supabase,node_weather_api,node_geocoding,node_ip_location toneRose
class node_rider_actor,node_admin_actor toneIndigo
```

## Components

### Portal Entry

- [Portal Selector](https://github.com/raunitkumar30/gigshield/blob/master/js/index.js): `js/index.js`

### Rider Coverage

- [Rider Authentication](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_auth.js): `js/rider_auth.js`
- [Rider Onboarding](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_onboarding.js): `js/rider_onboarding.js`
- [Coverage Dashboard](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_dashboard.js): `js/rider_dashboard.js`
- [Claim History](https://github.com/raunitkumar30/gigshield/blob/master/js/my_claims.js): `js/my_claims.js`
- [Rider Payments](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_payments.js): `js/rider_payments.js`

### Admin Operations

- [Admin Login](https://github.com/raunitkumar30/gigshield/blob/master/js/admin_login.js): `js/admin_login.js`
- [Admin Overview](https://github.com/raunitkumar30/gigshield/blob/master/js/admin_dashboard.js): `js/admin_dashboard.js`
- [Rider Management](https://github.com/raunitkumar30/gigshield/blob/master/js/rider_management.js): `js/rider_management.js`
- [Live Disruption Map](https://github.com/raunitkumar30/gigshield/blob/master/js/live_map.js): `js/live_map.js`
- [Fraud Detection](https://github.com/raunitkumar30/gigshield/blob/master/js/fraud_detection.js): `js/fraud_detection.js`
- [Claims and Payouts](https://github.com/raunitkumar30/gigshield/blob/master/js/claims_payouts.js): `js/claims_payouts.js`
- [Risk and Health Panel](https://github.com/raunitkumar30/gigshield/blob/master/js/admin_panel.js): `js/admin_panel.js`

### Shared Data and Services

- [State Manager](https://github.com/raunitkumar30/gigshield/blob/master/js/store.js): `js/store.js`
- **Supabase**
- **Open-Meteo Weather and AQI**
- **OpenStreetMap Geocoding**
- **IP Location Fallback**

### Other components

- **Rider**
- **Administrator**

## Connections

- Rider → Portal Selector: chooses portal (evidence: `README.md`)
- Administrator → Portal Selector: chooses portal (evidence: `README.md`)
- Portal Selector → Coverage Dashboard: redirects signed-in rider (evidence: `js/index.js`)
- Portal Selector → Admin Overview: redirects signed-in admin (evidence: `js/index.js`)
- Rider → Rider Authentication: signs up or in (evidence: `README.md`)
- Rider Authentication → State Manager: saves and checks rider (evidence: `js/rider_auth.js`)
- Rider Authentication → Rider Onboarding: routes after signup (evidence: `js/rider_auth.js`)
- Rider Onboarding → State Manager: loads rider profile (evidence: `js/rider_onboarding.js`)
- Rider Onboarding → Coverage Dashboard: continues after setup (evidence: `js/rider_onboarding.js`)
- Coverage Dashboard → State Manager: reads and updates rider (evidence: `js/rider_dashboard.js`)
- Coverage Dashboard → State Manager: creates claim (evidence: `js/rider_dashboard.js`)
- Claim History → State Manager: tracks claim history (evidence: `README.md`)
- Rider Payments → State Manager: shows payment history (evidence: `README.md`)
- Administrator → Admin Login: authenticates (evidence: `README.md`)
- Admin Login → Admin Overview: enters admin portal (evidence: `README.md`)
- Admin Overview → State Manager: reads rider and claim stats (evidence: `js/admin_dashboard.js`)
- Rider Management → State Manager: loads riders and claims (evidence: `js/rider_management.js`)
- Live Disruption Map → State Manager: updates claim actions (evidence: `js/live_map.js`)
- Live Disruption Map → Open-Meteo Weather and AQI: fetches weather and AQI (evidence: `js/live_map.js`)
- Live Disruption Map → IP Location Fallback: fetches fallback location (evidence: `js/live_map.js`)
- Fraud Detection → State Manager: reads and updates claims (evidence: `js/fraud_detection.js`)
- Claims and Payouts → State Manager: reads and updates claims (evidence: `js/claims_payouts.js`)
- Risk and Health Panel → State Manager: reads riders and claims (evidence: `js/admin_panel.js`)
- Risk and Health Panel → IP Location Fallback: fetches fallback location (evidence: `js/admin_panel.js`)
- State Manager → Supabase: reads and writes data (evidence: `js/store.js`)
- State Manager → Supabase: subscribes to realtime (evidence: `README.md`)
- Admin Overview → OpenStreetMap Geocoding: reverse geocodes location (evidence: `js/admin_dashboard.js`)
- Rider Management → OpenStreetMap Geocoding: reverse geocodes location (evidence: `js/rider_management.js`)
- Claims and Payouts → OpenStreetMap Geocoding: reverse geocodes location (evidence: `js/claims_payouts.js`)
