# amaklakovv/rubiks-solver architecture

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

- Interactive diagram: https://gitdiagram.com/amaklakovv/rubiks-solver
- Repository: https://github.com/amaklakovv/rubiks-solver

## Overview

This is a web-based Rubik’s Cube solver: a user uploads six face images, the backend decodes them and identifies sticker colors, then validates and orients the cube state before requesting a move sequence. The frontend displays the returned solution or an error. The source excerpts show the upload/API calls and backend processing calls; deployment and other unsampled behavior are not inferred.

Main entry points: [`backend/main.py`](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/main.py) (Solve API and decoding), [`frontend/src/App.jsx`](https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/App.jsx) (Upload and results), [`backend/solver.py`](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py) (State validation), [`frontend/src/main.jsx`](https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/main.jsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app_entry["React entry<br/>[main.jsx]"]
  node_upload_ui["Upload and results<br/>[App.jsx]"]
end

subgraph group_recognition["Image recognition"]
  node_solve_api["Solve API and decoding<br/>[main.py]"]
  node_face_detection["Face aggregation<br/>[main.py]"]
  node_sticker_recognition["Sticker color detection"]
end

subgraph group_solving["Cube solving"]
  node_cube_validation["State validation<br/>[solver.py]"]
  node_cube_orientation["Face orientation<br/>[solver.py]"]
  node_move_solver["Move generation<br/>[solver.py]"]
end

node_user(("Cube owner"))
node_kociemba["Kociemba library"]

node_user -->|"selects images"| node_upload_ui
node_app_entry -->|"renders"| node_upload_ui
node_upload_ui -->|"posts six images"| node_solve_api
node_solve_api -->|"passes decoded images"| node_face_detection
node_face_detection -->|"processes each face"| node_sticker_recognition
node_solve_api -->|"submits cube state"| node_cube_validation
node_cube_validation -->|"validates before orienting"| node_cube_orientation
node_cube_orientation -->|"builds solver string"| node_move_solver
node_move_solver -->|"requests moves"| node_kociemba
node_solve_api -->|"returns solution"| node_upload_ui

click node_app_entry "https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/main.jsx"
click node_upload_ui "https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/App.jsx"
click node_solve_api "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/main.py"
click node_face_detection "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/main.py"
click node_sticker_recognition "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/image_processing.py"
click node_cube_validation "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py"
click node_cube_orientation "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py"
click node_move_solver "https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.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_app_entry,node_upload_ui toneBlue
class node_solve_api,node_face_detection,node_sticker_recognition toneAmber
class node_cube_validation,node_cube_orientation,node_move_solver toneMint
class node_user,node_kociemba toneIndigo
```

## Components

### Web interface

- [React entry](https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Upload and results](https://github.com/amaklakovv/rubiks-solver/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Image recognition

- [Solve API and decoding](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/main.py): `backend/main.py`
- [Face aggregation](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/main.py): `backend/main.py`
- [Sticker color detection](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/image_processing.py): `backend/image_processing.py`

### Cube solving

- [State validation](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py): `backend/solver.py`
- [Face orientation](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py): `backend/solver.py`
- [Move generation](https://github.com/amaklakovv/rubiks-solver/blob/main/backend/solver.py): `backend/solver.py`

### Other components

- **Cube owner**
- **Kociemba library**

## Connections

- Cube owner → Upload and results: selects images (evidence: `frontend/src/App.jsx`)
- React entry → Upload and results: renders (evidence: `frontend/src/main.jsx`)
- Upload and results → Solve API and decoding: posts six images (evidence: `frontend/src/App.jsx`)
- Solve API and decoding → Face aggregation: passes decoded images (evidence: `backend/main.py`)
- Face aggregation → Sticker color detection: processes each face (evidence: `backend/main.py`)
- Solve API and decoding → State validation: submits cube state (evidence: `backend/main.py`)
- State validation → Face orientation: validates before orienting (evidence: `backend/solver.py`)
- Face orientation → Move generation: builds solver string (evidence: `backend/solver.py`)
- Move generation → Kociemba library: requests moves (evidence: `backend/solver.py`)
- Solve API and decoding → Upload and results: returns solution (evidence: `backend/main.py`)
