# tejusraj/bridgepulse architecture

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

- Interactive diagram: https://gitdiagram.com/tejusraj/bridgepulse
- Repository: https://github.com/tejusraj/bridgepulse

## Overview

BridgePulse captures smartphone motion during a bridge crossing, processes vibration into frequency and quality metrics, and uploads trip features for bridge-health monitoring. The mobile app also supports nearby-bridge discovery, live capture feedback, trip summaries, status views, and sensor debugging; the website presents bridge status and analysis. The README documents Supabase storage, health-metric triggers, and real-time dashboard updates. Several implementation details are unsampled, so uncertain dashboard wiring is shown as optional rather than asserted.

Main entry points: [`mobile/App.js`](https://github.com/tejusraj/bridgepulse/blob/main/mobile/App.js) (App navigation), [`mobile/src/components/sheet/BridgeListSheet.js`](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/sheet/BridgeListSheet.js) (Nearby bridge list), [`mobile/src/state/store.js`](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/state/store.js) (App state), [`mobile/src/components/map/LeafletMap.js`](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/map/LeafletMap.js) (Map and location)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile experience"]
  node_app["App navigation<br/>[App.js]"]
  node_map_screen["Bridge map<br/>[MapScreen.js]"]
  node_map_view["Map and location<br/>[LeafletMap.js]"]
  node_nearby_sheet["Nearby bridge list<br/>[BridgeListSheet.js]"]
  node_status_screen["Bridge status"]
  node_store["App state<br/>[store.js]"]
  node_debug["Sensor diagnostics"]
  node_distance["Distance calculation<br/>[distance.js]"]
end

subgraph group_capture["Trip analysis"]
  node_capture_screen["Live crossing<br/>[OnBridgeScreen.js]"]
  node_trip_hook["Sensor capture<br/>[useTrip.js]"]
  node_signal["Signal processing<br/>[signal.js]"]
  node_live_ui["Live feedback<br/>[LiveWaveform.js]"]
  node_summary["Trip summary<br/>[SummaryScreen.js]"]
end

subgraph group_backend["Bridge data"]
  node_bridge_fetch["Bridge discovery<br/>[bridges.js]"]
  node_upload["Trip upload<br/>[uploadTrip.js]"]
  node_mobile_client["Mobile data client<br/>[supabase.js]"]
  node_supabase[("Supabase database")]
end

subgraph group_dashboard["Web dashboard"]
  node_dashboard_page["Dashboard route<br/>[page.tsx]"]
  node_dashboard["Bridge dashboard"]
  node_web_client["Web data client<br/>[supabase.ts]"]
end

subgraph group_design["Mobile design system"]
  node_scale["Responsive scale<br/>[scale.js]"]
  node_fonts["App fonts<br/>[fonts.js]"]
  node_tokens["Visual tokens<br/>[tokens.js]"]
  node_format["Display formatting<br/>[format.js]"]
end

node_driver(("Phone user"))

node_driver -->|"opens"| node_app
node_app -->|"routes to"| node_map_screen
node_app -->|"routes to"| node_capture_screen
node_app -->|"routes to"| node_summary
node_app -->|"routes to"| node_status_screen
node_app -->|"routes to"| node_debug
node_map_screen -->|"renders"| node_map_view
node_map_screen -->|"renders"| node_nearby_sheet
node_map_view -->|"fetches nearby"| node_bridge_fetch
node_map_view -->|"calculates distance"| node_distance
node_map_view -->|"updates location state"| node_store
node_nearby_sheet -->|"reads bridge state"| node_store
node_nearby_sheet -->|"formats distance"| node_format
node_capture_screen -->|"uses capture"| node_trip_hook
node_capture_screen -->|"renders feedback"| node_live_ui
node_trip_hook -->|"processes samples"| node_signal
node_trip_hook -->|"updates trip state"| node_store
node_summary -->|"reads trip state"| node_store
node_summary -->|"submits trip"| node_upload
node_upload -->|"uses client"| node_mobile_client
node_mobile_client -->|"writes trip features"| node_supabase
node_status_screen -->|"reads bridge state"| node_store
node_dashboard_page -.->|"renders dashboard"| node_dashboard
node_dashboard -.->|"uses data client"| node_web_client
node_web_client -.->|"subscribes to updates"| node_supabase
node_app -->|"loads fonts"| node_fonts
node_app -->|"uses colors"| node_tokens
node_nearby_sheet -->|"scales layout"| node_scale
node_nearby_sheet -->|"uses colors"| node_tokens
node_nearby_sheet -->|"uses typography"| node_fonts
node_debug -->|"scales layout"| node_scale
node_debug -->|"uses colors"| node_tokens
node_status_screen -->|"uses colors"| node_tokens
node_status_screen -->|"scales layout"| node_scale

click node_app "https://github.com/tejusraj/bridgepulse/blob/main/mobile/App.js"
click node_map_screen "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/MapScreen.js"
click node_map_view "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/map/LeafletMap.js"
click node_nearby_sheet "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/sheet/BridgeListSheet.js"
click node_bridge_fetch "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/bridges.js"
click node_status_screen "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/BridgeStatusScreen.js"
click node_capture_screen "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/OnBridgeScreen.js"
click node_trip_hook "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/useTrip.js"
click node_signal "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/signal.js"
click node_live_ui "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/live/LiveWaveform.js"
click node_summary "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/SummaryScreen.js"
click node_upload "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/uploadTrip.js"
click node_mobile_client "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/supabase.js"
click node_store "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/state/store.js"
click node_debug "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/DebugSensorScreen.js"
click node_dashboard_page "https://github.com/tejusraj/bridgepulse/blob/main/website/src/app/page.tsx"
click node_dashboard "https://github.com/tejusraj/bridgepulse/blob/main/website/src/components/ui/bridge-dashboard.tsx"
click node_web_client "https://github.com/tejusraj/bridgepulse/blob/main/website/src/lib/supabase.ts"
click node_scale "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/scale.js"
click node_fonts "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/fonts.js"
click node_tokens "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/tokens.js"
click node_format "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/format.js"
click node_distance "https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/distance.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_app,node_map_screen,node_map_view,node_nearby_sheet,node_status_screen,node_store,node_debug,node_distance,node_driver toneBlue
class node_capture_screen,node_trip_hook,node_signal,node_live_ui,node_summary toneAmber
class node_bridge_fetch,node_upload,node_mobile_client,node_supabase toneMint
class node_dashboard_page,node_dashboard,node_web_client toneRose
class node_scale,node_fonts,node_tokens,node_format toneIndigo
```

## Components

### Mobile experience

- [App navigation](https://github.com/tejusraj/bridgepulse/blob/main/mobile/App.js): `mobile/App.js`
- [Bridge map](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/MapScreen.js): `mobile/src/screens/MapScreen.js`
- [Map and location](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/map/LeafletMap.js): `mobile/src/components/map/LeafletMap.js`
- [Nearby bridge list](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/sheet/BridgeListSheet.js): `mobile/src/components/sheet/BridgeListSheet.js`
- [Bridge status](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/BridgeStatusScreen.js): `mobile/src/screens/BridgeStatusScreen.js`
- [App state](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/state/store.js): `mobile/src/state/store.js`
- [Sensor diagnostics](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/DebugSensorScreen.js): `mobile/src/screens/DebugSensorScreen.js`
- [Distance calculation](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/distance.js): `mobile/src/utils/distance.js`

### Trip analysis

- [Live crossing](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/OnBridgeScreen.js): `mobile/src/screens/OnBridgeScreen.js`
- [Sensor capture](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/useTrip.js): `mobile/src/services/useTrip.js`
- [Signal processing](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/signal.js): `mobile/src/utils/signal.js`
- [Live feedback](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/components/live/LiveWaveform.js): `mobile/src/components/live/LiveWaveform.js`
- [Trip summary](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/screens/SummaryScreen.js): `mobile/src/screens/SummaryScreen.js`

### Bridge data

- [Bridge discovery](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/bridges.js): `mobile/src/services/bridges.js`
- [Trip upload](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/uploadTrip.js): `mobile/src/services/uploadTrip.js`
- [Mobile data client](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/services/supabase.js): `mobile/src/services/supabase.js`
- **Supabase database**

### Web dashboard

- [Dashboard route](https://github.com/tejusraj/bridgepulse/blob/main/website/src/app/page.tsx): `website/src/app/page.tsx`
- [Bridge dashboard](https://github.com/tejusraj/bridgepulse/blob/main/website/src/components/ui/bridge-dashboard.tsx): `website/src/components/ui/bridge-dashboard.tsx`
- [Web data client](https://github.com/tejusraj/bridgepulse/blob/main/website/src/lib/supabase.ts): `website/src/lib/supabase.ts`

### Mobile design system

- [Responsive scale](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/scale.js): `mobile/src/theme/scale.js`
- [App fonts](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/fonts.js): `mobile/src/theme/fonts.js`
- [Visual tokens](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/theme/tokens.js): `mobile/src/theme/tokens.js`
- [Display formatting](https://github.com/tejusraj/bridgepulse/blob/main/mobile/src/utils/format.js): `mobile/src/utils/format.js`

### Other components

- **Phone user**

## Connections

- Phone user → App navigation: opens (evidence: `README.md`)
- App navigation → Bridge map: routes to (evidence: `mobile/App.js`)
- App navigation → Live crossing: routes to (evidence: `mobile/App.js`)
- App navigation → Trip summary: routes to (evidence: `mobile/App.js`)
- App navigation → Bridge status: routes to (evidence: `mobile/App.js`)
- App navigation → Sensor diagnostics: routes to (evidence: `mobile/App.js`)
- Bridge map → Map and location: renders (evidence: `mobile/src/screens/MapScreen.js`)
- Bridge map → Nearby bridge list: renders (evidence: `mobile/src/screens/MapScreen.js`)
- Map and location → Bridge discovery: fetches nearby (evidence: `mobile/src/components/map/LeafletMap.js`)
- Map and location → Distance calculation: calculates distance (evidence: `mobile/src/components/map/LeafletMap.js`)
- Map and location → App state: updates location state (evidence: `mobile/src/components/map/LeafletMap.js`)
- Nearby bridge list → App state: reads bridge state (evidence: `mobile/src/components/sheet/BridgeListSheet.js`)
- Nearby bridge list → Display formatting: formats distance (evidence: `mobile/src/components/sheet/BridgeListSheet.js`)
- Live crossing → Sensor capture: uses capture (evidence: `mobile/src/screens/OnBridgeScreen.js`)
- Live crossing → Live feedback: renders feedback (evidence: `mobile/src/screens/OnBridgeScreen.js`)
- Sensor capture → Signal processing: processes samples (evidence: `mobile/src/services/useTrip.js`)
- Sensor capture → App state: updates trip state (evidence: `mobile/src/services/useTrip.js`)
- Trip summary → App state: reads trip state (evidence: `mobile/src/screens/SummaryScreen.js`)
- Trip summary → Trip upload: submits trip (evidence: `mobile/src/screens/SummaryScreen.js`)
- Trip upload → Mobile data client: uses client (evidence: `mobile/src/services/uploadTrip.js`)
- Mobile data client → Supabase database: writes trip features (evidence: `README.md`)
- Bridge status → App state: reads bridge state (evidence: `mobile/src/screens/BridgeStatusScreen.js`)
- Dashboard route → Bridge dashboard: renders dashboard
- Bridge dashboard → Web data client: uses data client
- Web data client → Supabase database: subscribes to updates (evidence: `README.md`)
- App navigation → App fonts: loads fonts (evidence: `mobile/App.js`)
- App navigation → Visual tokens: uses colors (evidence: `mobile/App.js`)
- Nearby bridge list → Responsive scale: scales layout (evidence: `mobile/src/components/sheet/BridgeListSheet.js`)
- Nearby bridge list → Visual tokens: uses colors (evidence: `mobile/src/components/sheet/BridgeListSheet.js`)
- Nearby bridge list → App fonts: uses typography (evidence: `mobile/src/components/sheet/BridgeListSheet.js`)
- Sensor diagnostics → Responsive scale: scales layout (evidence: `mobile/src/screens/DebugSensorScreen.js`)
- Sensor diagnostics → Visual tokens: uses colors (evidence: `mobile/src/screens/DebugSensorScreen.js`)
- Bridge status → Visual tokens: uses colors (evidence: `mobile/src/screens/BridgeStatusScreen.js`)
- Bridge status → Responsive scale: scales layout (evidence: `mobile/src/screens/BridgeStatusScreen.js`)
