# karthikk022/namakkal-fuel-map- architecture

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

- Interactive diagram: https://gitdiagram.com/karthikk022/namakkal-fuel-map-
- Repository: https://github.com/karthikk022/namakkal-fuel-map-

## Overview

This is a Namakkal fuel-finder web app. Drivers use the browser map and station list to find fuel stops, inspect availability and services, and open directions; separate views provide fuel prices, price trends and emergency contacts. The app loads station, price and SOS data from local JSON, with optional Supabase live availability updates and browser-stored preferences and alerts. A daily price updater scrapes public sources and maintains price history. The excerpts show the browser reads and subscription setup, but not the full availability write or map-rendering wiring.

Main entry points: [`app.js`](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js) (App logic), [`update-prices.py`](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/update-prices.py) (Price updater), [`index.html`](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/index.html) (Web app), [`prices.json`](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/prices.json) (Current prices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Station discovery"]
  node_browser["Web app<br/>[index.html]"]
  node_app["App logic<br/>[app.js]"]
  node_directions["Map directions<br/>[app.js]"]
end

subgraph group_fueldata["Fuel data"]
  node_stations["Station data<br/>[stations.json]"]
  node_prices["Current prices<br/>[prices.json]"]
  node_history["Price history<br/>[price-history.json]"]
  node_availability[("Live availability")]
  node_supabase[("Supabase")]
end

subgraph group_assistance["Alerts and assistance"]
  node_local[("Browser storage")]
  node_sosdata["Emergency contacts<br/>[sos.json]"]
  node_sos["SOS directory<br/>[app.js]"]
  node_alerts["Price and CNG alerts<br/>[app.js]"]
end

subgraph group_automation["Price automation"]
  node_pricejob["Price updater<br/>[update-prices.py]"]
  node_sources["Fuel price sources"]
end

node_driver(("Driver"))
node_mapservice["Maps service"]

node_driver -->|"uses"| node_browser
node_browser -->|"loads"| node_app
node_app -->|"fetches"| node_stations
node_app -->|"fetches"| node_prices
node_app -->|"fetches"| node_sosdata
node_app -.->|"subscribes"| node_supabase
node_supabase -.->|"change events"| node_app
node_app -->|"reads and writes"| node_local
node_app -->|"fetches"| node_history
node_app -->|"renders"| node_sos
node_app -->|"manages"| node_alerts
node_app -->|"opens"| node_directions
node_directions -->|"opens directions"| node_mapservice
node_driver -.->|"scheduled update"| node_pricejob
node_pricejob -->|"scrapes"| node_sources
node_pricejob -->|"writes"| node_prices
node_pricejob -->|"appends"| node_history

click node_browser "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/index.html"
click node_app "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js"
click node_stations "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/stations.json"
click node_prices "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/prices.json"
click node_history "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/price-history.json"
click node_availability "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/supabase-schema.sql"
click node_sosdata "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/sos.json"
click node_sos "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js"
click node_alerts "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js"
click node_directions "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js"
click node_pricejob "https://github.com/karthikk022/namakkal-fuel-map-/blob/main/update-prices.py"

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_browser,node_app,node_directions toneBlue
class node_stations,node_prices,node_history,node_availability,node_supabase toneAmber
class node_local,node_sosdata,node_sos,node_alerts toneMint
class node_pricejob,node_sources toneRose
class node_driver,node_mapservice toneIndigo
```

## Components

### Station discovery

- [Web app](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/index.html): `index.html`
- [App logic](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js): `app.js`
- [Map directions](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js): `app.js`

### Fuel data

- [Station data](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/stations.json): `stations.json`
- [Current prices](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/prices.json): `prices.json`
- [Price history](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/price-history.json): `price-history.json`
- [Live availability](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/supabase-schema.sql): `supabase-schema.sql`
- **Supabase**

### Alerts and assistance

- **Browser storage**
- [Emergency contacts](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/sos.json): `sos.json`
- [SOS directory](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js): `app.js`
- [Price and CNG alerts](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/app.js): `app.js`

### Price automation

- [Price updater](https://github.com/karthikk022/namakkal-fuel-map-/blob/main/update-prices.py): `update-prices.py`
- **Fuel price sources**

### Other components

- **Driver**
- **Maps service**

## Connections

- Driver → Web app: uses
- Web app → App logic: loads
- App logic → Station data: fetches
- App logic → Current prices: fetches
- App logic → Emergency contacts: fetches
- App logic → Supabase: subscribes
- Supabase → App logic: change events
- App logic → Browser storage: reads and writes
- App logic → Price history: fetches
- App logic → SOS directory: renders
- App logic → Price and CNG alerts: manages
- App logic → Map directions: opens
- Map directions → Maps service: opens directions
- Driver → Price updater: scheduled update
- Price updater → Fuel price sources: scrapes
- Price updater → Current prices: writes
- Price updater → Price history: appends
