# bettergovph/bettergov architecture

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

- Interactive diagram: https://gitdiagram.com/bettergovph/bettergov
- Repository: https://github.com/bettergovph/bettergov

## Overview

BetterGov.ph is a citizen-facing Philippine government information portal, with a companion Cloudflare Worker serving weather and foreign-exchange data. The main user workflow is browsing the portal’s routed pages to find services, government information, and travel guidance; the services directory supports finding services by category and search. Other documented branches include flood-control project exploration and Philippine reference information. The graph follows visible routes and calls; many listed pages and integrations were not sampled, so their internal connections are omitted.

Main entry points: [`src/App.tsx`](https://github.com/bettergovph/bettergov/blob/main/src/App.tsx) (Route application), [`functions/index.ts`](https://github.com/bettergovph/bettergov/blob/main/functions/index.ts) (Worker entry), [`src/pages/services/index.tsx`](https://github.com/bettergovph/bettergov/blob/main/src/pages/services/index.tsx) (Services directory), [`functions/api/weather.ts`](https://github.com/bettergovph/bettergov/blob/main/functions/api/weather.ts) (Weather API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Portal experience"]
  node_app["Route application<br/>[App.tsx]"]
  node_home["Home page<br/>[Home.tsx]"]
  node_nav["Site navigation<br/>[Navbar.tsx]"]
  node_navdata["Navigation data<br/>[navigation.ts]"]
  node_servicehome["Service highlights"]
  node_search["Search page<br/>[Search.tsx]"]
  node_weatherclient["Weather display<br/>[weather.ts]"]
  node_forexclient["Forex display<br/>[forex.ts]"]
end

subgraph group_directory["Services and government"]
  node_services["Services directory<br/>[index.tsx]"]
  node_gov["Government directory"]
  node_governmental["Government branch pages<br/>[&#91;chamber&#93;.tsx]"]
end

subgraph group_reference["Travel and Philippines"]
  node_travel["Travel information<br/>[index.tsx]"]
  node_visa["Visa details<br/>[&#91;type&#93;.tsx]"]
  node_philippines["Philippines reference"]
end

subgraph group_projects["Public project data"]
  node_flood["Flood project explorer<br/>[index.tsx]"]
end

subgraph group_worker["Data API"]
  node_worker["Worker entry<br/>[index.ts]"]
  node_weather["Weather API<br/>[weather.ts]"]
  node_forex["Forex API<br/>[forex.ts]"]
  node_weatherkv[("Weather KV")]
  node_forexkv[("Forex KV")]
end

node_citizen(("Website visitor"))

node_citizen -.->|"opens portal"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_services
node_app -->|"routes to"| node_gov
node_app -.->|"routes to"| node_travel
node_app -->|"routes to"| node_flood
node_app -.->|"routes to"| node_search
node_home -->|"renders"| node_servicehome
node_nav -->|"reads"| node_navdata
node_servicehome -->|"links to"| node_services
node_services -.->|"searches within"| node_search
node_gov -.->|"includes"| node_governmental
node_travel -.->|"links to"| node_visa
node_worker -->|"dispatches"| node_weather
node_worker -->|"dispatches"| node_forex
node_weather -->|"reads and writes"| node_weatherkv
node_worker -->|"schedules"| node_weather
node_worker -->|"schedules"| node_forex
node_weatherclient -.->|"requests data"| node_worker
node_forexclient -.->|"requests data"| node_worker

click node_app "https://github.com/bettergovph/bettergov/blob/main/src/App.tsx"
click node_home "https://github.com/bettergovph/bettergov/blob/main/src/pages/Home.tsx"
click node_nav "https://github.com/bettergovph/bettergov/blob/main/src/components/layout/Navbar.tsx"
click node_navdata "https://github.com/bettergovph/bettergov/blob/main/src/data/navigation.ts"
click node_servicehome "https://github.com/bettergovph/bettergov/blob/main/src/components/home/ServicesSection.tsx"
click node_services "https://github.com/bettergovph/bettergov/blob/main/src/pages/services/index.tsx"
click node_gov "https://github.com/bettergovph/bettergov/tree/main/src/pages/government"
click node_governmental "https://github.com/bettergovph/bettergov/blob/main/src/pages/government/legislative/%5Bchamber%5D.tsx"
click node_travel "https://github.com/bettergovph/bettergov/blob/main/src/pages/travel/visa/index.tsx"
click node_visa "https://github.com/bettergovph/bettergov/blob/main/src/pages/travel/visa-types/%5Btype%5D.tsx"
click node_philippines "https://github.com/bettergovph/bettergov/tree/main/src/pages/philippines"
click node_flood "https://github.com/bettergovph/bettergov/blob/main/src/pages/flood-control-projects/index.tsx"
click node_search "https://github.com/bettergovph/bettergov/blob/main/src/pages/Search.tsx"
click node_worker "https://github.com/bettergovph/bettergov/blob/main/functions/index.ts"
click node_weather "https://github.com/bettergovph/bettergov/blob/main/functions/api/weather.ts"
click node_forex "https://github.com/bettergovph/bettergov/blob/main/functions/api/forex.ts"
click node_weatherclient "https://github.com/bettergovph/bettergov/blob/main/src/lib/weather.ts"
click node_forexclient "https://github.com/bettergovph/bettergov/blob/main/src/lib/forex.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_home,node_nav,node_navdata,node_servicehome,node_search,node_weatherclient,node_forexclient toneBlue
class node_services,node_gov,node_governmental toneAmber
class node_travel,node_visa,node_philippines toneMint
class node_flood toneRose
class node_worker,node_weather,node_forex,node_weatherkv,node_forexkv,node_citizen toneIndigo
```

## Components

### Portal experience

- [Route application](https://github.com/bettergovph/bettergov/blob/main/src/App.tsx): `src/App.tsx`
- [Home page](https://github.com/bettergovph/bettergov/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Site navigation](https://github.com/bettergovph/bettergov/blob/main/src/components/layout/Navbar.tsx): `src/components/layout/Navbar.tsx`
- [Navigation data](https://github.com/bettergovph/bettergov/blob/main/src/data/navigation.ts): `src/data/navigation.ts`
- [Service highlights](https://github.com/bettergovph/bettergov/blob/main/src/components/home/ServicesSection.tsx): `src/components/home/ServicesSection.tsx`
- [Search page](https://github.com/bettergovph/bettergov/blob/main/src/pages/Search.tsx): `src/pages/Search.tsx`
- [Weather display](https://github.com/bettergovph/bettergov/blob/main/src/lib/weather.ts): `src/lib/weather.ts`
- [Forex display](https://github.com/bettergovph/bettergov/blob/main/src/lib/forex.ts): `src/lib/forex.ts`

### Services and government

- [Services directory](https://github.com/bettergovph/bettergov/blob/main/src/pages/services/index.tsx): `src/pages/services/index.tsx`
- [Government directory](https://github.com/bettergovph/bettergov/tree/main/src/pages/government): `src/pages/government`
- [Government branch pages](https://github.com/bettergovph/bettergov/blob/main/src/pages/government/legislative/%5Bchamber%5D.tsx): `src/pages/government/legislative/[chamber].tsx`

### Travel and Philippines

- [Travel information](https://github.com/bettergovph/bettergov/blob/main/src/pages/travel/visa/index.tsx): `src/pages/travel/visa/index.tsx`
- [Visa details](https://github.com/bettergovph/bettergov/blob/main/src/pages/travel/visa-types/%5Btype%5D.tsx): `src/pages/travel/visa-types/[type].tsx`
- [Philippines reference](https://github.com/bettergovph/bettergov/tree/main/src/pages/philippines): `src/pages/philippines`

### Public project data

- [Flood project explorer](https://github.com/bettergovph/bettergov/blob/main/src/pages/flood-control-projects/index.tsx): `src/pages/flood-control-projects/index.tsx`

### Data API

- [Worker entry](https://github.com/bettergovph/bettergov/blob/main/functions/index.ts): `functions/index.ts`
- [Weather API](https://github.com/bettergovph/bettergov/blob/main/functions/api/weather.ts): `functions/api/weather.ts`
- [Forex API](https://github.com/bettergovph/bettergov/blob/main/functions/api/forex.ts): `functions/api/forex.ts`
- **Weather KV**
- **Forex KV**

### Other components

- **Website visitor**

## Connections

- Website visitor → Route application: opens portal
- Route application → Home page: routes to (evidence: `src/App.tsx`)
- Route application → Services directory: routes to (evidence: `src/App.tsx`)
- Route application → Government directory: routes to (evidence: `src/App.tsx`)
- Route application → Travel information: routes to (evidence: `src/App.tsx`)
- Route application → Flood project explorer: routes to (evidence: `src/App.tsx`)
- Route application → Search page: routes to
- Home page → Service highlights: renders (evidence: `src/pages/Home.tsx`)
- Site navigation → Navigation data: reads (evidence: `src/components/layout/Navbar.tsx`)
- Service highlights → Services directory: links to (evidence: `src/components/home/ServicesSection.tsx`)
- Services directory → Search page: searches within
- Government directory → Government branch pages: includes
- Travel information → Visa details: links to
- Worker entry → Weather API: dispatches (evidence: `functions/index.ts`)
- Worker entry → Forex API: dispatches (evidence: `functions/index.ts`)
- Weather API → Weather KV: reads and writes (evidence: `functions/api/weather.ts`)
- Worker entry → Weather API: schedules (evidence: `functions/index.ts`)
- Worker entry → Forex API: schedules (evidence: `functions/index.ts`)
- Weather display → Worker entry: requests data
- Forex display → Worker entry: requests data
