# rabbit20031225/lmu-telemetry-lab architecture

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

- Interactive diagram: https://gitdiagram.com/rabbit20031225/lmu-telemetry-lab
- Repository: https://github.com/rabbit20031225/lmu-telemetry-lab

## Overview

#### Purpose and Entry Points
LMU Telemetry Lab is a Windows desktop telemetry-analysis application for Le Mans Ultimate recordings. It combines a React analysis UI, a local FastAPI service that parses/manages telemetry sessions, and an Electron packaging/runtime shell. Primary entry points are `backend/main.py`, `frontend/src/main.tsx`, and `desktop/main.js`.

#### Desktop Composition and Delivery
Electron hosts the local application and bridges desktop capabilities such as native file/folder selection to the web UI. The production build packages the Python backend through PyInstaller and creates a Windows installer through the build script. Relevant paths: `desktop/main.js`, `backend.spec`, `build_app.bat`.

#### API Boundary and Backend Orchestration
FastAPI exposes the frontend-facing REST surface and delegates domain work to services. This is the principal boundary between browser-rendered analysis state and filesystem-backed telemetry processing. API routing is concentrated in `backend/app/api/endpoints.py`, with application startup in `backend/main.py` and backend package initialization at `backend/app/__init__.py`.

#### Telemetry Session Pipeline
Telemetry ingestion, session discovery, lap extraction, playback normalization, and analysis payload generation are centered in the telemetry service. Source recordings originate from the local Le Mans Ultimate telemetry folder; managed sessions are represented with DuckDB per the product behavior. Track geometry and corner metadata supplement recorded data. Paths: `backend/app/services/telemetry_service.py`, `backend/app/data/track_corners.json`, `backend/app/utils/track_db.py`.

#### Domain Enrichment and Export Integrations
Backend services enrich session data with vehicle, track elevation, and track metadata; separate services manage user profiles, setup export, and Discord sharing. Discord is an external service with a repository template for local credentials/configuration. Paths: `backend/app/services/car_lookup.py`, `backend/app/services/elevation_service.py`, `backend/app/services/discord_service.py`.

#### Analysis Workspace and State
The React/Vite frontend owns interactive playback, selected/reference laps, chart/map synchronization, HUD layout, and API calls. A centralized telemetry store is the likely client-state coordination point between the dashboard and visual components. Core paths: `frontend/src/App.tsx`, `frontend/src/store/telemetryStore.ts`, `frontend/src/api/client.ts`.

#### Visualization and Comparison Layers
The dashboard composes 2D/3D track visualization, multi-channel telemetry charts, lap selectors, and modular overlays. Cross-session reference laps drive comparison/ghost-car presentation; 3D rendering is isolated under the Lab3D component boundary. Paths: `frontend/src/components/F1Dashboard.tsx`, `frontend/src/components/TrackMap3D.tsx`, `frontend/src/components/Lab3D/Lab3DRoot.tsx`.

#### Ancillary Web Presence and Deployment
A separate Vite landing page is independent of the desktop analysis frontend. GitHub Pages deployment is automated through the repository workflow, making GitHub Pages and GitHub releases/update checks material external infrastructure. Paths: `landing-page/src/main.tsx`, `landing-page/src/App.tsx`, `.github/workflows/deploy-pages.yml`.

