# atharv170705/cp-contest-generator architecture

> Architecture diagram of the GitHub repository atharv170705/cp-contest-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atharv170705/cp-contest-generator
- Repository: https://github.com/atharv170705/cp-contest-generator

## Overview

This is a Codeforces contest-practice and performance-reporting application. Users sign in with Google, set a Codeforces handle, generate or inspect contests, finish contests, and view generated reports and history. The graph includes the documented route-level contest capabilities and sampled authentication/profile behavior. The contest controller, frontend page internals, and persistence implementations were not sampled, so their internal calls and UI-to-API wiring are not asserted.

Main entry points: [`frontend/src/main.jsx`](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/main.jsx) (React router), [`backend/src/app.js`](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/app.js) (Express app), [`backend/src/routes/cfRoutes.js`](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/cfRoutes.js) (Contest routes), [`backend/src/routes/auth.routes.js`](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/auth.routes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_frontend["React router<br/>[main.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_setup["Profile setup<br/>[Setup.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_contest_ui["Contest view<br/>[ContestPage.jsx]"]
  node_history_ui["Contest history"]
  node_reports_ui["Report history"]
  node_report_ui["Contest report"]
end

subgraph group_api["API and workflows"]
  node_app["Express app<br/>[app.js]"]
  node_contest_routes["Contest routes<br/>[cfRoutes.js]"]
  node_contest_controller["Contest workflows<br/>[contest.js]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_auth_controller["Google auth<br/>[auth.controller.js]"]
  node_auth_middleware["JWT middleware<br/>[auth.middleware.js]"]
  node_user_routes["Profile route<br/>[user.routes.js]"]
  node_user_controller["Profile setup<br/>[user.controller.js]"]
end

subgraph group_data["Persistence"]
  node_user_model["User model<br/>[user.model.js]"]
  node_contest_model["Contest model<br/>[contest.model.js]"]
  node_problems_model["Contest problems model"]
end

node_user(("User"))
node_google["Google OAuth"]
node_codeforces["Codeforces API"]

node_user -->|"uses"| node_frontend
node_frontend -->|"routes"| node_home
node_frontend -->|"routes"| node_setup
node_frontend -->|"routes"| node_dashboard
node_frontend -->|"routes"| node_contest_ui
node_frontend -->|"routes"| node_history_ui
node_frontend -->|"routes"| node_reports_ui
node_frontend -->|"routes"| node_report_ui
node_app -->|"mounts"| node_contest_routes
node_app -->|"mounts"| node_auth_routes
node_app -->|"mounts"| node_user_routes
node_contest_routes -->|"dispatches"| node_contest_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_user_routes -->|"dispatches"| node_user_controller
node_auth_routes -->|"guards"| node_auth_middleware
node_contest_routes -->|"guards"| node_auth_middleware
node_user_routes -->|"guards"| node_auth_middleware
node_auth_controller -->|"exchanges tokens"| node_google
node_auth_controller -->|"reads/writes user"| node_user_model
node_user_controller -->|"updates handle"| node_user_model
node_user_controller -->|"fetches rating"| node_codeforces

click node_frontend "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/main.jsx"
click node_home "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Home.jsx"
click node_setup "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Setup.jsx"
click node_dashboard "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Dashboard.jsx"
click node_contest_ui "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestPage.jsx"
click node_history_ui "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestHistoryPage.jsx"
click node_reports_ui "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ReportHistoryPage.jsx"
click node_report_ui "https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestReportPage.jsx"
click node_app "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/app.js"
click node_contest_routes "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/cfRoutes.js"
click node_contest_controller "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/contest.js"
click node_auth_routes "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/auth.controller.js"
click node_auth_middleware "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/middleware/auth.middleware.js"
click node_user_routes "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/user.routes.js"
click node_user_controller "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/user.controller.js"
click node_user_model "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/user.model.js"
click node_contest_model "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/contest.model.js"
click node_problems_model "https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/contestProblems.model.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_frontend,node_home,node_setup,node_dashboard,node_contest_ui,node_history_ui,node_reports_ui,node_report_ui,node_user toneBlue
class node_app,node_contest_routes,node_contest_controller toneAmber
class node_auth_routes,node_auth_controller,node_auth_middleware,node_user_routes,node_user_controller,node_codeforces toneMint
class node_user_model,node_contest_model,node_problems_model toneRose
class node_google toneIndigo
```

## Components

### Web application

- [React router](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Home](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Profile setup](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Setup.jsx): `frontend/src/pages/Setup.jsx`
- [Dashboard](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Contest view](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestPage.jsx): `frontend/src/pages/ContestPage.jsx`
- [Contest history](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestHistoryPage.jsx): `frontend/src/pages/ContestHistoryPage.jsx`
- [Report history](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ReportHistoryPage.jsx): `frontend/src/pages/ReportHistoryPage.jsx`
- [Contest report](https://github.com/atharv170705/cp-contest-generator/blob/main/frontend/src/pages/ContestReportPage.jsx): `frontend/src/pages/ContestReportPage.jsx`

### API and workflows

- [Express app](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/app.js): `backend/src/app.js`
- [Contest routes](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/cfRoutes.js): `backend/src/routes/cfRoutes.js`
- [Contest workflows](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/contest.js): `backend/src/controllers/contest.js`

### Identity and profiles

- [Auth routes](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Google auth](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [JWT middleware](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`
- [Profile route](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/routes/user.routes.js): `backend/src/routes/user.routes.js`
- [Profile setup](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/controllers/user.controller.js): `backend/src/controllers/user.controller.js`

### Persistence

- [User model](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/user.model.js): `backend/src/model/user.model.js`
- [Contest model](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/contest.model.js): `backend/src/model/contest.model.js`
- [Contest problems model](https://github.com/atharv170705/cp-contest-generator/blob/main/backend/src/model/contestProblems.model.js): `backend/src/model/contestProblems.model.js`

### Other components

- **User**
- **Google OAuth**
- **Codeforces API**

## Connections

- User → React router: uses
- React router → Home: routes
- React router → Profile setup: routes
- React router → Dashboard: routes
- React router → Contest view: routes
- React router → Contest history: routes
- React router → Report history: routes
- React router → Contest report: routes
- Express app → Contest routes: mounts
- Express app → Auth routes: mounts
- Express app → Profile route: mounts
- Contest routes → Contest workflows: dispatches
- Auth routes → Google auth: dispatches
- Profile route → Profile setup: dispatches
- Auth routes → JWT middleware: guards
- Contest routes → JWT middleware: guards
- Profile route → JWT middleware: guards
- Google auth → Google OAuth: exchanges tokens
- Google auth → User model: reads/writes user
- Profile setup → User model: updates handle
- Profile setup → Codeforces API: fetches rating
