# kgpianghosh006/cubicon-app architecture

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

- Interactive diagram: https://gitdiagram.com/kgpianghosh006/cubicon-app
- Repository: https://github.com/kgpianghosh006/cubicon-app

## Overview

Cubicon accepts a cube state through camera scanning, manual facelet editing, or scramble notation; the frontend validates it, requests a backend solution, and presents the moves in a 3D player. The backend exposes REST endpoints for validation, solving, scrambling, and face scanning, with several cube representations and search algorithms; IDA* uses a corner pattern database. The graph preserves these documented capabilities. Some endpoint internals and UI wiring are unsampled, so only documented or excerpt-supported relationships are connected.

Main entry points: [`backend/server/main.cpp`](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/main.cpp) (REST API and orchestration), [`frontend/src/App.jsx`](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/App.jsx) (Solver interface), [`backend/Model/RubiksCube.h`](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube.h) (Cube operations), [`frontend/src/components/CameraScanner.jsx`](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CameraScanner.jsx) (Camera scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Solver interface<br/>[App.jsx]"]
  node_camera["Camera scanner<br/>[CameraScanner.jsx]"]
  node_editor["Facelet editor<br/>[CubeNet.jsx]"]
  node_scramble["Scramble input<br/>[ScrambleInput.jsx]"]
  node_player["3D solution player<br/>[CubePlayer.jsx]"]
  node_stateutils["Move utilities<br/>[cubeStateUtils.js]"]
  node_client["API client<br/>[apiClient.js]"]
end

subgraph group_api["API and orchestration"]
  node_server["REST API and orchestration<br/>[main.cpp]"]
  node_http["HTTP server library<br/>[httplib.h]"]
  node_json["JSON library<br/>[json.hpp]"]
end

subgraph group_cube["Cube model"]
  node_validator["Cube validation<br/>[Validator.h]"]
  node_cube_base["Cube operations<br/>[RubiksCube.h]"]
  node_cube_1d["1D representation"]
  node_cube_3d["3D representation"]
  node_cube_bitboard["Bitboard representation"]
end

subgraph group_search["Search and heuristics"]
  node_bfs["BFS solver<br/>[BFSSolver.h]"]
  node_dfs["DFS solver<br/>[DFSSolver.h]"]
  node_iddfs["IDDFS solver<br/>[IDDFSSolver.h]"]
  node_ida["IDA* solver<br/>[IDAstarSolver.h]"]
  node_corner_pdb["Corner pattern database"]
  node_pdb["Pattern database storage"]
  node_nibble["Packed move values<br/>[NibbleArray.cpp]"]
  node_pdb_file[("Precomputed corner data<br/>[cornerDepth5V1.txt]")]
end

node_user(("Cube solver user"))

node_user -->|"uses"| node_app
node_app -->|"offers scanning"| node_camera
node_app -->|"offers editing"| node_editor
node_app -->|"accepts notation"| node_scramble
node_app -->|"requests validation and solving"| node_client
node_app -->|"formats moves"| node_stateutils
node_app -->|"renders playback"| node_player
node_client -->|"calls REST endpoints"| node_server
node_camera -.->|"submits scanned face"| node_server
node_server -->|"serves routes"| node_http
node_server -->|"parses requests"| node_json
node_server -->|"validates states"| node_validator
node_server -->|"selects representation"| node_cube_1d
node_server -->|"selects representation"| node_cube_3d
node_server -->|"selects representation"| node_cube_bitboard
node_cube_1d -->|"implements"| node_cube_base
node_cube_3d -->|"implements"| node_cube_base
node_cube_bitboard -->|"implements"| node_cube_base
node_server -->|"dispatches solver"| node_bfs
node_server -->|"dispatches solver"| node_dfs
node_server -->|"dispatches solver"| node_iddfs
node_server -->|"dispatches solver"| node_ida
node_ida -->|"queries heuristic"| node_corner_pdb
node_corner_pdb -->|"extends storage"| node_pdb
node_pdb -->|"stores packed values"| node_nibble
node_server -->|"loads precomputed data"| node_pdb_file
node_app -.->|"requests scan and scramble services"| node_server

click node_app "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/App.jsx"
click node_camera "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CameraScanner.jsx"
click node_editor "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CubeNet.jsx"
click node_scramble "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/ScrambleInput.jsx"
click node_player "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CubePlayer.jsx"
click node_stateutils "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/lib/cubeStateUtils.js"
click node_client "https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/lib/apiClient.js"
click node_server "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/main.cpp"
click node_http "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/httplib.h"
click node_json "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/json.hpp"
click node_validator "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/Validator.h"
click node_cube_base "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube.h"
click node_cube_1d "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube1dArray.cpp"
click node_cube_3d "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube3dArray.cpp"
click node_cube_bitboard "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCubeBitboard.cpp"
click node_bfs "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/BFSSolver.h"
click node_dfs "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/DFSSolver.h"
click node_iddfs "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/IDDFSSolver.h"
click node_ida "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/IDAstarSolver.h"
click node_corner_pdb "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/CornerPatternDatabase.h"
click node_pdb "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/PatternDatabase.cpp"
click node_nibble "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/NibbleArray.cpp"
click node_pdb_file "https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Databases/cornerDepth5V1.txt"

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_camera,node_editor,node_scramble,node_player,node_stateutils,node_client,node_user toneBlue
class node_server,node_http,node_json toneAmber
class node_validator,node_cube_base,node_cube_1d,node_cube_3d,node_cube_bitboard toneMint
class node_bfs,node_dfs,node_iddfs,node_ida,node_corner_pdb,node_pdb,node_nibble,node_pdb_file toneRose
```

## Components

### Frontend experience

- [Solver interface](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Camera scanner](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CameraScanner.jsx): `frontend/src/components/CameraScanner.jsx`
- [Facelet editor](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CubeNet.jsx): `frontend/src/components/CubeNet.jsx`
- [Scramble input](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/ScrambleInput.jsx): `frontend/src/components/ScrambleInput.jsx`
- [3D solution player](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/components/CubePlayer.jsx): `frontend/src/components/CubePlayer.jsx`
- [Move utilities](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/lib/cubeStateUtils.js): `frontend/src/lib/cubeStateUtils.js`
- [API client](https://github.com/kgpianghosh006/cubicon-app/blob/main/frontend/src/lib/apiClient.js): `frontend/src/lib/apiClient.js`

### API and orchestration

- [REST API and orchestration](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/main.cpp): `backend/server/main.cpp`
- [HTTP server library](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/httplib.h): `backend/server/httplib.h`
- [JSON library](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/server/json.hpp): `backend/server/json.hpp`

### Cube model

- [Cube validation](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/Validator.h): `backend/Model/Validator.h`
- [Cube operations](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube.h): `backend/Model/RubiksCube.h`
- [1D representation](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube1dArray.cpp): `backend/Model/RubiksCube1dArray.cpp`
- [3D representation](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCube3dArray.cpp): `backend/Model/RubiksCube3dArray.cpp`
- [Bitboard representation](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Model/RubiksCubeBitboard.cpp): `backend/Model/RubiksCubeBitboard.cpp`

### Search and heuristics

- [BFS solver](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/BFSSolver.h): `backend/Solver/BFSSolver.h`
- [DFS solver](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/DFSSolver.h): `backend/Solver/DFSSolver.h`
- [IDDFS solver](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/IDDFSSolver.h): `backend/Solver/IDDFSSolver.h`
- [IDA* solver](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Solver/IDAstarSolver.h): `backend/Solver/IDAstarSolver.h`
- [Corner pattern database](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/CornerPatternDatabase.h): `backend/PatternDatabases/CornerPatternDatabase.h`
- [Pattern database storage](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/PatternDatabase.cpp): `backend/PatternDatabases/PatternDatabase.cpp`
- [Packed move values](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/PatternDatabases/NibbleArray.cpp): `backend/PatternDatabases/NibbleArray.cpp`
- [Precomputed corner data](https://github.com/kgpianghosh006/cubicon-app/blob/main/backend/Databases/cornerDepth5V1.txt): `backend/Databases/cornerDepth5V1.txt`

### Other components

- **Cube solver user**

## Connections

- Cube solver user → Solver interface: uses (evidence: `README.md`)
- Solver interface → Camera scanner: offers scanning (evidence: `frontend/src/App.jsx`)
- Solver interface → Facelet editor: offers editing (evidence: `frontend/src/App.jsx`)
- Solver interface → Scramble input: accepts notation (evidence: `frontend/src/App.jsx`)
- Solver interface → API client: requests validation and solving (evidence: `frontend/src/App.jsx`)
- Solver interface → Move utilities: formats moves (evidence: `frontend/src/App.jsx`)
- Solver interface → 3D solution player: renders playback (evidence: `frontend/src/App.jsx`)
- API client → REST API and orchestration: calls REST endpoints (evidence: `README.md`)
- Camera scanner → REST API and orchestration: submits scanned face
- REST API and orchestration → HTTP server library: serves routes (evidence: `backend/server/main.cpp`)
- REST API and orchestration → JSON library: parses requests (evidence: `backend/server/main.cpp`)
- REST API and orchestration → Cube validation: validates states (evidence: `backend/server/main.cpp`)
- REST API and orchestration → 1D representation: selects representation (evidence: `backend/server/main.cpp`)
- REST API and orchestration → 3D representation: selects representation (evidence: `backend/server/main.cpp`)
- REST API and orchestration → Bitboard representation: selects representation (evidence: `backend/server/main.cpp`)
- 1D representation → Cube operations: implements (evidence: `backend/Model/RubiksCube1dArray.cpp`)
- 3D representation → Cube operations: implements (evidence: `backend/Model/RubiksCube3dArray.cpp`)
- Bitboard representation → Cube operations: implements (evidence: `backend/Model/RubiksCubeBitboard.cpp`)
- REST API and orchestration → BFS solver: dispatches solver (evidence: `backend/server/main.cpp`)
- REST API and orchestration → DFS solver: dispatches solver (evidence: `backend/server/main.cpp`)
- REST API and orchestration → IDDFS solver: dispatches solver (evidence: `backend/server/main.cpp`)
- REST API and orchestration → IDA* solver: dispatches solver (evidence: `backend/server/main.cpp`)
- IDA* solver → Corner pattern database: queries heuristic (evidence: `backend/Solver/IDAstarSolver.h`)
- Corner pattern database → Pattern database storage: extends storage (evidence: `backend/PatternDatabases/CornerPatternDatabase.h`)
- Pattern database storage → Packed move values: stores packed values (evidence: `backend/PatternDatabases/PatternDatabase.cpp`)
- REST API and orchestration → Precomputed corner data: loads precomputed data (evidence: `backend/server/main.cpp`)
- Solver interface → REST API and orchestration: requests scan and scramble services
