# anxand/rf1 architecture

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

- Interactive diagram: https://gitdiagram.com/anxand/rf1
- Repository: https://github.com/anxand/rf1

## Overview

RF1 is a Rabbit R1 Formula 1 telemetry companion. The main workflow is selecting a live session or replay, obtaining live or simulated race data, then presenting it through the HUD, teammate comparison, timing tower, and race-control alerts. The browser app coordinates these features; the simulator, track catalogue, hardware adapter, and optional local server support the experience. Several view details are documented in the README, but their full rendering and event wiring were not sampled, so those relationships are shown only where supported.

Main entry points: [`js/app.js`](https://github.com/anxand/rf1/blob/main/js/app.js) (App Coordinator), [`js/openf1.js`](https://github.com/anxand/rf1/blob/main/js/openf1.js) (OpenF1 Client), [`server/server.js`](https://github.com/anxand/rf1/blob/main/server/server.js) (Optional Local Server), [`js/liveTiming.js`](https://github.com/anxand/rf1/blob/main/js/liveTiming.js) (Live Timing Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Race Experience"]
  node_app["App Coordinator<br/>[app.js]"]
  node_race["Race Selector<br/>[app.js]"]
  node_hud["Cockpit HUD<br/>[app.js]"]
  node_split["Teammate Split<br/>[app.js]"]
  node_tower["Timing Tower<br/>[app.js]"]
  node_flags["Race Control Alerts<br/>[app.js]"]
end

subgraph group_data["Timing Data"]
  node_liveclient["Live Timing Client<br/>[liveTiming.js]"]
  node_openf1["OpenF1 Client<br/>[openf1.js]"]
end

subgraph group_runtime["Telemetry Runtime"]
  node_tracks["Track Catalogue<br/>[tracks.js]"]
  node_simulator["Race Simulator<br/>[simulator.js]"]
end

subgraph group_integration["Device and Server"]
  node_hardware["R1 Hardware Adapter<br/>[hardware.js]"]
  node_localserver["Optional Local Server<br/>[server.js]"]
end

node_r1(("Rabbit R1 User"))
node_livetiming_service["Live Timing API"]
node_openf1_service["OpenF1 API"]

node_r1 -->|"uses"| node_app
node_app -->|"selects replay"| node_simulator
node_app -->|"fetches timing"| node_liveclient
node_app -->|"checks session"| node_openf1
node_liveclient -->|"requests data"| node_livetiming_service
node_openf1 -->|"requests data"| node_openf1_service
node_app -->|"presents"| node_race
node_app -->|"presents"| node_hud
node_app -->|"presents"| node_split
node_app -->|"presents"| node_tower
node_app -->|"presents"| node_flags
node_app -.->|"uses circuits"| node_tracks
node_app -.->|"handles controls"| node_hardware
node_localserver -->|"serves simulation"| node_simulator
node_localserver -->|"requests telemetry"| node_openf1

click node_app "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_race "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_hud "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_split "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_tower "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_flags "https://github.com/anxand/rf1/blob/main/js/app.js"
click node_tracks "https://github.com/anxand/rf1/blob/main/js/tracks.js"
click node_simulator "https://github.com/anxand/rf1/blob/main/js/simulator.js"
click node_liveclient "https://github.com/anxand/rf1/blob/main/js/liveTiming.js"
click node_openf1 "https://github.com/anxand/rf1/blob/main/js/openf1.js"
click node_hardware "https://github.com/anxand/rf1/blob/main/js/hardware.js"
click node_localserver "https://github.com/anxand/rf1/blob/main/server/server.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_race,node_hud,node_split,node_tower,node_flags,node_r1 toneBlue
class node_liveclient,node_openf1 toneAmber
class node_tracks,node_simulator,node_livetiming_service,node_openf1_service toneMint
class node_hardware,node_localserver toneRose
```

## Components

### Race Experience

- [App Coordinator](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`
- [Race Selector](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`
- [Cockpit HUD](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`
- [Teammate Split](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`
- [Timing Tower](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`
- [Race Control Alerts](https://github.com/anxand/rf1/blob/main/js/app.js): `js/app.js`

### Timing Data

- [Live Timing Client](https://github.com/anxand/rf1/blob/main/js/liveTiming.js): `js/liveTiming.js`
- [OpenF1 Client](https://github.com/anxand/rf1/blob/main/js/openf1.js): `js/openf1.js`

### Telemetry Runtime

- [Track Catalogue](https://github.com/anxand/rf1/blob/main/js/tracks.js): `js/tracks.js`
- [Race Simulator](https://github.com/anxand/rf1/blob/main/js/simulator.js): `js/simulator.js`

### Device and Server

- [R1 Hardware Adapter](https://github.com/anxand/rf1/blob/main/js/hardware.js): `js/hardware.js`
- [Optional Local Server](https://github.com/anxand/rf1/blob/main/server/server.js): `server/server.js`

### Other components

- **Rabbit R1 User**
- **Live Timing API**
- **OpenF1 API**

## Connections

- Rabbit R1 User → App Coordinator: uses (evidence: `README.md`)
- App Coordinator → Race Simulator: selects replay (evidence: `js/app.js`)
- App Coordinator → Live Timing Client: fetches timing (evidence: `js/app.js`)
- App Coordinator → OpenF1 Client: checks session (evidence: `js/app.js`)
- Live Timing Client → Live Timing API: requests data (evidence: `js/liveTiming.js`)
- OpenF1 Client → OpenF1 API: requests data (evidence: `js/openf1.js`)
- App Coordinator → Race Selector: presents (evidence: `README.md`)
- App Coordinator → Cockpit HUD: presents (evidence: `README.md`)
- App Coordinator → Teammate Split: presents (evidence: `README.md`)
- App Coordinator → Timing Tower: presents (evidence: `README.md`)
- App Coordinator → Race Control Alerts: presents (evidence: `README.md`)
- App Coordinator → Track Catalogue: uses circuits
- App Coordinator → R1 Hardware Adapter: handles controls
- Optional Local Server → Race Simulator: serves simulation (evidence: `server/server.js`)
- Optional Local Server → OpenF1 Client: requests telemetry (evidence: `server/server.js`)