Main entry points: [`backend/app/services/telemetry_service.py`](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/telemetry_service.py) (Telemetry service), [`desktop/main.js`](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/desktop/main.js) (Electron shell), [`backend/main.py`](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/main.py) (FastAPI startup), [`backend/app/api/endpoints.py`](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/api/endpoints.py) (REST API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Runtime"]
  node_electron["Electron shell<br/>desktop runtime<br/>[main.js]"]
  node_pyinstaller["PyInstaller package<br/>backend packaging<br/>[backend.spec]"]
  node_windows_installer["Windows installer build<br/>delivery script<br/>[build_app.bat]"]
end

subgraph group_backend["Local Backend"]
  node_backend_main["FastAPI startup<br/>application entry<br/>[main.py]"]
  node_api["REST API routes<br/>API boundary<br/>[endpoints.py]"]
  node_backend_package["Backend package<br/>package initialization<br/>[__init__.py]"]
  node_telemetry_service["Telemetry service<br/>session pipeline"]
  node_recordings[("LMU telemetry folder<br/>local recording source")]
  node_sessions[("Managed sessions<br/>DuckDB storage")]
  node_track_data["Track geometry and corners<br/>track metadata<br/>[track_corners.json]"]
  node_track_db["Track database utility<br/>track data access<br/>[track_db.py]"]
  node_enrichment["Vehicle and elevation enrichment<br/>domain services<br/>[car_lookup.py]"]
  node_discord_service["Discord sharing<br/>integration service<br/>[discord_service.py]"]
end

subgraph group_frontend["Analysis Frontend"]
  node_frontend_main["React entry<br/>application entry<br/>[main.tsx]"]
  node_app["Analysis workspace<br/>React application<br/>[App.tsx]"]
  node_telemetry_store["Telemetry store<br/>client state<br/>[telemetryStore.ts]"]
  node_api_client["API client<br/>REST client<br/>[client.ts]"]
  node_dashboard["Dashboard<br/>analysis composition<br/>[F1Dashboard.tsx]"]
  node_track_map_3d["3D track visualization<br/>[TrackMap3D.tsx]"]
  node_lab3d["Lab3D renderer<br/>3D component boundary<br/>[Lab3DRoot.tsx]"]
end

subgraph group_landing["Landing Site"]
  node_landing_main["Landing entry<br/>Vite entry<br/>[main.tsx]"]
  node_landing_app["Landing page<br/>marketing UI<br/>[App.tsx]"]
  node_pages_workflow["Pages deployment<br/>GitHub workflow<br/>[deploy-pages.yml]"]
end

node_discord{{"Discord<br/>external sharing service"}}
node_github_pages{{"GitHub Pages<br/>external hosting"}}
node_github_releases{{"GitHub releases<br/>external updates"}}

node_windows_installer -->|"packages"| node_pyinstaller
node_pyinstaller -->|"bundles"| node_backend_main
node_windows_installer -->|"builds"| node_electron
node_electron -->|"hosts"| node_frontend_main
node_electron -->|"runs local service"| node_backend_main
node_electron -.->|"checks updates"| node_github_releases
node_frontend_main -->|"mounts"| node_app
node_app -->|"reads and updates"| node_telemetry_store
node_app -->|"composes"| node_dashboard
node_dashboard -->|"renders"| node_track_map_3d
node_track_map_3d -->|"uses"| node_lab3d
node_telemetry_store -->|"loads telemetry"| node_api_client
node_api_client -->|"REST requests"| node_api
node_backend_main -->|"serves"| node_api
node_backend_main -->|"initializes"| node_backend_package
node_api -->|"delegates sessions"| node_telemetry_service
node_api -->|"delegates sharing"| node_discord_service
node_telemetry_service -->|"discovers and parses"| node_recordings
node_telemetry_service -->|"manages"| node_sessions
node_telemetry_service -->|"uses corners"| node_track_data
node_telemetry_service -->|"queries track data"| node_track_db
node_telemetry_service -->|"enriches payloads"| node_enrichment
node_discord_service -->|"shares to"| node_discord
node_landing_main -->|"mounts"| node_landing_app
node_pages_workflow -->|"deploys"| node_landing_app
node_pages_workflow -->|"publishes to"| node_github_pages

click node_electron "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/desktop/main.js"
click node_pyinstaller "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend.spec"
click node_windows_installer "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/build_app.bat"
click node_backend_main "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/main.py"
click node_api "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/api/endpoints.py"
click node_backend_package "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/__init__.py"
click node_telemetry_service "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/telemetry_service.py"
click node_track_data "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/data/track_corners.json"
click node_track_db "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/utils/track_db.py"
click node_enrichment "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/car_lookup.py"
click node_discord_service "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/discord_service.py"
click node_frontend_main "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/main.tsx"
click node_app "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/App.tsx"
click node_telemetry_store "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/store/telemetryStore.ts"
click node_api_client "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/api/client.ts"
click node_dashboard "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/F1Dashboard.tsx"
click node_track_map_3d "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/TrackMap3D.tsx"
click node_lab3d "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/Lab3D/Lab3DRoot.tsx"
click node_landing_main "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/landing-page/src/main.tsx"
click node_landing_app "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/landing-page/src/App.tsx"
click node_pages_workflow "https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/.github/workflows/deploy-pages.yml"

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_electron,node_pyinstaller,node_windows_installer toneBlue
class node_backend_main,node_api,node_backend_package,node_telemetry_service,node_recordings,node_sessions,node_track_data,node_track_db,node_enrichment,node_discord_service toneAmber
class node_frontend_main,node_app,node_telemetry_store,node_api_client,node_dashboard,node_track_map_3d,node_lab3d toneMint
class node_landing_main,node_landing_app,node_pages_workflow toneRose
class node_discord,node_github_pages,node_github_releases toneNeutral
```

## Components

### Desktop Runtime

- [Electron shell](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/desktop/main.js): desktop runtime · Hosts the local analysis application and native dialogs. · `desktop/main.js`
- [PyInstaller package](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend.spec): backend packaging · `backend.spec`
- [Windows installer build](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/build_app.bat): delivery script · `build_app.bat`

### Local Backend

- [FastAPI startup](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/main.py): application entry · `backend/main.py`
- [REST API routes](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/api/endpoints.py): API boundary · Frontend-facing endpoints for telemetry and desktop actions. · `backend/app/api/endpoints.py`
- [Backend package](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/__init__.py): package initialization · `backend/app/__init__.py`
- [Telemetry service](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/telemetry_service.py): session pipeline · Discovers recordings, extracts laps, normalizes playback, and builds analysis payloads. · `backend/app/services/telemetry_service.py`
- **LMU telemetry folder**: local recording source
- **Managed sessions**: DuckDB storage
- [Track geometry and corners](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/data/track_corners.json): track metadata · `backend/app/data/track_corners.json`
- [Track database utility](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/utils/track_db.py): track data access · `backend/app/utils/track_db.py`
- [Vehicle and elevation enrichment](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/car_lookup.py): domain services · `backend/app/services/car_lookup.py`
- [Discord sharing](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/backend/app/services/discord_service.py): integration service · `backend/app/services/discord_service.py`

### Analysis Frontend

- [React entry](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/main.tsx): application entry · `frontend/src/main.tsx`
- [Analysis workspace](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/App.tsx): React application · Owns interactive playback, lap comparison, HUD, and synchronized analysis views. · `frontend/src/App.tsx`
- [Telemetry store](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/store/telemetryStore.ts): client state · Coordinates selected and reference laps across the workspace. · `frontend/src/store/telemetryStore.ts`
- [API client](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/api/client.ts): REST client · `frontend/src/api/client.ts`
- [Dashboard](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/F1Dashboard.tsx): analysis composition · `frontend/src/components/F1Dashboard.tsx`
- [3D track visualization](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/TrackMap3D.tsx): visualization · `frontend/src/components/TrackMap3D.tsx`
- [Lab3D renderer](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/frontend/src/components/Lab3D/Lab3DRoot.tsx): 3D component boundary · `frontend/src/components/Lab3D/Lab3DRoot.tsx`

### Landing Site

- [Landing entry](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/landing-page/src/main.tsx): Vite entry · `landing-page/src/main.tsx`
- [Landing page](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/landing-page/src/App.tsx): marketing UI · `landing-page/src/App.tsx`
- [Pages deployment](https://github.com/rabbit20031225/lmu-telemetry-lab/blob/main/.github/workflows/deploy-pages.yml): GitHub workflow · `.github/workflows/deploy-pages.yml`

### Other components

- **Discord**: external sharing service
- **GitHub Pages**: external hosting
- **GitHub releases**: external updates

## Connections

- Windows installer build → PyInstaller package: packages
- PyInstaller package → FastAPI startup: bundles
- Windows installer build → Electron shell: builds
- Electron shell → React entry: hosts
- Electron shell → FastAPI startup: runs local service
- Electron shell → GitHub releases: checks updates
- React entry → Analysis workspace: mounts
- Analysis workspace → Telemetry store: reads and updates
- Analysis workspace → Dashboard: composes
- Dashboard → 3D track visualization: renders
- 3D track visualization → Lab3D renderer: uses
- Telemetry store → API client: loads telemetry
- API client → REST API routes: REST requests
- FastAPI startup → REST API routes: serves
- FastAPI startup → Backend package: initializes
- REST API routes → Telemetry service: delegates sessions
- REST API routes → Discord sharing: delegates sharing
- Telemetry service → LMU telemetry folder: discovers and parses
- Telemetry service → Managed sessions: manages
- Telemetry service → Track geometry and corners: uses corners
- Telemetry service → Track database utility: queries track data
- Telemetry service → Vehicle and elevation enrichment: enriches payloads
- Discord sharing → Discord: shares to
- Landing entry → Landing page: mounts
- Pages deployment → Landing page: deploys
- Pages deployment → GitHub Pages: publishes to
