# rebbouh-mohamed/competitive-programming-front architecture

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

- Interactive diagram: https://gitdiagram.com/rebbouh-mohamed/competitive-programming-front
- Repository: https://github.com/rebbouh-mohamed/competitive-programming-front

## Overview

This is a React frontend for a contest coding game. Users authenticate, enter a lobby, view contests or matches, choose a problem, write and submit code, and view player/leaderboard information. The game-round page coordinates problem and contest state, editor UI, and cup-match updates. The README only describes a generic Vite setup; the graph’s product flow is grounded in the sampled routing and game-round source plus SOURCE INDEX references. Several feature modules are indexed but unsampled, so their internal behavior and connections are not inferred.

Main entry points: [`src/pages/GRound.jsx`](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/GRound.jsx) (Game Round), [`src/main.jsx`](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/main.jsx) (Router and Providers), [`src/context/api.js`](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/context/api.js) (HTTP Client), [`src/ProtectedRoute.jsx`](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/ProtectedRoute.jsx) (Route Guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_bootstrap["Router and Providers<br/>[main.jsx]"]
  node_app_shell["App Shell<br/>[App.jsx]"]
  node_admin["Admin Page<br/>[AdminPage.jsx]"]
end

subgraph group_identity["Identity and State"]
  node_login_page["Login Page<br/>[Login.jsx]"]
  node_login_action["Login Request<br/>[action.js]"]
  node_auth_guard["Route Guard<br/>[ProtectedRoute.jsx]"]
  node_session["Token Session<br/>[constant.js]"]
  node_refresh["Token Refresh<br/>[action.js]"]
  node_store[("Redux Store<br/>[store.js]")]
end

subgraph group_contest["Contest Experience"]
  node_lobby_page["Lobby Page<br/>[Lobby.jsx]"]
  node_lobby_view["Lobby View<br/>[LobbyMain.jsx]"]
  node_contest_request["Contest Request<br/>[action.js]"]
  node_round_page["Game Round<br/>[GRound.jsx]"]
  node_match_info["Match Info<br/>[MatchInfo.jsx]"]
  node_tournament_tree["Tournament Tree<br/>[TournamentTree.jsx]"]
  node_players["Players View<br/>[PlayersSection.jsx]"]
  node_leaderboard["Leaderboard Page<br/>[LBoard.jsx]"]
end

subgraph group_coding["Coding and Results"]
  node_problem_request["Problem Request<br/>[action.js]"]
  node_problem_view["Problem View<br/>[ProblemSection.jsx]"]
  node_editor["Code Editor<br/>[Landing.jsx]"]
  node_code_request["Code Submission<br/>[action.js]"]
  node_push_view["Submission Controls<br/>[Push.jsx]"]
  node_game_hud["Game HUD<br/>[GameHUD.jsx]"]
end

subgraph group_shared["Service Access"]
  node_backend["Backend API"]
  node_api_client["HTTP Client<br/>[api.js]"]
  node_websocket_helper["WebSocket URL<br/>[websocket.js]"]
  node_match_socket["Match Updates"]
end

node_user(("Player"))

node_user -->|"opens app"| node_bootstrap
node_bootstrap -->|"renders routes"| node_app_shell
node_bootstrap -->|"routes to"| node_login_page
node_bootstrap -->|"routes to"| node_lobby_page
node_bootstrap -->|"routes to"| node_round_page
node_bootstrap -->|"routes to"| node_leaderboard
node_bootstrap -->|"routes to"| node_admin
node_bootstrap -->|"provides state"| node_store
node_lobby_page -->|"requires access"| node_auth_guard
node_round_page -->|"requires access"| node_auth_guard
node_leaderboard -->|"requires access"| node_auth_guard
node_admin -->|"requires access"| node_auth_guard
node_login_page -->|"dispatches"| node_login_action
node_login_action -->|"sends request"| node_api_client
node_login_action -->|"stores tokens"| node_session
node_auth_guard -->|"checks tokens"| node_session
node_refresh -->|"requests refresh"| node_api_client
node_refresh -->|"updates token"| node_session
node_api_client -.->|"HTTP requests"| node_backend
node_lobby_page -->|"renders"| node_lobby_view
node_lobby_page -->|"dispatches"| node_contest_request
node_contest_request -->|"fetches contest"| node_api_client
node_round_page -->|"dispatches"| node_contest_request
node_round_page -->|"dispatches"| node_problem_request
node_round_page -->|"renders"| node_problem_view
node_round_page -->|"renders"| node_editor
node_round_page -->|"renders"| node_match_info
node_round_page -->|"renders"| node_game_hud
node_round_page -->|"builds socket URL"| node_websocket_helper
node_round_page -->|"opens connection"| node_match_socket
node_match_info -->|"uses HTTP client"| node_api_client
node_match_info -->|"uses URL helper"| node_websocket_helper
node_problem_request -->|"uses HTTP client"| node_api_client
node_editor -->|"dispatches"| node_code_request
node_editor -->|"renders"| node_push_view
node_editor -->|"renders"| node_problem_view
node_leaderboard -->|"renders"| node_players
node_admin -->|"uses HTTP client"| node_api_client

click node_bootstrap "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/main.jsx"
click node_app_shell "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/App.jsx"
click node_login_page "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/Login.jsx"
click node_login_action "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/login/action.js"
click node_auth_guard "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/ProtectedRoute.jsx"
click node_session "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/context/constant.js"
click node_refresh "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/refresh/action.js"
click node_lobby_page "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/Lobby.jsx"
click node_lobby_view "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/LobbyMain.jsx"
click node_contest_request "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/contests/action.js"
click node_round_page "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/GRound.jsx"
click node_match_info "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/tournament/MatchInfo.jsx"
click node_tournament_tree "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/tournament/TournamentTree.jsx"
click node_players "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/PlayersSection.jsx"
click node_leaderboard "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/LBoard.jsx"
click node_problem_request "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/problems/action.js"
click node_problem_view "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/ProblemSection.jsx"
click node_editor "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/codeEditor/elemnts/Landing.jsx"
click node_code_request "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/code/action.js"
click node_push_view "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/Push.jsx"
click node_game_hud "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/GameHUD.jsx"
click node_api_client "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/context/api.js"
click node_websocket_helper "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/utils/websocket.js"
click node_admin "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/AdminPage.jsx"
click node_store "https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/store.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_bootstrap,node_app_shell,node_admin toneBlue
class node_login_page,node_login_action,node_auth_guard,node_session,node_refresh,node_store toneAmber
class node_lobby_page,node_lobby_view,node_contest_request,node_round_page,node_match_info,node_tournament_tree,node_players,node_leaderboard toneMint
class node_problem_request,node_problem_view,node_editor,node_code_request,node_push_view,node_game_hud toneRose
class node_backend,node_api_client,node_websocket_helper,node_match_socket,node_user toneIndigo
```

## Components

### Application Shell

- [Router and Providers](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/main.jsx): `src/main.jsx`
- [App Shell](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/App.jsx): `src/App.jsx`
- [Admin Page](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/AdminPage.jsx): `src/pages/AdminPage.jsx`

### Identity and State

- [Login Page](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Login Request](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/login/action.js): `redux/login/action.js`
- [Route Guard](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/ProtectedRoute.jsx): `src/ProtectedRoute.jsx`
- [Token Session](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/context/constant.js): `src/context/constant.js`
- [Token Refresh](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/refresh/action.js): `redux/refresh/action.js`
- [Redux Store](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/store.js): `redux/store.js`

### Contest Experience

- [Lobby Page](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/Lobby.jsx): `src/pages/Lobby.jsx`
- [Lobby View](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/LobbyMain.jsx): `src/components/sections/LobbyMain.jsx`
- [Contest Request](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/contests/action.js): `redux/contests/action.js`
- [Game Round](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/GRound.jsx): `src/pages/GRound.jsx`
- [Match Info](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/tournament/MatchInfo.jsx): `src/components/sections/tournament/MatchInfo.jsx`
- [Tournament Tree](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/tournament/TournamentTree.jsx): `src/components/sections/tournament/TournamentTree.jsx`
- [Players View](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/PlayersSection.jsx): `src/components/sections/PlayersSection.jsx`
- [Leaderboard Page](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/pages/LBoard.jsx): `src/pages/LBoard.jsx`

### Coding and Results

- [Problem Request](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/problems/action.js): `redux/problems/action.js`
- [Problem View](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/ProblemSection.jsx): `src/components/sections/ProblemSection.jsx`
- [Code Editor](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/codeEditor/elemnts/Landing.jsx): `src/components/sections/codeEditor/elemnts/Landing.jsx`
- [Code Submission](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/redux/code/action.js): `redux/code/action.js`
- [Submission Controls](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/Push.jsx): `src/components/sections/Push.jsx`
- [Game HUD](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/components/sections/GameHUD.jsx): `src/components/sections/GameHUD.jsx`

### Service Access

- **Backend API**
- [HTTP Client](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/context/api.js): `src/context/api.js`
- [WebSocket URL](https://github.com/rebbouh-mohamed/competitive-programming-front/blob/main/src/utils/websocket.js): `src/utils/websocket.js`
- **Match Updates**

### Other components

- **Player**

## Connections

- Player → Router and Providers: opens app (evidence: `src/main.jsx`)
- Router and Providers → App Shell: renders routes (evidence: `src/main.jsx`)
- Router and Providers → Login Page: routes to (evidence: `src/main.jsx`)
- Router and Providers → Lobby Page: routes to (evidence: `src/main.jsx`)
- Router and Providers → Game Round: routes to (evidence: `src/main.jsx`)
- Router and Providers → Leaderboard Page: routes to (evidence: `src/main.jsx`)
- Router and Providers → Admin Page: routes to (evidence: `src/main.jsx`)
- Router and Providers → Redux Store: provides state (evidence: `src/main.jsx`)
- Lobby Page → Route Guard: requires access (evidence: `src/main.jsx`)
- Game Round → Route Guard: requires access (evidence: `src/main.jsx`)
- Leaderboard Page → Route Guard: requires access (evidence: `src/main.jsx`)
- Admin Page → Route Guard: requires access (evidence: `src/main.jsx`)
- Login Page → Login Request: dispatches (evidence: `src/pages/Login.jsx`)
- Login Request → HTTP Client: sends request (evidence: `redux/login/action.js`)
- Login Request → Token Session: stores tokens (evidence: `redux/login/action.js`)
- Route Guard → Token Session: checks tokens (evidence: `src/ProtectedRoute.jsx`)
- Token Refresh → HTTP Client: requests refresh (evidence: `redux/refresh/action.js`)
- Token Refresh → Token Session: updates token (evidence: `redux/refresh/action.js`)
- HTTP Client → Backend API: HTTP requests
- Lobby Page → Lobby View: renders (evidence: `src/pages/Lobby.jsx`)
- Lobby Page → Contest Request: dispatches (evidence: `src/pages/Lobby.jsx`)
- Contest Request → HTTP Client: fetches contest (evidence: `redux/contests/action.js`)
- Game Round → Contest Request: dispatches (evidence: `src/pages/GRound.jsx`)
- Game Round → Problem Request: dispatches (evidence: `src/pages/GRound.jsx`)
- Game Round → Problem View: renders (evidence: `src/pages/GRound.jsx`)
- Game Round → Code Editor: renders (evidence: `src/pages/GRound.jsx`)
- Game Round → Match Info: renders (evidence: `src/pages/GRound.jsx`)
- Game Round → Game HUD: renders (evidence: `src/pages/GRound.jsx`)
- Game Round → WebSocket URL: builds socket URL (evidence: `src/pages/GRound.jsx`)
- Game Round → Match Updates: opens connection (evidence: `src/pages/GRound.jsx`)
- Match Info → HTTP Client: uses HTTP client (evidence: `src/components/sections/tournament/MatchInfo.jsx`)
- Match Info → WebSocket URL: uses URL helper (evidence: `src/components/sections/tournament/MatchInfo.jsx`)
- Problem Request → HTTP Client: uses HTTP client (evidence: `redux/problems/action.js`)
- Code Editor → Code Submission: dispatches (evidence: `src/components/sections/codeEditor/elemnts/Landing.jsx`)
- Code Editor → Submission Controls: renders (evidence: `src/components/sections/codeEditor/elemnts/Landing.jsx`)
- Code Editor → Problem View: renders (evidence: `src/components/sections/codeEditor/elemnts/Landing.jsx`)
- Leaderboard Page → Players View: renders (evidence: `src/pages/LBoard.jsx`)
- Admin Page → HTTP Client: uses HTTP client (evidence: `src/pages/AdminPage.jsx`)
