# arinbuilds/learnflow architecture

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

- Interactive diagram: https://gitdiagram.com/arinbuilds/learnflow
- Repository: https://github.com/arinbuilds/learnflow

## Overview

Learnflow combines a Next.js learning interface with a FastAPI service. Learners choose or create a course, import a video’s captions and supporting materials, then ask timestamp-aware questions or use learning actions; answers include citations and exclude future transcript content. A separate workflow parses candidate profiles, conducts personalized mock interviews, and produces a scorecard. The graph preserves ingestion, retrieval, persistence, and provider capabilities documented by the README. The API entry point is unsampled, so its internal dispatch links are shown as unverified rather than asserted.

Main entry points: [`backend/app/main.py`](https://github.com/arinbuilds/learnflow/blob/main/backend/app/main.py) (FastAPI API), [`frontend/components/Assistant.tsx`](https://github.com/arinbuilds/learnflow/blob/main/frontend/components/Assistant.tsx) (Learning Assistant), [`backend/app/embeddings.py`](https://github.com/arinbuilds/learnflow/blob/main/backend/app/embeddings.py) (Embedding Providers), [`backend/app/ingestion.py`](https://github.com/arinbuilds/learnflow/blob/main/backend/app/ingestion.py) (Resource Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learner_ui["Learner Interface"]
  node_assistant["Learning Assistant<br/>[Assistant.tsx]"]
  node_lesson_player["Lesson Player<br/>[LessonPlayer.tsx]"]
  node_video_parser["Video Source Parser<br/>[video-source.ts]"]
  node_api_proxy["API Proxy<br/>[route.ts]"]
end

subgraph group_api_workflows["API Workflows"]
  node_fastapi["FastAPI API<br/>[main.py]"]
  node_youtube_import["YouTube Import<br/>[youtube.py]"]
end

subgraph group_learning_content["Learning Content"]
  node_ingestion["Resource Ingestion<br/>[ingestion.py]"]
  node_retrieval["Timestamped Retrieval<br/>[retrieval.py]"]
  node_embeddings["Embedding Providers<br/>[embeddings.py]"]
  node_content_store[("Course and Chat Store<br/>[storage.py]")]
  node_domain_models["Learning Data Models<br/>[domain.py]"]
end

subgraph group_interview["Interview Practice"]
  node_interview_flow["Interview Workflow<br/>[interview.py]"]
end

subgraph group_platform["Runtime Services"]
  node_llm_provider["LLM Adapters<br/>[providers.py]"]
  node_settings["Runtime Settings<br/>[config.py]"]
end

node_learner(("Learner"))
node_postgres[("PostgreSQL / Supabase")]
node_youtube_service["YouTube Captions"]
node_model_services["Hosted Model Services"]

node_learner -->|"uses"| node_assistant
node_assistant -->|"renders"| node_lesson_player
node_assistant -->|"parses URLs"| node_video_parser
node_assistant -->|"requests API"| node_api_proxy
node_api_proxy -->|"forwards requests"| node_fastapi
node_fastapi -.->|"dispatches import"| node_youtube_import
node_youtube_import -.->|"fetches captions"| node_youtube_service
node_fastapi -.->|"dispatches uploads"| node_ingestion
node_ingestion -->|"embeds chunks"| node_embeddings
node_ingestion -->|"creates chunks"| node_domain_models
node_fastapi -.->|"dispatches questions"| node_retrieval
node_retrieval -->|"embeds query"| node_embeddings
node_retrieval -->|"searches chunks"| node_content_store
node_content_store -->|"stores models"| node_domain_models
node_content_store -.->|"persists data"| node_postgres
node_fastapi -.->|"dispatches interviews"| node_interview_flow
node_interview_flow -->|"generates turns"| node_llm_provider
node_interview_flow -->|"uses interview model"| node_domain_models
node_llm_provider -->|"calls provider"| node_model_services
node_embeddings -->|"calls provider"| node_model_services
node_embeddings -->|"reads settings"| node_settings
node_llm_provider -->|"reads settings"| node_settings

click node_assistant "https://github.com/arinbuilds/learnflow/blob/main/frontend/components/Assistant.tsx"
click node_lesson_player "https://github.com/arinbuilds/learnflow/blob/main/frontend/components/LessonPlayer.tsx"
click node_video_parser "https://github.com/arinbuilds/learnflow/blob/main/frontend/lib/video-source.ts"
click node_api_proxy "https://github.com/arinbuilds/learnflow/blob/main/frontend/app/api/%5B...path%5D/route.ts"
click node_fastapi "https://github.com/arinbuilds/learnflow/blob/main/backend/app/main.py"
click node_youtube_import "https://github.com/arinbuilds/learnflow/blob/main/backend/app/youtube.py"
click node_ingestion "https://github.com/arinbuilds/learnflow/blob/main/backend/app/ingestion.py"
click node_retrieval "https://github.com/arinbuilds/learnflow/blob/main/backend/app/retrieval.py"
click node_embeddings "https://github.com/arinbuilds/learnflow/blob/main/backend/app/embeddings.py"
click node_content_store "https://github.com/arinbuilds/learnflow/blob/main/backend/app/storage.py"
click node_domain_models "https://github.com/arinbuilds/learnflow/blob/main/backend/app/domain.py"
click node_interview_flow "https://github.com/arinbuilds/learnflow/blob/main/backend/app/interview.py"
click node_llm_provider "https://github.com/arinbuilds/learnflow/blob/main/backend/app/providers.py"
click node_settings "https://github.com/arinbuilds/learnflow/blob/main/backend/app/config.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_assistant,node_lesson_player,node_video_parser,node_api_proxy toneBlue
class node_fastapi,node_youtube_import,node_postgres toneAmber
class node_ingestion,node_retrieval,node_embeddings,node_content_store,node_domain_models toneMint
class node_interview_flow toneRose
class node_llm_provider,node_settings,node_learner,node_youtube_service,node_model_services toneIndigo
```

## Components

### Learner Interface

- [Learning Assistant](https://github.com/arinbuilds/learnflow/blob/main/frontend/components/Assistant.tsx): `frontend/components/Assistant.tsx`
- [Lesson Player](https://github.com/arinbuilds/learnflow/blob/main/frontend/components/LessonPlayer.tsx): `frontend/components/LessonPlayer.tsx`
- [Video Source Parser](https://github.com/arinbuilds/learnflow/blob/main/frontend/lib/video-source.ts): `frontend/lib/video-source.ts`
- [API Proxy](https://github.com/arinbuilds/learnflow/blob/main/frontend/app/api/%5B...path%5D/route.ts): `frontend/app/api/[...path]/route.ts`

### API Workflows

- [FastAPI API](https://github.com/arinbuilds/learnflow/blob/main/backend/app/main.py): `backend/app/main.py`
- [YouTube Import](https://github.com/arinbuilds/learnflow/blob/main/backend/app/youtube.py): `backend/app/youtube.py`

### Learning Content

- [Resource Ingestion](https://github.com/arinbuilds/learnflow/blob/main/backend/app/ingestion.py): `backend/app/ingestion.py`
- [Timestamped Retrieval](https://github.com/arinbuilds/learnflow/blob/main/backend/app/retrieval.py): `backend/app/retrieval.py`
- [Embedding Providers](https://github.com/arinbuilds/learnflow/blob/main/backend/app/embeddings.py): `backend/app/embeddings.py`
- [Course and Chat Store](https://github.com/arinbuilds/learnflow/blob/main/backend/app/storage.py): `backend/app/storage.py`
- [Learning Data Models](https://github.com/arinbuilds/learnflow/blob/main/backend/app/domain.py): `backend/app/domain.py`

### Interview Practice

- [Interview Workflow](https://github.com/arinbuilds/learnflow/blob/main/backend/app/interview.py): `backend/app/interview.py`

### Runtime Services

- [LLM Adapters](https://github.com/arinbuilds/learnflow/blob/main/backend/app/providers.py): `backend/app/providers.py`
- [Runtime Settings](https://github.com/arinbuilds/learnflow/blob/main/backend/app/config.py): `backend/app/config.py`

### Other components

- **Learner**
- **PostgreSQL / Supabase**
- **YouTube Captions**
- **Hosted Model Services**

## Connections

- Learner → Learning Assistant: uses (evidence: `README.md`)
- Learning Assistant → Lesson Player: renders (evidence: `frontend/components/Assistant.tsx`)
- Learning Assistant → Video Source Parser: parses URLs (evidence: `frontend/components/Assistant.tsx`)
- Learning Assistant → API Proxy: requests API (evidence: `frontend/components/Assistant.tsx`)
- API Proxy → FastAPI API: forwards requests (evidence: `README.md`)
- FastAPI API → YouTube Import: dispatches import
- YouTube Import → YouTube Captions: fetches captions
- FastAPI API → Resource Ingestion: dispatches uploads
- Resource Ingestion → Embedding Providers: embeds chunks (evidence: `backend/app/ingestion.py`)
- Resource Ingestion → Learning Data Models: creates chunks (evidence: `backend/app/ingestion.py`)
- FastAPI API → Timestamped Retrieval: dispatches questions
- Timestamped Retrieval → Embedding Providers: embeds query (evidence: `backend/app/retrieval.py`)
- Timestamped Retrieval → Course and Chat Store: searches chunks (evidence: `backend/app/retrieval.py`)
- Course and Chat Store → Learning Data Models: stores models (evidence: `backend/app/storage.py`)
- Course and Chat Store → PostgreSQL / Supabase: persists data
- FastAPI API → Interview Workflow: dispatches interviews
- Interview Workflow → LLM Adapters: generates turns (evidence: `backend/app/interview.py`)
- Interview Workflow → Learning Data Models: uses interview model (evidence: `backend/app/interview.py`)
- LLM Adapters → Hosted Model Services: calls provider (evidence: `backend/app/providers.py`)
- Embedding Providers → Hosted Model Services: calls provider (evidence: `backend/app/embeddings.py`)
- Embedding Providers → Runtime Settings: reads settings (evidence: `backend/app/embeddings.py`)
- LLM Adapters → Runtime Settings: reads settings (evidence: `backend/app/providers.py`)
