# pioix/2026-tpf-g02 architecture

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

- Interactive diagram: https://gitdiagram.com/pioix/2026-tpf-g02
- Repository: https://github.com/pioix/2026-tpf-g02

## Overview

Gartic Pio is a multiplayer drawing-and-description game. The player flow runs from account entry through room creation or joining, alternating text and drawing rounds, then synchronized album revelation; the product also includes past-album browsing and administrator tools. The backend combines HTTP routes with Socket.IO room and round logic, while MySQL supports account and administration data. Some frontend pages and persistence features are documented but not sampled, so those links reflect README statements rather than inspected implementation details.

Main entry points: [`backend/index.js`](https://github.com/pioix/2026-tpf-g02/blob/main/backend/index.js) (Express and Socket.IO), [`frontend/src/app/page.js`](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/page.js) (Login and signup), [`frontend/src/hooks/useSocket.js`](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/hooks/useSocket.js) (Socket client), [`frontend/src/app/menu/page.js`](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/menu/page.js) (Game menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Player experience"]
  node_login["Login and signup<br/>[page.js]"]
  node_menu["Game menu<br/>[page.js]"]
  node_lobby["Room lobby<br/>[page.js]"]
  node_socket_hook["Socket client<br/>[useSocket.js]"]
  node_write["Write phase<br/>[page.js]"]
  node_draw["Draw phase<br/>[page.js]"]
  node_reveal["Album reveal<br/>[page.js]"]
  node_history["Past albums<br/>[page.js]"]
end

subgraph group_realtime["Realtime game"]
  node_backend["Express and Socket.IO<br/>[index.js]"]
  node_room_routes["Room HTTP routes<br/>[salas.js]"]
  node_room_logic["Room state<br/>[logicaSalas.js]"]
  node_round_logic["Round and album logic<br/>[logicaPartida.js]"]
end

subgraph group_accounts["Accounts and admin"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_admin_page["Admin panel<br/>[page.js]"]
  node_admin_routes["Admin operations<br/>[admin.js]"]
  node_mysql["MySQL access<br/>[mysql.js]"]
  node_database[("MySQL database")]
end

subgraph group_shared["Shared interface"]
  node_button["Button<br/>[Button.js]"]
  node_avatar["Avatar<br/>[Avatar.js]"]
  node_logo["Logo<br/>[Logo.js]"]
end

node_player(("Player"))

node_player -->|"opens"| node_login
node_login -->|"HTTP login"| node_auth_routes
node_auth_routes -->|"queries"| node_mysql
node_mysql -.->|"reads and writes"| node_database
node_login -->|"routes player"| node_menu
node_menu -.->|"creates room"| node_room_routes
node_player -->|"joins room"| node_lobby
node_lobby -.->|"uses sockets"| node_socket_hook
node_socket_hook -.->|"sends events"| node_backend
node_room_routes -->|"creates and checks"| node_room_logic
node_backend -->|"manages room state"| node_room_logic
node_backend -->|"requests round tasks"| node_round_logic
node_backend -.->|"sends round task"| node_write
node_backend -.->|"sends round task"| node_draw
node_write -.->|"submits text"| node_socket_hook
node_draw -.->|"submits drawing"| node_socket_hook
node_backend -.->|"synchronizes albums"| node_reveal
node_player -->|"browses albums"| node_history
node_login -->|"routes admin"| node_admin_page
node_admin_page -->|"fetches admin data"| node_admin_routes
node_admin_routes -->|"queries"| node_mysql
node_backend -->|"registers routes"| node_auth_routes
node_backend -->|"registers routes"| node_admin_routes
node_login -->|"renders"| node_button
node_login -.->|"shows user identity"| node_avatar
node_menu -.->|"shows branding"| node_logo

click node_login "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/page.js"
click node_menu "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/menu/page.js"
click node_lobby "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/salas/page.js"
click node_socket_hook "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/hooks/useSocket.js"
click node_write "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/escribir/page.js"
click node_draw "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/dibujar/page.js"
click node_reveal "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/albumsrevelacion/page.js"
click node_history "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/albumsrevelacion/page.js"
click node_backend "https://github.com/pioix/2026-tpf-g02/blob/main/backend/index.js"
click node_room_routes "https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/salas.js"
click node_room_logic "https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/logicaSalas.js"
click node_round_logic "https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/logicaPartida.js"
click node_auth_routes "https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/auth.js"
click node_admin_page "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/admin/page.js"
click node_admin_routes "https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/admin.js"
click node_mysql "https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/mysql.js"
click node_button "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Button.js"
click node_avatar "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Avatar.js"
click node_logo "https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Logo.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_login,node_menu,node_lobby,node_socket_hook,node_write,node_draw,node_reveal,node_history toneBlue
class node_backend,node_room_routes,node_room_logic,node_round_logic toneAmber
class node_auth_routes,node_admin_page,node_admin_routes,node_mysql,node_database toneMint
class node_button,node_avatar,node_logo toneRose
class node_player toneIndigo
```

## Components

### Player experience

- [Login and signup](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Game menu](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/menu/page.js): `frontend/src/app/menu/page.js`
- [Room lobby](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/salas/page.js): `frontend/src/app/salas/page.js`
- [Socket client](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/hooks/useSocket.js): `frontend/src/hooks/useSocket.js`
- [Write phase](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/escribir/page.js): `frontend/src/app/escribir/page.js`
- [Draw phase](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/dibujar/page.js): `frontend/src/app/dibujar/page.js`
- [Album reveal](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/albumsrevelacion/page.js): `frontend/src/app/albumsrevelacion/page.js`
- [Past albums](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/albumsrevelacion/page.js): `frontend/src/app/albumsrevelacion/page.js`

### Realtime game

- [Express and Socket.IO](https://github.com/pioix/2026-tpf-g02/blob/main/backend/index.js): `backend/index.js`
- [Room HTTP routes](https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/salas.js): `backend/routes/salas.js`
- [Room state](https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/logicaSalas.js): `backend/modulos/logicaSalas.js`
- [Round and album logic](https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/logicaPartida.js): `backend/modulos/logicaPartida.js`

### Accounts and admin

- [Authentication routes](https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Admin panel](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/app/admin/page.js): `frontend/src/app/admin/page.js`
- [Admin operations](https://github.com/pioix/2026-tpf-g02/blob/main/backend/routes/admin.js): `backend/routes/admin.js`
- [MySQL access](https://github.com/pioix/2026-tpf-g02/blob/main/backend/modulos/mysql.js): `backend/modulos/mysql.js`
- **MySQL database**

### Shared interface

- [Button](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Button.js): `frontend/src/components/Button.js`
- [Avatar](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Avatar.js): `frontend/src/components/Avatar.js`
- [Logo](https://github.com/pioix/2026-tpf-g02/blob/main/frontend/src/components/Logo.js): `frontend/src/components/Logo.js`

### Other components

- **Player**

## Connections

- Player → Login and signup: opens (evidence: `README.md`)
- Login and signup → Authentication routes: HTTP login (evidence: `frontend/src/app/page.js`)
- Authentication routes → MySQL access: queries (evidence: `backend/routes/auth.js`)
- MySQL access → MySQL database: reads and writes
- Login and signup → Game menu: routes player (evidence: `frontend/src/app/page.js`)
- Game menu → Room HTTP routes: creates room (evidence: `README.md`)
- Player → Room lobby: joins room (evidence: `README.md`)
- Room lobby → Socket client: uses sockets (evidence: `README.md`)
- Socket client → Express and Socket.IO: sends events (evidence: `README.md`)
- Room HTTP routes → Room state: creates and checks (evidence: `backend/routes/salas.js`)
- Express and Socket.IO → Room state: manages room state (evidence: `backend/index.js`)
- Express and Socket.IO → Round and album logic: requests round tasks (evidence: `backend/index.js`)
- Express and Socket.IO → Write phase: sends round task (evidence: `README.md`)
- Express and Socket.IO → Draw phase: sends round task (evidence: `README.md`)
- Write phase → Socket client: submits text (evidence: `README.md`)
- Draw phase → Socket client: submits drawing (evidence: `README.md`)
- Express and Socket.IO → Album reveal: synchronizes albums (evidence: `README.md`)
- Player → Past albums: browses albums (evidence: `README.md`)
- Login and signup → Admin panel: routes admin (evidence: `frontend/src/app/page.js`)
- Admin panel → Admin operations: fetches admin data (evidence: `frontend/src/app/admin/page.js`)
- Admin operations → MySQL access: queries (evidence: `backend/routes/admin.js`)
- Express and Socket.IO → Authentication routes: registers routes (evidence: `backend/index.js`)
- Express and Socket.IO → Admin operations: registers routes (evidence: `backend/index.js`)
- Login and signup → Button: renders (evidence: `frontend/src/app/page.js`)
- Login and signup → Avatar: shows user identity (evidence: `README.md`)
- Game menu → Logo: shows branding (evidence: `README.md`)
