# fakhrihuseynov/python-platform architecture

> Architecture diagram of the GitHub repository fakhrihuseynov/python-platform, 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/fakhrihuseynov/python-platform
- Repository: https://github.com/fakhrihuseynov/python-platform

## Overview

PyCoach is a local-first Python learning web app. Learners browse micro-lessons, run code in the practice playground, review scheduled flashcards, and ask an optional local Ollama coach; the Learn area also provides document and folder management. The graph follows sampled Flask route calls into core logic and documented capabilities. Learning-log behavior is documented, but its route-level wiring was not sampled, so it is shown as a separate capability without an inferred caller. Some route implementations and templates are represented at their exact tree paths.

Main entry points: [`app/web/__init__.py`](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/__init__.py) (Flask app factory), [`app/web/routes/learn.py`](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/learn.py) (Learn and docs routes), [`app/web/routes/practice.py`](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/practice.py) (Practice route), [`app/web/routes/flashcards.py`](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/flashcards.py) (Flashcard routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app_factory["Flask app factory<br/>[__init__.py]"]
  node_home_route["Home route<br/>[home.py]"]
  node_learn_route["Learn and docs routes<br/>[learn.py]"]
  node_practice_route["Practice route<br/>[practice.py]"]
  node_flashcards_route["Flashcard routes<br/>[flashcards.py]"]
  node_coach_route["Coach route<br/>[coach.py]"]
  node_learn_template["Learn and docs views<br/>[learn.html]"]
  node_practice_template["Practice view<br/>[practice.html]"]
  node_flashcards_template["Flashcards view<br/>[flashcards.html]"]
  node_coach_template["Coach view<br/>[coach.html]"]
end

subgraph group_learning["Learning and practice"]
  node_lessons["Lesson registry<br/>[lessons.py]"]
  node_practice["Code execution<br/>[practice.py]"]
  node_docs["Learning documents<br/>[docs.py]"]
end

subgraph group_review["Review and tracking"]
  node_flashcards["Flashcard management<br/>[flashcards.py]"]
  node_srs["SM-2 scheduling<br/>[srs.py]"]
  node_learning_log["Learning log<br/>[log.py]"]
end

subgraph group_local["Local data and AI"]
  node_storage["YAML and JSONL storage<br/>[storage.py]"]
  node_card_data[("Card data")]
  node_docs_data[("Document data")]
  node_ollama["Local Ollama"]
end

node_learner(("Learner"))

node_learner -->|"uses web app"| node_app_factory
node_app_factory -->|"registers routes"| node_home_route
node_app_factory -->|"registers routes"| node_learn_route
node_app_factory -->|"registers routes"| node_practice_route
node_app_factory -->|"registers routes"| node_flashcards_route
node_app_factory -->|"registers routes"| node_coach_route
node_learner -->|"requests lessons and docs"| node_learn_route
node_learn_route -->|"loads lessons"| node_lessons
node_learn_route -->|"manages documents"| node_docs
node_learn_route -->|"renders view"| node_learn_template
node_docs -->|"reads and writes"| node_docs_data
node_learner -->|"submits code"| node_practice_route
node_practice_route -->|"runs code"| node_practice
node_practice_route -->|"renders feedback"| node_practice_template
node_learner -->|"reviews and grades"| node_flashcards_route
node_flashcards_route -->|"loads and grades cards"| node_flashcards
node_flashcards_route -->|"renders cards"| node_flashcards_template
node_flashcards -->|"updates schedule"| node_srs
node_flashcards -->|"reads and writes cards"| node_storage
node_storage -->|"reads and writes JSONL"| node_card_data
node_learner -->|"asks question"| node_coach_route
node_coach_route -.->|"requests generation"| node_ollama
node_coach_route -->|"renders reply"| node_coach_template

click node_app_factory "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/__init__.py"
click node_home_route "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/home.py"
click node_learn_route "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/learn.py"
click node_practice_route "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/practice.py"
click node_flashcards_route "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/flashcards.py"
click node_coach_route "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/coach.py"
click node_lessons "https://github.com/fakhrihuseynov/python-platform/blob/main/core/lessons.py"
click node_practice "https://github.com/fakhrihuseynov/python-platform/blob/main/core/practice.py"
click node_docs "https://github.com/fakhrihuseynov/python-platform/blob/main/core/docs.py"
click node_flashcards "https://github.com/fakhrihuseynov/python-platform/blob/main/core/flashcards.py"
click node_srs "https://github.com/fakhrihuseynov/python-platform/blob/main/core/srs.py"
click node_learning_log "https://github.com/fakhrihuseynov/python-platform/blob/main/core/log.py"
click node_storage "https://github.com/fakhrihuseynov/python-platform/blob/main/core/storage.py"
click node_card_data "https://github.com/fakhrihuseynov/python-platform/tree/main/data"
click node_docs_data "https://github.com/fakhrihuseynov/python-platform/tree/main/data/docs"
click node_learn_template "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/learn.html"
click node_practice_template "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/practice.html"
click node_flashcards_template "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/flashcards.html"
click node_coach_template "https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/coach.html"

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_factory,node_home_route,node_learn_route,node_practice_route,node_flashcards_route,node_coach_route,node_learn_template,node_practice_template,node_flashcards_template,node_coach_template toneBlue
class node_lessons,node_practice,node_docs toneAmber
class node_flashcards,node_srs,node_learning_log toneMint
class node_storage,node_card_data,node_docs_data,node_ollama toneRose
class node_learner toneIndigo
```

## Components

### Web application

- [Flask app factory](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/__init__.py): `app/web/__init__.py`
- [Home route](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/home.py): `app/web/routes/home.py`
- [Learn and docs routes](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/learn.py): `app/web/routes/learn.py`
- [Practice route](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/practice.py): `app/web/routes/practice.py`
- [Flashcard routes](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/flashcards.py): `app/web/routes/flashcards.py`
- [Coach route](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/routes/coach.py): `app/web/routes/coach.py`
- [Learn and docs views](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/learn.html): `app/web/templates/learn.html`
- [Practice view](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/practice.html): `app/web/templates/practice.html`
- [Flashcards view](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/flashcards.html): `app/web/templates/flashcards.html`
- [Coach view](https://github.com/fakhrihuseynov/python-platform/blob/main/app/web/templates/coach.html): `app/web/templates/coach.html`

### Learning and practice

- [Lesson registry](https://github.com/fakhrihuseynov/python-platform/blob/main/core/lessons.py): `core/lessons.py`
- [Code execution](https://github.com/fakhrihuseynov/python-platform/blob/main/core/practice.py): `core/practice.py`
- [Learning documents](https://github.com/fakhrihuseynov/python-platform/blob/main/core/docs.py): `core/docs.py`

### Review and tracking

- [Flashcard management](https://github.com/fakhrihuseynov/python-platform/blob/main/core/flashcards.py): `core/flashcards.py`
- [SM-2 scheduling](https://github.com/fakhrihuseynov/python-platform/blob/main/core/srs.py): `core/srs.py`
- [Learning log](https://github.com/fakhrihuseynov/python-platform/blob/main/core/log.py): `core/log.py`

### Local data and AI

- [YAML and JSONL storage](https://github.com/fakhrihuseynov/python-platform/blob/main/core/storage.py): `core/storage.py`
- [Card data](https://github.com/fakhrihuseynov/python-platform/tree/main/data): `data`
- [Document data](https://github.com/fakhrihuseynov/python-platform/tree/main/data/docs): `data/docs`
- **Local Ollama**

### Other components

- **Learner**

## Connections

- Learner → Flask app factory: uses web app
- Flask app factory → Home route: registers routes
- Flask app factory → Learn and docs routes: registers routes
- Flask app factory → Practice route: registers routes
- Flask app factory → Flashcard routes: registers routes
- Flask app factory → Coach route: registers routes
- Learner → Learn and docs routes: requests lessons and docs
- Learn and docs routes → Lesson registry: loads lessons
- Learn and docs routes → Learning documents: manages documents
- Learn and docs routes → Learn and docs views: renders view
- Learning documents → Document data: reads and writes
- Learner → Practice route: submits code
- Practice route → Code execution: runs code
- Practice route → Practice view: renders feedback
- Learner → Flashcard routes: reviews and grades
- Flashcard routes → Flashcard management: loads and grades cards
- Flashcard routes → Flashcards view: renders cards
- Flashcard management → SM-2 scheduling: updates schedule
- Flashcard management → YAML and JSONL storage: reads and writes cards
- YAML and JSONL storage → Card data: reads and writes JSONL
- Learner → Coach route: asks question
- Coach route → Local Ollama: requests generation
- Coach route → Coach view: renders reply
