# henriqf/sudoku-competitivo architecture

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

- Interactive diagram: https://gitdiagram.com/henriqf/sudoku-competitivo
- Repository: https://github.com/henriqf/sudoku-competitivo

## Overview

This is a browser-based ranked 6×6 Sudoku platform. Users register or log in, browse profile and leaderboard data, then enter a matchmaking queue; matched players receive puzzles and compete in real time, with completed games updating ELO and records. The product also offers profile editing and an unranked Zen puzzle mode. The excerpts show the main HTTP and WebSocket links; routes and frontend pages not sampled are included only where README or sampled code supports them.

Main entry points: [`src/services/interface/Interface.cs`](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/interface/Interface.cs) (Auth and API), [`src/frontend/js/menu.js`](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/menu.js) (Menu and leaderboard), [`src/services/display_api/Display.cs`](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/display_api/Display.cs) (Display API), [`src/services/bd/BancoDados.cs`](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/bd/BancoDados.cs) (Database API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser experience"]
  node_account_ui["Account screens<br/>[cadastro.js]"]
  node_login_ui["Login screen<br/>[login.js]"]
  node_menu_ui["Menu and leaderboard<br/>[menu.js]"]
  node_profile_ui["Edit profile<br/>[mudar_info.js]"]
  node_ranked_ui["Ranked game client<br/>[game.js]"]
  node_zen_ui["Zen puzzle client<br/>[zen.js]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_api["Auth and API<br/>[Interface.cs]"]
  node_contracts["API contracts<br/>[contracts.cs]"]
end

subgraph group_gameplay["Ranked and solo play"]
  node_matchmaking["Matchmaking and game<br/>[Websocket.cs]"]
  node_sudoku["Puzzle generation<br/>[Sudoku.cs]"]
end

subgraph group_services["Application services"]
  node_display_api["Display API<br/>[Display.cs]"]
end

subgraph group_persistence["Accounts and records"]
  node_database_api["Database API<br/>[BancoDados.cs]"]
  node_mysql[("MySQL database<br/>[schema.sql]")]
end

node_player(("Player"))

node_player -->|"registers"| node_account_ui
node_player -->|"signs in"| node_login_ui
node_player -->|"plays from"| node_menu_ui
node_account_ui -->|"creates account"| node_auth_api
node_login_ui -->|"authenticates"| node_auth_api
node_menu_ui -->|"requests token"| node_auth_api
node_menu_ui -->|"opens game"| node_ranked_ui
node_menu_ui -->|"opens Zen"| node_zen_ui
node_menu_ui -->|"loads stats"| node_auth_api
node_menu_ui -.->|"loads leaderboard"| node_display_api
node_profile_ui -->|"edits profile"| node_auth_api
node_ranked_ui -->|"plays over WebSocket"| node_matchmaking
node_zen_ui -->|"requests puzzle"| node_auth_api
node_auth_api -->|"forwards account requests"| node_database_api
node_auth_api -->|"requests Zen boards"| node_sudoku
node_display_api -->|"reads leaderboard and stats"| node_database_api
node_display_api -->|"fetches puzzles"| node_sudoku
node_matchmaking -->|"reads stats; saves results"| node_database_api
node_matchmaking -.->|"requests match boards"| node_sudoku
node_database_api -->|"persists records"| node_mysql
node_auth_api -->|"uses data records"| node_contracts
node_display_api -->|"uses data records"| node_contracts

click node_account_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/cadastro.js"
click node_login_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/login.js"
click node_menu_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/menu.js"
click node_profile_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/mudar_info.js"
click node_ranked_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/game.js"
click node_zen_ui "https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/zen.js"
click node_auth_api "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/interface/Interface.cs"
click node_contracts "https://github.com/henriqf/sudoku-competitivo/blob/main/src/contracts/contracts.cs"
click node_matchmaking "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/websocket/Websocket.cs"
click node_sudoku "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/sudoku_gen/Sudoku.cs"
click node_display_api "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/display_api/Display.cs"
click node_database_api "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/bd/BancoDados.cs"
click node_mysql "https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/bd/init/schema.sql"

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_account_ui,node_login_ui,node_menu_ui,node_profile_ui,node_ranked_ui,node_zen_ui toneBlue
class node_auth_api,node_contracts toneAmber
class node_matchmaking,node_sudoku toneMint
class node_display_api toneRose
class node_database_api,node_mysql,node_player toneIndigo
```

## Components

### Browser experience

- [Account screens](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/cadastro.js): `src/frontend/js/cadastro.js`
- [Login screen](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/login.js): `src/frontend/js/login.js`
- [Menu and leaderboard](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/menu.js): `src/frontend/js/menu.js`
- [Edit profile](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/mudar_info.js): `src/frontend/js/mudar_info.js`
- [Ranked game client](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/game.js): `src/frontend/js/game.js`
- [Zen puzzle client](https://github.com/henriqf/sudoku-competitivo/blob/main/src/frontend/js/zen.js): `src/frontend/js/zen.js`

### Identity and profiles

- [Auth and API](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/interface/Interface.cs): `src/services/interface/Interface.cs`
- [API contracts](https://github.com/henriqf/sudoku-competitivo/blob/main/src/contracts/contracts.cs): `src/contracts/contracts.cs`

### Ranked and solo play

- [Matchmaking and game](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/websocket/Websocket.cs): `src/services/websocket/Websocket.cs`
- [Puzzle generation](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/sudoku_gen/Sudoku.cs): `src/services/sudoku_gen/Sudoku.cs`

### Application services

- [Display API](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/display_api/Display.cs): `src/services/display_api/Display.cs`

### Accounts and records

- [Database API](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/bd/BancoDados.cs): `src/services/bd/BancoDados.cs`
- [MySQL database](https://github.com/henriqf/sudoku-competitivo/blob/main/src/services/bd/init/schema.sql): `src/services/bd/init/schema.sql`

### Other components

- **Player**

## Connections

- Player → Account screens: registers (evidence: `src/frontend/js/cadastro.js`)
- Player → Login screen: signs in (evidence: `src/frontend/js/login.js`)
- Player → Menu and leaderboard: plays from (evidence: `src/frontend/js/menu.js`)
- Account screens → Auth and API: creates account (evidence: `src/frontend/js/cadastro.js`)
- Login screen → Auth and API: authenticates (evidence: `src/frontend/js/login.js`)
- Menu and leaderboard → Auth and API: requests token (evidence: `src/frontend/js/menu.js`)
- Menu and leaderboard → Ranked game client: opens game (evidence: `src/frontend/js/menu.js`)
- Menu and leaderboard → Zen puzzle client: opens Zen (evidence: `src/frontend/js/menu.js`)
- Menu and leaderboard → Auth and API: loads stats (evidence: `src/frontend/js/menu.js`)
- Menu and leaderboard → Display API: loads leaderboard
- Edit profile → Auth and API: edits profile (evidence: `src/frontend/js/mudar_info.js`)
- Ranked game client → Matchmaking and game: plays over WebSocket
- Zen puzzle client → Auth and API: requests puzzle (evidence: `src/services/interface/Interface.cs`)
- Auth and API → Database API: forwards account requests (evidence: `src/services/interface/Interface.cs`)
- Auth and API → Puzzle generation: requests Zen boards (evidence: `src/services/interface/Interface.cs`)
- Display API → Database API: reads leaderboard and stats (evidence: `src/services/display_api/Display.cs`)
- Display API → Puzzle generation: fetches puzzles (evidence: `src/services/display_api/Display.cs`)
- Matchmaking and game → Database API: reads stats; saves results (evidence: `src/services/websocket/Websocket.cs`)
- Matchmaking and game → Puzzle generation: requests match boards
- Database API → MySQL database: persists records (evidence: `src/services/bd/BancoDados.cs`)
- Auth and API → API contracts: uses data records (evidence: `src/services/interface/Interface.cs`)
- Display API → API contracts: uses data records (evidence: `src/services/display_api/Display.cs`)
