# rohitk-18/codehelp architecture

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

- Interactive diagram: https://gitdiagram.com/rohitk-18/codehelp
- Repository: https://github.com/rohitk-18/codehelp

## Overview

CodeHelp is a Flask coding-practice and review application. Users authenticate, start problem sessions using LeetCode, Codeforces, or manual problem details, submit attempts, and receive AI-generated feedback; they can also browse history, unlock hints, and reveal eligible reference solutions. Routes coordinate persistence, AI services, and platform lookups. The README documents dashboard, profile, and session capabilities; some route details are unsampled, so those links rely on documented behavior rather than inferred calls.

Main entry points: [`app/routes/main.py`](https://github.com/rohitk-18/codehelp/blob/main/app/routes/main.py) (Practice routes), [`app/ai/reviewer.py`](https://github.com/rohitk-18/codehelp/blob/main/app/ai/reviewer.py) (Attempt reviewer), [`app/auth/routes.py`](https://github.com/rohitk-18/codehelp/blob/main/app/auth/routes.py) (Authentication), [`app/__init__.py`](https://github.com/rohitk-18/codehelp/blob/main/app/__init__.py) (Flask factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and accounts"]
  node_factory["Flask factory<br/>[__init__.py]"]
  node_auth["Authentication<br/>[routes.py]"]
end

subgraph group_practice["Practice workflow"]
  node_routes["Practice routes<br/>[main.py]"]
  node_database[("Practice data<br/>[__init__.py]")]
  node_templates["Web interface"]
end

subgraph group_intelligence["AI feedback and solutions"]
  node_reviewer["Attempt reviewer<br/>[reviewer.py]"]
  node_prompts["Review prompts<br/>[prompts.py]"]
  node_solutions["Solution generator<br/>[solution.py]"]
end

subgraph group_integrations["Platforms and profiles"]
  node_leetcode["LeetCode service<br/>[leetcode.py]"]
  node_codeforces["Codeforces service<br/>[codeforces.py]"]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}
node_leetcode_api{{"LeetCode GraphQL"}}
node_codeforces_api{{"Codeforces API"}}

node_user -->|"registers or logs in"| node_auth
node_factory -->|"registers routes"| node_auth
node_factory -->|"registers routes"| node_routes
node_user -->|"starts and manages sessions"| node_routes
node_auth -->|"reads and creates users"| node_database
node_routes -->|"stores and retrieves practice data"| node_database
node_routes -->|"looks up problems and profiles"| node_leetcode
node_routes -->|"looks up problems and profiles"| node_codeforces
node_routes -->|"requests attempt review"| node_reviewer
node_routes -->|"requests reference solution"| node_solutions
node_reviewer -->|"builds prompt"| node_prompts
node_reviewer -->|"generates review"| node_gemini
node_solutions -->|"generates solution"| node_gemini
node_leetcode -->|"queries GraphQL"| node_leetcode_api
node_codeforces -->|"requests metadata"| node_codeforces_api
node_routes -->|"renders screens"| node_templates
node_user -->|"uses dashboard and history"| node_templates

click node_factory "https://github.com/rohitk-18/codehelp/blob/main/app/__init__.py"
click node_auth "https://github.com/rohitk-18/codehelp/blob/main/app/auth/routes.py"
click node_routes "https://github.com/rohitk-18/codehelp/blob/main/app/routes/main.py"
click node_database "https://github.com/rohitk-18/codehelp/blob/main/app/models/__init__.py"
click node_templates "https://github.com/rohitk-18/codehelp/tree/main/templates"
click node_reviewer "https://github.com/rohitk-18/codehelp/blob/main/app/ai/reviewer.py"
click node_prompts "https://github.com/rohitk-18/codehelp/blob/main/app/ai/prompts.py"
click node_solutions "https://github.com/rohitk-18/codehelp/blob/main/app/ai/solution.py"
click node_leetcode "https://github.com/rohitk-18/codehelp/blob/main/app/services/leetcode.py"
click node_codeforces "https://github.com/rohitk-18/codehelp/blob/main/app/services/codeforces.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_factory,node_auth,node_user toneBlue
class node_routes,node_database,node_templates toneAmber
class node_reviewer,node_prompts,node_solutions,node_codeforces_api toneMint
class node_leetcode,node_codeforces toneRose
class node_gemini,node_leetcode_api toneIndigo
```

## Components

### Application and accounts

- [Flask factory](https://github.com/rohitk-18/codehelp/blob/main/app/__init__.py): `app/__init__.py`
- [Authentication](https://github.com/rohitk-18/codehelp/blob/main/app/auth/routes.py): `app/auth/routes.py`

### Practice workflow

- [Practice routes](https://github.com/rohitk-18/codehelp/blob/main/app/routes/main.py): `app/routes/main.py`
- [Practice data](https://github.com/rohitk-18/codehelp/blob/main/app/models/__init__.py): `app/models/__init__.py`
- [Web interface](https://github.com/rohitk-18/codehelp/tree/main/templates): `templates`

### AI feedback and solutions

- [Attempt reviewer](https://github.com/rohitk-18/codehelp/blob/main/app/ai/reviewer.py): `app/ai/reviewer.py`
- [Review prompts](https://github.com/rohitk-18/codehelp/blob/main/app/ai/prompts.py): `app/ai/prompts.py`
- [Solution generator](https://github.com/rohitk-18/codehelp/blob/main/app/ai/solution.py): `app/ai/solution.py`

### Platforms and profiles

- [LeetCode service](https://github.com/rohitk-18/codehelp/blob/main/app/services/leetcode.py): `app/services/leetcode.py`
- [Codeforces service](https://github.com/rohitk-18/codehelp/blob/main/app/services/codeforces.py): `app/services/codeforces.py`

### Other components

- **User**
- **Google Gemini**
- **LeetCode GraphQL**
- **Codeforces API**

## Connections

- User → Authentication: registers or logs in (evidence: `README.md`)
- Flask factory → Authentication: registers routes (evidence: `app/__init__.py`)
- Flask factory → Practice routes: registers routes (evidence: `app/__init__.py`)
- User → Practice routes: starts and manages sessions (evidence: `README.md`)
- Authentication → Practice data: reads and creates users (evidence: `app/auth/routes.py`)
- Practice routes → Practice data: stores and retrieves practice data (evidence: `app/routes/main.py`)
- Practice routes → LeetCode service: looks up problems and profiles (evidence: `app/routes/main.py`)
- Practice routes → Codeforces service: looks up problems and profiles (evidence: `app/routes/main.py`)
- Practice routes → Attempt reviewer: requests attempt review (evidence: `app/routes/main.py`)
- Practice routes → Solution generator: requests reference solution (evidence: `app/routes/main.py`)
- Attempt reviewer → Review prompts: builds prompt (evidence: `app/ai/reviewer.py`)
- Attempt reviewer → Google Gemini: generates review (evidence: `app/ai/reviewer.py`)
- Solution generator → Google Gemini: generates solution (evidence: `app/ai/solution.py`)
- LeetCode service → LeetCode GraphQL: queries GraphQL (evidence: `app/services/leetcode.py`)
- Codeforces service → Codeforces API: requests metadata (evidence: `app/services/codeforces.py`)
- Practice routes → Web interface: renders screens (evidence: `README.md`)
- User → Web interface: uses dashboard and history (evidence: `README.md`)
