# codeiwan/algocoach architecture

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

- Interactive diagram: https://gitdiagram.com/codeiwan/algocoach
- Repository: https://github.com/codeiwan/algocoach

## Overview

AlgoCoach is an AI-assisted coding-problem coaching application. A learner enters a problem, gets it structured, then works in a solver workspace with analysis, progressive hints, and a pre-submission static review; ending a session can be followed by learner feedback. The backend exposes these capabilities through API routers, uses an interchangeable LLM provider, and keeps hint, completion, and feedback records in process memory. The graph preserves documented product stages, but frontend-to-API transport details are not shown in the sampled source, so those links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/codeiwan/algocoach/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/llm/provider.py`](https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/provider.py) (LLM interface), [`frontend/src/App.vue`](https://github.com/codeiwan/algocoach/blob/main/frontend/src/App.vue) (Problem entry), [`backend/app/services/hint_sessions.py`](https://github.com/codeiwan/algocoach/blob/main/backend/app/services/hint_sessions.py) (Hint session store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Learner workspace"]
  node_app["Problem entry<br/>[App.vue]"]
  node_workspace["Solver workspace"]
  node_problem_preview["Problem preview"]
  node_coach_panels["Coaching panels"]
  node_session_panels["Session panels"]
end

subgraph group_api["Backend API"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_problem_api["Problem structuring API<br/>[problems.py]"]
  node_analysis_api["Code analysis API<br/>[analysis.py]"]
  node_hint_api["Progressive hint API<br/>[hints.py]"]
  node_submission_api["Submission review API<br/>[submission.py]"]
  node_completion_api["Completion API"]
  node_feedback_api["Feedback API"]
  node_contracts["Request and result schemas"]
end

subgraph group_coaching["Coaching and review"]
  node_analysis_graph["Analysis graph<br/>[graph.py]"]
  node_hint_policy["Hint progression policy<br/>[hint_policy.py]"]
end

subgraph group_sessions["Session records"]
  node_hint_sessions[("Hint session store<br/>[hint_sessions.py]")]
  node_completion_store[("Completion store")]
  node_feedback_store[("Feedback store")]
end

subgraph group_providers["LLM providers"]
  node_provider_interface["LLM interface<br/>[provider.py]"]
  node_provider_factory["Provider factory<br/>[factory.py]"]
  node_mock_provider["Mock provider<br/>[mock.py]"]
  node_openai_provider["OpenAI provider<br/>[openai_provider.py]"]
end

node_learner(("Learner"))

node_learner -->|"enters problem"| node_app
node_app -->|"renders structure"| node_problem_preview
node_app -->|"requests structuring"| node_problem_api
node_app -->|"opens workspace"| node_workspace
node_api_entry -->|"registers route"| node_problem_api
node_api_entry -->|"registers route"| node_analysis_api
node_api_entry -->|"registers route"| node_hint_api
node_api_entry -->|"registers route"| node_submission_api
node_api_entry -->|"registers route"| node_completion_api
node_api_entry -->|"registers route"| node_feedback_api
node_api_entry -->|"creates provider"| node_provider_factory
node_api_entry -->|"creates graph"| node_analysis_graph
node_problem_api -->|"structures problem"| node_provider_interface
node_analysis_api -->|"runs analysis"| node_analysis_graph
node_hint_api -->|"generates hint"| node_hint_sessions
node_hint_sessions -->|"checks progression"| node_hint_policy
node_hint_sessions -->|"requests hint"| node_provider_interface
node_submission_api -->|"reviews code"| node_provider_interface
node_completion_api -->|"records completion"| node_completion_store
node_feedback_api -->|"records feedback"| node_feedback_store
node_feedback_store -->|"checks completion"| node_completion_store
node_provider_factory -->|"selects provider"| node_mock_provider
node_provider_factory -->|"selects provider"| node_openai_provider
node_mock_provider -->|"implements interface"| node_provider_interface
node_openai_provider -->|"implements interface"| node_provider_interface

click node_app "https://github.com/codeiwan/algocoach/blob/main/frontend/src/App.vue"
click node_workspace "https://github.com/codeiwan/algocoach/blob/main/frontend/src/components/SolverWorkspace.vue"
click node_problem_preview "https://github.com/codeiwan/algocoach/blob/main/frontend/src/components/StructuredProblemPreview.vue"
click node_coach_panels "https://github.com/codeiwan/algocoach/tree/main/frontend/src/components"
click node_session_panels "https://github.com/codeiwan/algocoach/tree/main/frontend/src/components"
click node_api_entry "https://github.com/codeiwan/algocoach/blob/main/backend/app/main.py"
click node_problem_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/problems.py"
click node_analysis_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/analysis.py"
click node_hint_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/hints.py"
click node_submission_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/submission.py"
click node_completion_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/session_completion.py"
click node_feedback_api "https://github.com/codeiwan/algocoach/blob/main/backend/app/api/session_feedback.py"
click node_contracts "https://github.com/codeiwan/algocoach/tree/main/backend/app/schemas"
click node_analysis_graph "https://github.com/codeiwan/algocoach/blob/main/backend/app/agents/graph.py"
click node_hint_policy "https://github.com/codeiwan/algocoach/blob/main/backend/app/agents/hint_policy.py"
click node_hint_sessions "https://github.com/codeiwan/algocoach/blob/main/backend/app/services/hint_sessions.py"
click node_completion_store "https://github.com/codeiwan/algocoach/blob/main/backend/app/services/session_completions.py"
click node_feedback_store "https://github.com/codeiwan/algocoach/blob/main/backend/app/services/session_feedback.py"
click node_provider_interface "https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/provider.py"
click node_provider_factory "https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/factory.py"
click node_mock_provider "https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/mock.py"
click node_openai_provider "https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/openai_provider.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_app,node_workspace,node_problem_preview,node_coach_panels,node_session_panels toneBlue
class node_api_entry,node_problem_api,node_analysis_api,node_hint_api,node_submission_api,node_completion_api,node_feedback_api,node_contracts toneAmber
class node_analysis_graph,node_hint_policy toneMint
class node_hint_sessions,node_completion_store,node_feedback_store toneRose
class node_provider_interface,node_provider_factory,node_mock_provider,node_openai_provider,node_learner toneIndigo
```

