# anicolao/blueroux architecture

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

- Interactive diagram: https://gitdiagram.com/anicolao/blueroux
- Repository: https://github.com/anicolao/blueroux

## Overview

Blueroux appears to be a browser-based Rubik’s Cube solving and practice application: it supports custom solving methods, solve reconstruction and optimization, solve/timer and analysis screens, and GAN smart-cube pairing. A solve can be reconstructed into configured stages and optimized in a worker; the sampled code supports those internal calls, but does not show how the route screens initiate them. The README is an untouched Svelte starter template, so product capabilities are inferred from the source tree and module names; unsampled route behavior and wiring are not asserted.

Main entry points: [`src/lib/store.ts`](https://github.com/anicolao/blueroux/blob/main/src/lib/store.ts) (Application state), [`src/lib/components/MethodReconstruction.ts`](https://github.com/anicolao/blueroux/blob/main/src/lib/components/MethodReconstruction.ts) (Stage reconstruction), [`src/lib/bluetooth/bluetooth.ts`](https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/bluetooth.ts) (Bluetooth GATT), [`src/lib/OptimizerWorker.ts`](https://github.com/anicolao/blueroux/blob/main/src/lib/OptimizerWorker.ts) (Optimization worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application screens"]
  node_app_layout["App shell<br/>[+layout.svelte]"]
  node_practice_routes["Practice screens<br/>[+page.svelte]"]
  node_analysis_route["Analysis screen<br/>[+page.svelte]"]
  node_history_route["Solve history<br/>[+page.svelte]"]
  node_method_editor["Method editor<br/>[+page.svelte]"]
  node_embed_routes["Embed views<br/>[+page.svelte]"]
end

subgraph group_solve["Solve methods"]
  node_solve_view["Solve display<br/>[Solve.svelte]"]
  node_reconstruction["Stage reconstruction"]
  node_optimizer_worker["Optimization worker<br/>[OptimizerWorker.ts]"]
  node_optimizer["Solution optimizer<br/>[optimizer.ts]"]
  node_methods["Method definitions<br/>[methods.ts]"]
  node_stages["Stage definitions<br/>[stages.ts]"]
end

subgraph group_cube["Smart cube"]
  node_cube_routes["Bluetooth screen<br/>[+page.svelte]"]
  node_pairing["Device pairing<br/>[pair.ts]"]
  node_gatt["Bluetooth GATT<br/>[bluetooth.ts]"]
  node_gan_v1["GAN protocol v1<br/>[gan356i_v1.ts]"]
  node_gan_v2["GAN protocol v2<br/>[gan356i_v2.ts]"]
end

subgraph group_state["State and services"]
  node_store["Application state<br/>[store.ts]"]
  node_auth_state["Authentication state<br/>[auth.ts]"]
  node_preferences["User preferences<br/>[preferences.ts]"]
  node_cubes["Cube records<br/>[cubes.ts]"]
  node_solves["Solve records<br/>[solves.ts]"]
  node_firebase["Firebase adapter<br/>[firebase.ts]"]
end

node_user(("User"))
node_browser_bluetooth["Browser Bluetooth"]
node_firebase_service[("Firebase services")]

node_optimizer_worker -->|"analyzes solve"| node_reconstruction
node_optimizer_worker -->|"optimizes stages"| node_optimizer
node_reconstruction -->|"visualizes cube"| node_optimizer
node_reconstruction -->|"reads method map"| node_methods
node_reconstruction -->|"reads stage rules"| node_stages
node_store -->|"registers reducer"| node_auth_state
node_store -->|"registers reducer"| node_methods
node_store -->|"registers reducer"| node_stages
node_store -->|"registers reducer"| node_preferences
node_store -->|"registers reducer"| node_cubes
node_store -->|"registers reducer"| node_solves
node_firebase -->|"reads user state"| node_store
node_firebase -->|"uses Firestore"| node_firebase_service
node_pairing -->|"requests device"| node_gatt
node_gatt -->|"requests device"| node_browser_bluetooth
node_gan_v1 -->|"reads characteristics"| node_gatt
node_gan_v2 -->|"reads characteristics"| node_gatt
node_gan_v2 -->|"reuses protocol code"| node_gan_v1

click node_app_layout "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/%2Blayout.svelte"
click node_practice_routes "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/timer/%2Bpage.svelte"
click node_analysis_route "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/analysis/%2Bpage.svelte"
click node_history_route "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/history_edu/%2Bpage.svelte"
click node_method_editor "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/mask_editor/%2Bpage.svelte"
click node_embed_routes "https://github.com/anicolao/blueroux/blob/main/src/routes/(embed)/embed/%2Bpage.svelte"
click node_solve_view "https://github.com/anicolao/blueroux/blob/main/src/lib/components/Solve.svelte"
click node_reconstruction "https://github.com/anicolao/blueroux/blob/main/src/lib/components/MethodReconstruction.ts"
click node_optimizer_worker "https://github.com/anicolao/blueroux/blob/main/src/lib/OptimizerWorker.ts"
click node_optimizer "https://github.com/anicolao/blueroux/blob/main/src/lib/optimizer/optimizer.ts"
click node_methods "https://github.com/anicolao/blueroux/blob/main/src/lib/components/methods.ts"
click node_stages "https://github.com/anicolao/blueroux/blob/main/src/lib/components/stages.ts"
click node_cube_routes "https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/bluetooth/%2Bpage.svelte"
click node_pairing "https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/pair.ts"
click node_gatt "https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/bluetooth.ts"
click node_gan_v1 "https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/gan/gan356i_v1.ts"
click node_gan_v2 "https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/gan/gan356i_v2.ts"
click node_store "https://github.com/anicolao/blueroux/blob/main/src/lib/store.ts"
click node_auth_state "https://github.com/anicolao/blueroux/blob/main/src/lib/components/auth.ts"
click node_preferences "https://github.com/anicolao/blueroux/blob/main/src/lib/components/preferences.ts"
click node_cubes "https://github.com/anicolao/blueroux/blob/main/src/lib/components/cubes.ts"
click node_solves "https://github.com/anicolao/blueroux/blob/main/src/lib/components/solves.ts"
click node_firebase "https://github.com/anicolao/blueroux/blob/main/src/lib/firebase.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_app_layout,node_practice_routes,node_analysis_route,node_history_route,node_method_editor,node_embed_routes,node_user,node_browser_bluetooth toneBlue
class node_solve_view,node_reconstruction,node_optimizer_worker,node_optimizer,node_methods,node_stages,node_firebase_service toneAmber
class node_cube_routes,node_pairing,node_gatt,node_gan_v1,node_gan_v2 toneMint
class node_store,node_auth_state,node_preferences,node_cubes,node_solves,node_firebase toneRose
```

## Components

### Application screens

- [App shell](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/%2Blayout.svelte): `src/routes/(app)/+layout.svelte`
- [Practice screens](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/timer/%2Bpage.svelte): `src/routes/(app)/timer/+page.svelte`
- [Analysis screen](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/analysis/%2Bpage.svelte): `src/routes/(app)/analysis/+page.svelte`
- [Solve history](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/history_edu/%2Bpage.svelte): `src/routes/(app)/history_edu/+page.svelte`
- [Method editor](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/mask_editor/%2Bpage.svelte): `src/routes/(app)/mask_editor/+page.svelte`
- [Embed views](https://github.com/anicolao/blueroux/blob/main/src/routes/(embed)/embed/%2Bpage.svelte): `src/routes/(embed)/embed/+page.svelte`

### Solve methods

- [Solve display](https://github.com/anicolao/blueroux/blob/main/src/lib/components/Solve.svelte): `src/lib/components/Solve.svelte`
- [Stage reconstruction](https://github.com/anicolao/blueroux/blob/main/src/lib/components/MethodReconstruction.ts): `src/lib/components/MethodReconstruction.ts`
- [Optimization worker](https://github.com/anicolao/blueroux/blob/main/src/lib/OptimizerWorker.ts): `src/lib/OptimizerWorker.ts`
- [Solution optimizer](https://github.com/anicolao/blueroux/blob/main/src/lib/optimizer/optimizer.ts): `src/lib/optimizer/optimizer.ts`
- [Method definitions](https://github.com/anicolao/blueroux/blob/main/src/lib/components/methods.ts): `src/lib/components/methods.ts`
- [Stage definitions](https://github.com/anicolao/blueroux/blob/main/src/lib/components/stages.ts): `src/lib/components/stages.ts`

### Smart cube

- [Bluetooth screen](https://github.com/anicolao/blueroux/blob/main/src/routes/(app)/bluetooth/%2Bpage.svelte): `src/routes/(app)/bluetooth/+page.svelte`
- [Device pairing](https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/pair.ts): `src/lib/bluetooth/pair.ts`
- [Bluetooth GATT](https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/bluetooth.ts): `src/lib/bluetooth/bluetooth.ts`
- [GAN protocol v1](https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/gan/gan356i_v1.ts): `src/lib/bluetooth/gan/gan356i_v1.ts`
- [GAN protocol v2](https://github.com/anicolao/blueroux/blob/main/src/lib/bluetooth/gan/gan356i_v2.ts): `src/lib/bluetooth/gan/gan356i_v2.ts`

### State and services

- [Application state](https://github.com/anicolao/blueroux/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [Authentication state](https://github.com/anicolao/blueroux/blob/main/src/lib/components/auth.ts): `src/lib/components/auth.ts`
- [User preferences](https://github.com/anicolao/blueroux/blob/main/src/lib/components/preferences.ts): `src/lib/components/preferences.ts`
- [Cube records](https://github.com/anicolao/blueroux/blob/main/src/lib/components/cubes.ts): `src/lib/components/cubes.ts`
- [Solve records](https://github.com/anicolao/blueroux/blob/main/src/lib/components/solves.ts): `src/lib/components/solves.ts`
- [Firebase adapter](https://github.com/anicolao/blueroux/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`

### Other components

- **User**
- **Browser Bluetooth**
- **Firebase services**

## Connections

- Optimization worker → Stage reconstruction: analyzes solve (evidence: `src/lib/OptimizerWorker.ts`)
- Optimization worker → Solution optimizer: optimizes stages (evidence: `src/lib/OptimizerWorker.ts`)
- Stage reconstruction → Solution optimizer: visualizes cube (evidence: `src/lib/components/MethodReconstruction.ts`)
- Stage reconstruction → Method definitions: reads method map (evidence: `src/lib/components/MethodReconstruction.ts`)
- Stage reconstruction → Stage definitions: reads stage rules (evidence: `src/lib/components/MethodReconstruction.ts`)
- Application state → Authentication state: registers reducer (evidence: `src/lib/store.ts`)
- Application state → Method definitions: registers reducer (evidence: `src/lib/store.ts`)
- Application state → Stage definitions: registers reducer (evidence: `src/lib/store.ts`)
- Application state → User preferences: registers reducer (evidence: `src/lib/store.ts`)
- Application state → Cube records: registers reducer (evidence: `src/lib/store.ts`)
- Application state → Solve records: registers reducer (evidence: `src/lib/store.ts`)
- Firebase adapter → Application state: reads user state (evidence: `src/lib/firebase.ts`)
- Firebase adapter → Firebase services: uses Firestore (evidence: `src/lib/firebase.ts`)
- Device pairing → Bluetooth GATT: requests device (evidence: `src/lib/bluetooth/pair.ts`)
- Bluetooth GATT → Browser Bluetooth: requests device (evidence: `src/lib/bluetooth/bluetooth.ts`)
- GAN protocol v1 → Bluetooth GATT: reads characteristics (evidence: `src/lib/bluetooth/gan/gan356i_v1.ts`)
- GAN protocol v2 → Bluetooth GATT: reads characteristics (evidence: `src/lib/bluetooth/gan/gan356i_v2.ts`)
- GAN protocol v2 → GAN protocol v1: reuses protocol code (evidence: `src/lib/bluetooth/gan/gan356i_v2.ts`)
