# harpita-p/beyond-the-horizon architecture

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

- Interactive diagram: https://gitdiagram.com/harpita-p/beyond-the-horizon
- Repository: https://github.com/harpita-p/beyond-the-horizon

## Overview

Beyond the Horizon is a React-based Team USA Olympic and Paralympic exploration experience. Fans enter an interactive 3D U.S. map, ask questions through Gemini Live, and see geographic highlights and data visualizations; they can also inspect state-level history, explore collective athlete stories, and play GeoQuest using Street View. The map scene coordinates these user-facing paths, with CSV analysis and Gemini services providing an internal data-and-agent layer. Relationships below follow shown imports/calls or README descriptions; some feature wiring is documented but its implementation was not sampled.

Main entry points: [`src/components/3d/Scene.tsx`](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/Scene.tsx) (Interactive Scene), [`src/hooks/useGeminiLive.ts`](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/hooks/useGeminiLive.ts) (Gemini Live Voice), [`src/components/GeoSeeker.tsx`](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/GeoSeeker.tsx) (GeoQuest Game), [`src/services/geoSeekerService.ts`](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geoSeekerService.ts) (GeoQuest Locations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["3D Fan Experience"]
  node_scene["Interactive Scene<br/>[Scene.tsx]"]
  node_map["3D U.S. Map<br/>[USMap3D.tsx]"]
  node_flight["Flight Controls<br/>[Falcon.tsx]"]
  node_keyboard["Keyboard Input<br/>[useKeyboard.ts]"]
  node_charts["Chart Panels<br/>[ChartPanel.tsx]"]
  node_hometown_chart["Hometown Chart"]
  node_pie_chart["Medal Chart<br/>[PieChartPanel.tsx]"]
end

subgraph group_analysis["Data Analysis"]
  node_athlete_data["Athlete CSVs"]
  node_csv_service["CSV Statistics<br/>[csvDataService.ts]"]
  node_analyst["Chart Analysis"]
end

subgraph group_agents["Gemini Agents"]
  node_live["Gemini Live Voice<br/>[useGeminiLive.ts]"]
  node_gemini{{"Gemini API"}}
  node_state_selector["State Selection"]
  node_hometown_info["Hometown Intelligence"]
end

subgraph group_exploration["GeoQuest"]
  node_geo_panel["GeoQuest Panel<br/>[GeoSeekerPanel.tsx]"]
  node_geo_game["GeoQuest Game<br/>[GeoSeeker.tsx]"]
  node_geo_service["GeoQuest Locations"]
  node_geo_gemini["Geo Clues"]
  node_street_view{{"Google Street View"}}
end

subgraph group_stories["Collective Stories"]
  node_story_panel["Story Panel<br/>[StoryPanel.tsx]"]
  node_story_agent["Story Generation<br/>[geminiService.ts]"]
  node_story_articles["Collective Articles"]
end

node_fan(("Fan"))

node_fan -->|"explores"| node_scene
node_scene -->|"renders"| node_map
node_scene -->|"renders"| node_flight
node_flight -->|"reads input"| node_keyboard
node_scene -->|"starts voice"| node_live
node_live -->|"streams voice"| node_gemini
node_scene -->|"loads statistics"| node_csv_service
node_csv_service -.->|"reads CSVs"| node_athlete_data
node_scene -->|"generates charts"| node_analyst
node_analyst -.->|"reads CSVs"| node_athlete_data
node_scene -->|"renders"| node_charts
node_scene -->|"renders"| node_hometown_chart
node_scene -->|"renders"| node_pie_chart
node_live -.->|"highlights states"| node_map
node_scene -.->|"selects states"| node_state_selector
node_scene -.->|"loads state insights"| node_hometown_info
node_scene -->|"opens stories"| node_story_panel
node_story_panel -.->|"requests narrative"| node_story_agent
node_story_agent -.->|"generates narrative"| node_gemini
node_story_agent -.->|"uses article content"| node_story_articles
node_scene -.->|"starts game"| node_geo_game
node_geo_game -->|"requests locations"| node_geo_service
node_geo_service -->|"reads athlete CSV"| node_athlete_data
node_geo_service -->|"requests clues"| node_geo_gemini
node_geo_gemini -->|"generates clues"| node_gemini
node_geo_game -.->|"shows clues"| node_geo_panel
node_geo_panel -->|"loads panorama"| node_street_view

click node_scene "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/Scene.tsx"
click node_map "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/USMap3D.tsx"
click node_flight "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/Falcon.tsx"
click node_keyboard "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/hooks/useKeyboard.ts"
click node_charts "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/ChartPanel.tsx"
click node_hometown_chart "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/HometownBarChart.tsx"
click node_pie_chart "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/PieChartPanel.tsx"
click node_athlete_data "https://github.com/harpita-p/beyond-the-horizon/tree/main/public"
click node_csv_service "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/csvDataService.ts"
click node_analyst "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/dataAnalystAgent.ts"
click node_live "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/hooks/useGeminiLive.ts"
click node_state_selector "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiStateSelector.ts"
click node_hometown_info "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/hometownInfoService.ts"
click node_story_panel "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/StoryPanel.tsx"
click node_story_agent "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiService.ts"
click node_story_articles "https://github.com/harpita-p/beyond-the-horizon/tree/main/public"
click node_geo_panel "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/GeoSeekerPanel.tsx"
click node_geo_game "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/GeoSeeker.tsx"
click node_geo_service "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geoSeekerService.ts"
click node_geo_gemini "https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiGeoService.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_scene,node_map,node_flight,node_keyboard,node_charts,node_hometown_chart,node_pie_chart toneBlue
class node_athlete_data,node_csv_service,node_analyst toneAmber
class node_live,node_gemini,node_state_selector,node_hometown_info toneMint
class node_geo_panel,node_geo_game,node_geo_service,node_geo_gemini,node_street_view toneRose
class node_story_panel,node_story_agent,node_story_articles,node_fan toneIndigo
```

## Components

### 3D Fan Experience

- [Interactive Scene](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/Scene.tsx): `src/components/3d/Scene.tsx`
- [3D U.S. Map](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/USMap3D.tsx): `src/components/3d/USMap3D.tsx`
- [Flight Controls](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/Falcon.tsx): `src/components/3d/Falcon.tsx`
- [Keyboard Input](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/hooks/useKeyboard.ts): `src/hooks/useKeyboard.ts`
- [Chart Panels](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/ChartPanel.tsx): `src/components/3d/ChartPanel.tsx`
- [Hometown Chart](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/HometownBarChart.tsx): `src/components/3d/HometownBarChart.tsx`
- [Medal Chart](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/3d/PieChartPanel.tsx): `src/components/3d/PieChartPanel.tsx`

### Data Analysis

- [Athlete CSVs](https://github.com/harpita-p/beyond-the-horizon/tree/main/public): `public`
- [CSV Statistics](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/csvDataService.ts): `src/services/csvDataService.ts`
- [Chart Analysis](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/dataAnalystAgent.ts): `src/services/dataAnalystAgent.ts`

### Gemini Agents

- [Gemini Live Voice](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/hooks/useGeminiLive.ts): `src/hooks/useGeminiLive.ts`
- **Gemini API**
- [State Selection](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiStateSelector.ts): `src/services/geminiStateSelector.ts`
- [Hometown Intelligence](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/hometownInfoService.ts): `src/services/hometownInfoService.ts`

### GeoQuest

- [GeoQuest Panel](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/GeoSeekerPanel.tsx): `src/components/GeoSeekerPanel.tsx`
- [GeoQuest Game](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/GeoSeeker.tsx): `src/components/GeoSeeker.tsx`
- [GeoQuest Locations](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geoSeekerService.ts): `src/services/geoSeekerService.ts`
- [Geo Clues](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiGeoService.ts): `src/services/geminiGeoService.ts`
- **Google Street View**

### Collective Stories

- [Story Panel](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/components/StoryPanel.tsx): `src/components/StoryPanel.tsx`
- [Story Generation](https://github.com/harpita-p/beyond-the-horizon/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Collective Articles](https://github.com/harpita-p/beyond-the-horizon/tree/main/public): `public`

### Other components

- **Fan**

## Connections

- Fan → Interactive Scene: explores (evidence: `README.md`)
- Interactive Scene → 3D U.S. Map: renders (evidence: `src/components/3d/Scene.tsx`)
- Interactive Scene → Flight Controls: renders (evidence: `src/components/3d/Scene.tsx`)
- Flight Controls → Keyboard Input: reads input (evidence: `src/components/3d/Falcon.tsx`)
- Interactive Scene → Gemini Live Voice: starts voice (evidence: `src/components/3d/Scene.tsx`)
- Gemini Live Voice → Gemini API: streams voice (evidence: `src/hooks/useGeminiLive.ts`)
- Interactive Scene → CSV Statistics: loads statistics (evidence: `src/components/3d/Scene.tsx`)
- CSV Statistics → Athlete CSVs: reads CSVs (evidence: `README.md`)
- Interactive Scene → Chart Analysis: generates charts (evidence: `src/components/3d/Scene.tsx`)
- Chart Analysis → Athlete CSVs: reads CSVs (evidence: `README.md`)
- Interactive Scene → Chart Panels: renders (evidence: `src/components/3d/Scene.tsx`)
- Interactive Scene → Hometown Chart: renders (evidence: `src/components/3d/Scene.tsx`)
- Interactive Scene → Medal Chart: renders (evidence: `src/components/3d/Scene.tsx`)
- Gemini Live Voice → 3D U.S. Map: highlights states (evidence: `README.md`)
- Interactive Scene → State Selection: selects states (evidence: `README.md`)
- Interactive Scene → Hometown Intelligence: loads state insights (evidence: `README.md`)
- Interactive Scene → Story Panel: opens stories (evidence: `src/components/3d/Scene.tsx`)
- Story Panel → Story Generation: requests narrative (evidence: `README.md`)
- Story Generation → Gemini API: generates narrative (evidence: `README.md`)
- Story Generation → Collective Articles: uses article content (evidence: `README.md`)
- Interactive Scene → GeoQuest Game: starts game (evidence: `README.md`)
- GeoQuest Game → GeoQuest Locations: requests locations (evidence: `src/components/GeoSeeker.tsx`)
- GeoQuest Locations → Athlete CSVs: reads athlete CSV (evidence: `src/services/geoSeekerService.ts`)
- GeoQuest Locations → Geo Clues: requests clues (evidence: `src/services/geoSeekerService.ts`)
- Geo Clues → Gemini API: generates clues (evidence: `src/services/geminiGeoService.ts`)
- GeoQuest Game → GeoQuest Panel: shows clues
- GeoQuest Panel → Google Street View: loads panorama (evidence: `src/components/GeoSeekerPanel.tsx`)
