# dimizorgon/cube architecture

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

- Interactive diagram: https://gitdiagram.com/dimizorgon/cube
- Repository: https://github.com/dimizorgon/cube

## Overview

Cube Studio is a multilingual web platform for interactive cube simulation, speedcubing practice, method guides, and Bluetooth smart-cube analysis. Users enter through the site routes, choose a puzzle or tool, then manipulate a rendered cube, follow a guide, time a solve, or connect a smart cube. The cube store separates logical move validation from animated state; the smart-cube store coordinates device events and solve tracking. README capabilities are included where source excerpts are unavailable; those links are documented rather than inferred from folder names.

Main entry points: [`src/router.jsx`](https://github.com/dimizorgon/cube/blob/main/src/router.jsx) (Route table), [`src/store/useSmartCubeStore.js`](https://github.com/dimizorgon/cube/blob/main/src/store/useSmartCubeStore.js) (Smart-cube session), [`src/components/RubiksCube.jsx`](https://github.com/dimizorgon/cube/blob/main/src/components/RubiksCube.jsx) (3D cube renderer), [`src/components/algos/MethodeBlind3x3.jsx`](https://github.com/dimizorgon/cube/blob/main/src/components/algos/MethodeBlind3x3.jsx) (Method guides)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Navigation and language"]
  node_app["Application entry<br/>[App.jsx]"]
  node_router["Route table<br/>[router.jsx]"]
  node_route_config["Route configuration<br/>[routeConfig.js]"]
  node_localization["French and English<br/>[en.js]"]
end

subgraph group_simulation["Cube simulation"]
  node_game["Puzzle game<br/>[CubeGame.jsx]"]
  node_cube_view["3D cube renderer<br/>[RubiksCube.jsx]"]
  node_cubie["Cubie geometry<br/>[Cubie.jsx]"]
  node_cube_state["Cube state<br/>[useCubeStore.js]"]
  node_cube_math["Cube geometry math<br/>[cubeMath.js]"]
end

subgraph group_learning["Learning guides"]
  node_method_guides["Method guides"]
  node_method_data["Method case data<br/>[blind3x3Data.js]"]
  node_algo_viewer["Algorithm viewer<br/>[AlgoDemoModal.jsx]"]
  node_algo_parser["Algorithm parser<br/>[algoParser.js]"]
end

subgraph group_practice["Timing and settings"]
  node_settings_ui["Settings screen<br/>[SettingsPage.jsx]"]
  node_settings_state[("Persistent settings")]
  node_timer["Speed timer<br/>[SpeedTimer.jsx]"]
  node_scrambles["Scramble generator"]
  node_timer_stats["Solve records<br/>[timerUtils.js]"]
end

subgraph group_connected["Smart cube"]
  node_smart_page["Smart-cube screen<br/>[SmartCubePage.jsx]"]
  node_smart_state["Smart-cube session"]
  node_ble_driver["Bluetooth driver<br/>[ganBleDriver.js]"]
  node_protocol["GAN protocol<br/>[ganProtocol.js]"]
  node_cipher["Block cipher<br/>[aesBlockCipher.js]"]
  node_mac_address["Device address<br/>[macAddressUtils.js]"]
  node_phase_detector["Solve phase detector"]
  node_wca_stats["WCA statistics<br/>[wcaStats.js]"]
end

node_visitor(("Cube user"))

node_visitor -->|"opens"| node_app
node_app -->|"renders routes"| node_router
node_router -->|"resolves paths"| node_route_config
node_router -->|"routes to"| node_game
node_router -->|"routes to"| node_smart_page
node_router -->|"routes to"| node_timer
node_router -->|"routes to"| node_settings_ui
node_game -.->|"renders"| node_cube_view
node_cube_view -->|"renders"| node_cubie
node_cube_view -->|"reads and updates"| node_cube_state
node_cube_state -->|"computes rotations"| node_cube_math
node_settings_ui -->|"updates settings"| node_settings_state
node_cube_view -->|"reads preferences"| node_settings_state
node_timer -->|"generates scrambles"| node_scrambles
node_timer -->|"uses timing utilities"| node_timer_stats
node_visitor -.->|"studies methods"| node_method_guides
node_method_guides -->|"loads cases"| node_method_data
node_method_guides -->|"opens demonstrations"| node_algo_viewer
node_algo_viewer -->|"parses algorithms"| node_algo_parser
node_smart_page -->|"controls session"| node_smart_state
node_smart_page -->|"renders live cube"| node_cube_view
node_smart_state -->|"dispatches device actions"| node_ble_driver
node_smart_state -->|"loads cached address"| node_mac_address
node_ble_driver -->|"uses protocol"| node_protocol
node_protocol -->|"uses encryption"| node_cipher
node_smart_state -->|"tracks solve phases"| node_phase_detector
node_smart_state -->|"computes session stats"| node_wca_stats
node_router -->|"configures languages"| node_localization
node_method_guides -->|"localizes guide data"| node_localization

click node_app "https://github.com/dimizorgon/cube/blob/main/src/App.jsx"
click node_router "https://github.com/dimizorgon/cube/blob/main/src/router.jsx"
click node_route_config "https://github.com/dimizorgon/cube/blob/main/src/routes/routeConfig.js"
click node_localization "https://github.com/dimizorgon/cube/blob/main/src/i18n/en.js"
click node_game "https://github.com/dimizorgon/cube/blob/main/src/components/CubeGame.jsx"
click node_cube_view "https://github.com/dimizorgon/cube/blob/main/src/components/RubiksCube.jsx"
click node_cubie "https://github.com/dimizorgon/cube/blob/main/src/components/Cubie.jsx"
click node_cube_state "https://github.com/dimizorgon/cube/blob/main/src/store/useCubeStore.js"
click node_cube_math "https://github.com/dimizorgon/cube/blob/main/src/utils/cubeMath.js"
click node_settings_ui "https://github.com/dimizorgon/cube/blob/main/src/components/SettingsPage.jsx"
click node_settings_state "https://github.com/dimizorgon/cube/blob/main/src/store/useSettingsStore.js"
click node_timer "https://github.com/dimizorgon/cube/blob/main/src/components/SpeedTimer.jsx"
click node_scrambles "https://github.com/dimizorgon/cube/blob/main/src/utils/scrambleGenerator.js"
click node_timer_stats "https://github.com/dimizorgon/cube/blob/main/src/utils/timerUtils.js"
click node_method_guides "https://github.com/dimizorgon/cube/blob/main/src/components/algos/MethodeBlind3x3.jsx"
click node_method_data "https://github.com/dimizorgon/cube/blob/main/src/data/blind3x3Data.js"
click node_algo_viewer "https://github.com/dimizorgon/cube/blob/main/src/components/algos/AlgoDemoModal.jsx"
click node_algo_parser "https://github.com/dimizorgon/cube/blob/main/src/utils/algoParser.js"
click node_smart_page "https://github.com/dimizorgon/cube/blob/main/src/pages/SmartCubePage.jsx"
click node_smart_state "https://github.com/dimizorgon/cube/blob/main/src/store/useSmartCubeStore.js"
click node_ble_driver "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/ganBleDriver.js"
click node_protocol "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/ganProtocol.js"
click node_cipher "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/aesBlockCipher.js"
click node_mac_address "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/macAddressUtils.js"
click node_phase_detector "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/solvePhaseDetector.js"
click node_wca_stats "https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/wcaStats.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_router,node_route_config,node_localization,node_visitor toneBlue
class node_game,node_cube_view,node_cubie,node_cube_state,node_cube_math toneAmber
class node_method_guides,node_method_data,node_algo_viewer,node_algo_parser toneMint
class node_settings_ui,node_settings_state,node_timer,node_scrambles,node_timer_stats toneRose
class node_smart_page,node_smart_state,node_ble_driver,node_protocol,node_cipher,node_mac_address,node_phase_detector,node_wca_stats toneIndigo
```

## Components

### Navigation and language

- [Application entry](https://github.com/dimizorgon/cube/blob/main/src/App.jsx): `src/App.jsx`
- [Route table](https://github.com/dimizorgon/cube/blob/main/src/router.jsx): `src/router.jsx`
- [Route configuration](https://github.com/dimizorgon/cube/blob/main/src/routes/routeConfig.js): `src/routes/routeConfig.js`
- [French and English](https://github.com/dimizorgon/cube/blob/main/src/i18n/en.js): `src/i18n/en.js`

### Cube simulation

- [Puzzle game](https://github.com/dimizorgon/cube/blob/main/src/components/CubeGame.jsx): `src/components/CubeGame.jsx`
- [3D cube renderer](https://github.com/dimizorgon/cube/blob/main/src/components/RubiksCube.jsx): `src/components/RubiksCube.jsx`
- [Cubie geometry](https://github.com/dimizorgon/cube/blob/main/src/components/Cubie.jsx): `src/components/Cubie.jsx`
- [Cube state](https://github.com/dimizorgon/cube/blob/main/src/store/useCubeStore.js): `src/store/useCubeStore.js`
- [Cube geometry math](https://github.com/dimizorgon/cube/blob/main/src/utils/cubeMath.js): `src/utils/cubeMath.js`

### Learning guides

- [Method guides](https://github.com/dimizorgon/cube/blob/main/src/components/algos/MethodeBlind3x3.jsx): `src/components/algos/MethodeBlind3x3.jsx`
- [Method case data](https://github.com/dimizorgon/cube/blob/main/src/data/blind3x3Data.js): `src/data/blind3x3Data.js`
- [Algorithm viewer](https://github.com/dimizorgon/cube/blob/main/src/components/algos/AlgoDemoModal.jsx): `src/components/algos/AlgoDemoModal.jsx`
- [Algorithm parser](https://github.com/dimizorgon/cube/blob/main/src/utils/algoParser.js): `src/utils/algoParser.js`

### Timing and settings

- [Settings screen](https://github.com/dimizorgon/cube/blob/main/src/components/SettingsPage.jsx): `src/components/SettingsPage.jsx`
- [Persistent settings](https://github.com/dimizorgon/cube/blob/main/src/store/useSettingsStore.js): `src/store/useSettingsStore.js`
- [Speed timer](https://github.com/dimizorgon/cube/blob/main/src/components/SpeedTimer.jsx): `src/components/SpeedTimer.jsx`
- [Scramble generator](https://github.com/dimizorgon/cube/blob/main/src/utils/scrambleGenerator.js): `src/utils/scrambleGenerator.js`
- [Solve records](https://github.com/dimizorgon/cube/blob/main/src/utils/timerUtils.js): `src/utils/timerUtils.js`

### Smart cube

- [Smart-cube screen](https://github.com/dimizorgon/cube/blob/main/src/pages/SmartCubePage.jsx): `src/pages/SmartCubePage.jsx`
- [Smart-cube session](https://github.com/dimizorgon/cube/blob/main/src/store/useSmartCubeStore.js): `src/store/useSmartCubeStore.js`
- [Bluetooth driver](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/ganBleDriver.js): `src/utils/smartCube/ganBleDriver.js`
- [GAN protocol](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/ganProtocol.js): `src/utils/smartCube/ganProtocol.js`
- [Block cipher](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/aesBlockCipher.js): `src/utils/smartCube/aesBlockCipher.js`
- [Device address](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/macAddressUtils.js): `src/utils/smartCube/macAddressUtils.js`
- [Solve phase detector](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/solvePhaseDetector.js): `src/utils/smartCube/solvePhaseDetector.js`
- [WCA statistics](https://github.com/dimizorgon/cube/blob/main/src/utils/smartCube/wcaStats.js): `src/utils/smartCube/wcaStats.js`

### Other components

- **Cube user**

## Connections

- Cube user → Application entry: opens
- Application entry → Route table: renders routes (evidence: `src/App.jsx`)
- Route table → Route configuration: resolves paths (evidence: `src/router.jsx`)
- Route table → Puzzle game: routes to (evidence: `src/router.jsx`)
- Route table → Smart-cube screen: routes to (evidence: `src/router.jsx`)
- Route table → Speed timer: routes to
- Route table → Settings screen: routes to
- Puzzle game → 3D cube renderer: renders
- 3D cube renderer → Cubie geometry: renders (evidence: `src/components/RubiksCube.jsx`)
- 3D cube renderer → Cube state: reads and updates (evidence: `src/components/RubiksCube.jsx`)
- Cube state → Cube geometry math: computes rotations (evidence: `src/store/useCubeStore.js`)
- Settings screen → Persistent settings: updates settings (evidence: `src/components/SettingsPage.jsx`)
- 3D cube renderer → Persistent settings: reads preferences (evidence: `src/components/RubiksCube.jsx`)
- Speed timer → Scramble generator: generates scrambles (evidence: `src/components/SpeedTimer.jsx`)
- Speed timer → Solve records: uses timing utilities (evidence: `src/components/SpeedTimer.jsx`)
- Cube user → Method guides: studies methods
- Method guides → Method case data: loads cases (evidence: `src/components/algos/MethodeBlind3x3.jsx`)
- Method guides → Algorithm viewer: opens demonstrations (evidence: `src/components/algos/MethodeBlind3x3.jsx`)
- Algorithm viewer → Algorithm parser: parses algorithms (evidence: `src/components/algos/AlgoDemoModal.jsx`)
- Smart-cube screen → Smart-cube session: controls session (evidence: `src/pages/SmartCubePage.jsx`)
- Smart-cube screen → 3D cube renderer: renders live cube (evidence: `src/pages/SmartCubePage.jsx`)
- Smart-cube session → Bluetooth driver: dispatches device actions (evidence: `src/store/useSmartCubeStore.js`)
- Smart-cube session → Device address: loads cached address (evidence: `src/store/useSmartCubeStore.js`)
- Bluetooth driver → GAN protocol: uses protocol (evidence: `src/utils/smartCube/ganBleDriver.js`)
- GAN protocol → Block cipher: uses encryption (evidence: `src/utils/smartCube/ganProtocol.js`)
- Smart-cube session → Solve phase detector: tracks solve phases (evidence: `src/store/useSmartCubeStore.js`)
- Smart-cube session → WCA statistics: computes session stats (evidence: `src/store/useSmartCubeStore.js`)
- Route table → French and English: configures languages
- Method guides → French and English: localizes guide data (evidence: `src/components/algos/MethodeBlind3x3.jsx`)