## Components

### Learner workspace

- [Problem entry](https://github.com/codeiwan/algocoach/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Solver workspace](https://github.com/codeiwan/algocoach/blob/main/frontend/src/components/SolverWorkspace.vue): `frontend/src/components/SolverWorkspace.vue`
- [Problem preview](https://github.com/codeiwan/algocoach/blob/main/frontend/src/components/StructuredProblemPreview.vue): `frontend/src/components/StructuredProblemPreview.vue`
- [Coaching panels](https://github.com/codeiwan/algocoach/tree/main/frontend/src/components): `frontend/src/components`
- [Session panels](https://github.com/codeiwan/algocoach/tree/main/frontend/src/components): `frontend/src/components`

### Backend API

- [FastAPI application](https://github.com/codeiwan/algocoach/blob/main/backend/app/main.py): `backend/app/main.py`
- [Problem structuring API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/problems.py): `backend/app/api/problems.py`
- [Code analysis API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/analysis.py): `backend/app/api/analysis.py`
- [Progressive hint API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/hints.py): `backend/app/api/hints.py`
- [Submission review API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/submission.py): `backend/app/api/submission.py`
- [Completion API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/session_completion.py): `backend/app/api/session_completion.py`
- [Feedback API](https://github.com/codeiwan/algocoach/blob/main/backend/app/api/session_feedback.py): `backend/app/api/session_feedback.py`
- [Request and result schemas](https://github.com/codeiwan/algocoach/tree/main/backend/app/schemas): `backend/app/schemas`

### Coaching and review

- [Analysis graph](https://github.com/codeiwan/algocoach/blob/main/backend/app/agents/graph.py): `backend/app/agents/graph.py`
- [Hint progression policy](https://github.com/codeiwan/algocoach/blob/main/backend/app/agents/hint_policy.py): `backend/app/agents/hint_policy.py`

### Session records

- [Hint session store](https://github.com/codeiwan/algocoach/blob/main/backend/app/services/hint_sessions.py): `backend/app/services/hint_sessions.py`
- [Completion store](https://github.com/codeiwan/algocoach/blob/main/backend/app/services/session_completions.py): `backend/app/services/session_completions.py`
- [Feedback store](https://github.com/codeiwan/algocoach/blob/main/backend/app/services/session_feedback.py): `backend/app/services/session_feedback.py`

### LLM providers

- [LLM interface](https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/provider.py): `backend/app/llm/provider.py`
- [Provider factory](https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/factory.py): `backend/app/llm/factory.py`
- [Mock provider](https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/mock.py): `backend/app/llm/mock.py`
- [OpenAI provider](https://github.com/codeiwan/algocoach/blob/main/backend/app/llm/openai_provider.py): `backend/app/llm/openai_provider.py`

### Other components

- **Learner**

## Connections

- Learner → Problem entry: enters problem (evidence: `frontend/src/App.vue`)
- Problem entry → Problem preview: renders structure (evidence: `frontend/src/App.vue`)
- Problem entry → Problem structuring API: requests structuring (evidence: `frontend/src/App.vue`)
- Problem entry → Solver workspace: opens workspace (evidence: `frontend/src/App.vue`)
- FastAPI application → Problem structuring API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Code analysis API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Progressive hint API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Submission review API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Completion API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Feedback API: registers route (evidence: `backend/app/main.py`)
- FastAPI application → Provider factory: creates provider (evidence: `backend/app/main.py`)
- FastAPI application → Analysis graph: creates graph (evidence: `backend/app/main.py`)
- Problem structuring API → LLM interface: structures problem (evidence: `backend/app/api/problems.py`)
- Code analysis API → Analysis graph: runs analysis (evidence: `backend/app/api/analysis.py`)
- Progressive hint API → Hint session store: generates hint (evidence: `backend/app/api/hints.py`)
- Hint session store → Hint progression policy: checks progression (evidence: `backend/app/services/hint_sessions.py`)
- Hint session store → LLM interface: requests hint (evidence: `backend/app/services/hint_sessions.py`)
- Submission review API → LLM interface: reviews code (evidence: `backend/app/api/submission.py`)
- Completion API → Completion store: records completion (evidence: `backend/app/api/session_completion.py`)
- Feedback API → Feedback store: records feedback (evidence: `backend/app/api/session_feedback.py`)
- Feedback store → Completion store: checks completion (evidence: `backend/app/services/session_feedback.py`)
- Provider factory → Mock provider: selects provider (evidence: `backend/app/llm/factory.py`)
- Provider factory → OpenAI provider: selects provider (evidence: `backend/app/llm/factory.py`)
- Mock provider → LLM interface: implements interface (evidence: `backend/app/llm/mock.py`)
- OpenAI provider → LLM interface: implements interface (evidence: `backend/app/llm/openai_provider.py`)
