# sundareshwaransukumar/bluelock architecture

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

- Interactive diagram: https://gitdiagram.com/sundareshwaransukumar/bluelock
- Repository: https://github.com/sundareshwaransukumar/bluelock

## Overview

BlueLock combines a fan-facing stadium app with a FastAPI operations API. The documented journey runs from role selection through seat booking and commute guidance, into live stadium and stats views; directors use a separate control room to redirect gate load. Backend stages cover seat inventory, gate assignment and bypass, AI guidance, and live cricket/traffic telemetry. Source excerpts show the API orchestration and telemetry loop; several frontend and integration implementations are unsampled, so their undocumented internal links are omitted.

Main entry points: [`backend/routes/v1_routes.py`](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/routes/v1_routes.py) (REST and WebSocket API), [`backend/services/traffic_service.py`](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/traffic_service.py) (Telemetry broadcaster), [`backend/controllers/ticket_controller.py`](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/ticket_controller.py) (Seat and ticket booking), [`backend/config/gate_state.py`](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/gate_state.py) (Gate state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fan["Fan experience"]
  node_journey["Role selection<br/>[RoleChooser.tsx]"]
  node_booking["Booking and commute"]
  node_confirmation["Ticket confirmation"]
  node_stadium["Stadium command<br/>[IsoStadium.tsx]"]
  node_stats["Stats hub<br/>[StatsHub.tsx]"]
end

subgraph group_ops["Director operations"]
  node_admin["Director control room<br/>[AdminDashboard.tsx]"]
  node_gategrid["Gate telemetry"]
end

subgraph group_api["API and booking"]
  node_api["REST and WebSocket API<br/>[v1_routes.py]"]
  node_contracts["API contracts<br/>[schemas.py]"]
  node_frontend_contracts["UI contracts"]
  node_ticket["Seat and ticket booking"]
  node_admin_control["Bypass control"]
  node_assistant["Assistant orchestration<br/>[ai_controller.py]"]
  node_adapter["Frontend adapter"]
  node_database[("SQLite seat store<br/>[database.py]")]
  node_gemini["Gemini guidance<br/>[gemini_service.py]"]
end

subgraph group_live["Live operations data"]
  node_gate_state["Gate state<br/>[gate_state.py]"]
  node_app_state["Stadium snapshot state<br/>[app_state.py]"]
  node_traffic["Telemetry broadcaster<br/>[traffic_service.py]"]
  node_cricket["Cricket feed<br/>[cricket_service.py]"]
  node_road_traffic["Google Routes traffic"]
end

node_fan(("Fans"))
node_directors(("Directors"))

node_fan -->|"chooses role"| node_journey
node_journey -->|"continues to"| node_booking
node_booking -->|"books ticket"| node_api
node_api -->|"returns pass"| node_confirmation
node_fan -->|"views stadium"| node_stadium
node_fan -->|"opens stats"| node_stats
node_directors -->|"operates"| node_admin
node_admin -->|"issues bypass"| node_api
node_admin -->|"shows telemetry"| node_gategrid
node_api -->|"validates requests"| node_contracts
node_api -->|"validates UI requests"| node_frontend_contracts
node_api -->|"routes booking"| node_ticket
node_api -->|"routes bypass"| node_admin_control
node_api -->|"routes assistant"| node_assistant
node_api -->|"routes UI requests"| node_adapter
node_api -->|"opens sessions"| node_database
node_api -->|"registers stream clients"| node_traffic
node_ticket -->|"reads and updates seats"| node_database
node_ticket -->|"assigns gate load"| node_gate_state
node_ticket -->|"requests transit advice"| node_gemini
node_admin_control -->|"applies bypass"| node_gate_state
node_assistant -->|"builds gate context"| node_gate_state
node_assistant -->|"generates guidance"| node_gemini
node_traffic -->|"updates snapshot"| node_app_state
node_traffic -->|"reads gate state"| node_gate_state
node_traffic -->|"fetches match data"| node_cricket
node_traffic -->|"fetches venue traffic"| node_road_traffic
node_traffic -->|"broadcasts packets"| node_api
node_api -->|"reads snapshot"| node_app_state
node_road_traffic --> node_gemini

click node_journey "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/landing/RoleChooser.tsx"
click node_booking "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/ticketing/BookingCommuteForm.tsx"
click node_confirmation "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/ticketing/BookingConfirmation.tsx"
click node_stadium "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/stadium/IsoStadium.tsx"
click node_stats "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/stats/StatsHub.tsx"
click node_admin "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/admin/AdminDashboard.tsx"
click node_gategrid "https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/admin/GateTelemetryGrid.tsx"
click node_api "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/routes/v1_routes.py"
click node_contracts "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/models/schemas.py"
click node_frontend_contracts "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/models/frontend_contracts.py"
click node_ticket "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/ticket_controller.py"
click node_admin_control "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/admin_controller.py"
click node_assistant "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/ai_controller.py"
click node_adapter "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/frontend_adapter.py"
click node_database "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/database.py"
click node_gate_state "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/gate_state.py"
click node_app_state "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/app_state.py"
click node_traffic "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/traffic_service.py"
click node_cricket "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/cricket_service.py"
click node_road_traffic "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/google_traffic_service.py"
click node_gemini "https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/gemini_service.py"

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_journey,node_booking,node_confirmation,node_stadium,node_stats toneBlue
class node_admin,node_gategrid toneAmber
class node_api,node_contracts,node_frontend_contracts,node_ticket,node_admin_control,node_assistant,node_adapter,node_database,node_gemini toneMint
class node_gate_state,node_app_state,node_traffic,node_cricket,node_road_traffic toneRose
class node_fan,node_directors toneIndigo
```

## Components

### Fan experience

- [Role selection](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/landing/RoleChooser.tsx): `frontend/src/components/landing/RoleChooser.tsx`
- [Booking and commute](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/ticketing/BookingCommuteForm.tsx): `frontend/src/components/ticketing/BookingCommuteForm.tsx`
- [Ticket confirmation](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/ticketing/BookingConfirmation.tsx): `frontend/src/components/ticketing/BookingConfirmation.tsx`
- [Stadium command](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/stadium/IsoStadium.tsx): `frontend/src/components/stadium/IsoStadium.tsx`
- [Stats hub](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/stats/StatsHub.tsx): `frontend/src/components/stats/StatsHub.tsx`

### Director operations

- [Director control room](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/admin/AdminDashboard.tsx): `frontend/src/components/admin/AdminDashboard.tsx`
- [Gate telemetry](https://github.com/sundareshwaransukumar/bluelock/blob/main/frontend/src/components/admin/GateTelemetryGrid.tsx): `frontend/src/components/admin/GateTelemetryGrid.tsx`

### API and booking

- [REST and WebSocket API](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/routes/v1_routes.py): `backend/routes/v1_routes.py`
- [API contracts](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/models/schemas.py): `backend/models/schemas.py`
- [UI contracts](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/models/frontend_contracts.py): `backend/models/frontend_contracts.py`
- [Seat and ticket booking](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/ticket_controller.py): `backend/controllers/ticket_controller.py`
- [Bypass control](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/admin_controller.py): `backend/controllers/admin_controller.py`
- [Assistant orchestration](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/controllers/ai_controller.py): `backend/controllers/ai_controller.py`
- [Frontend adapter](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/frontend_adapter.py): `backend/services/frontend_adapter.py`
- [SQLite seat store](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/database.py): `backend/config/database.py`
- [Gemini guidance](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/gemini_service.py): `backend/services/gemini_service.py`

### Live operations data

- [Gate state](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/gate_state.py): `backend/config/gate_state.py`
- [Stadium snapshot state](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/config/app_state.py): `backend/config/app_state.py`
- [Telemetry broadcaster](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/traffic_service.py): `backend/services/traffic_service.py`
- [Cricket feed](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/cricket_service.py): `backend/services/cricket_service.py`
- [Google Routes traffic](https://github.com/sundareshwaransukumar/bluelock/blob/main/backend/services/google_traffic_service.py): `backend/services/google_traffic_service.py`

### Other components

- **Fans**
- **Directors**

## Connections

- Fans → Role selection: chooses role
- Role selection → Booking and commute: continues to
- Booking and commute → REST and WebSocket API: books ticket
- REST and WebSocket API → Ticket confirmation: returns pass
- Fans → Stadium command: views stadium
- Fans → Stats hub: opens stats
- Directors → Director control room: operates
- Director control room → REST and WebSocket API: issues bypass
- Director control room → Gate telemetry: shows telemetry (evidence: `frontend/src/components/admin/AdminDashboard.tsx`)
- REST and WebSocket API → API contracts: validates requests (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → UI contracts: validates UI requests (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → Seat and ticket booking: routes booking (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → Bypass control: routes bypass (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → Assistant orchestration: routes assistant (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → Frontend adapter: routes UI requests (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → SQLite seat store: opens sessions (evidence: `backend/routes/v1_routes.py`)
- REST and WebSocket API → Telemetry broadcaster: registers stream clients (evidence: `backend/routes/v1_routes.py`)
- Seat and ticket booking → SQLite seat store: reads and updates seats (evidence: `backend/controllers/ticket_controller.py`)
- Seat and ticket booking → Gate state: assigns gate load (evidence: `backend/controllers/ticket_controller.py`)
- Seat and ticket booking → Gemini guidance: requests transit advice (evidence: `backend/controllers/ticket_controller.py`)
- Bypass control → Gate state: applies bypass (evidence: `backend/controllers/admin_controller.py`)
- Assistant orchestration → Gate state: builds gate context (evidence: `backend/controllers/ai_controller.py`)
- Assistant orchestration → Gemini guidance: generates guidance (evidence: `backend/controllers/ai_controller.py`)
- Telemetry broadcaster → Stadium snapshot state: updates snapshot (evidence: `backend/services/traffic_service.py`)
- Telemetry broadcaster → Gate state: reads gate state (evidence: `backend/services/traffic_service.py`)
- Telemetry broadcaster → Cricket feed: fetches match data (evidence: `backend/services/traffic_service.py`)
- Telemetry broadcaster → Google Routes traffic: fetches venue traffic (evidence: `backend/services/traffic_service.py`)
- Telemetry broadcaster → REST and WebSocket API: broadcasts packets (evidence: `backend/services/traffic_service.py`)
- REST and WebSocket API → Stadium snapshot state: reads snapshot (evidence: `backend/routes/v1_routes.py`)
- Google Routes traffic → Gemini guidance
