# sainath8910/youtube_note_extension architecture

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

- Interactive diagram: https://gitdiagram.com/sainath8910/youtube_note_extension
- Repository: https://github.com/sainath8910/youtube_note_extension

## Overview

YouTube Knowledge is a browser-based learning workspace: users capture videos, web pages, and notes in the extension, then organize, search, and learn from that material through Django APIs and AI tools. The graph keeps capture and workspace features distinct from indexing, retrieval, and generation. README-documented workflows support several links; source-index references support selected internal calls. Unsampled views and services are represented at their exact paths, but their internal call wiring is not inferred.

Main entry points: [`extension/src/ragApi.ts`](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/ragApi.ts) (Extension API clients), [`backend/notes/models.py`](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/notes/models.py) (Notes and trash), [`backend/knowledge/views.py`](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/views.py) (Knowledge endpoints), [`backend/videos/services/analysis.py`](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/services/analysis.py) (Video capture and analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser workspace"]
  node_extension["Extension shell<br/>[App.tsx]"]
  node_sidebar["Learning sidebar<br/>[Sidebar.tsx]"]
  node_dashboard["Knowledge dashboard<br/>[Dashboard.tsx]"]
  node_video_ui["Video library<br/>[VideosPage.tsx]"]
  node_sync_ui["Sync workspace<br/>[SyncBridgePage.tsx]"]
  node_auth_ui["Account access<br/>[authFlow.ts]"]
  node_auth_client["Supabase auth client<br/>[backgroundAuth.ts]"]
  node_api_client["Extension API clients<br/>[ragApi.ts]"]
end

subgraph group_api["Workspace API"]
  node_video_api["Video endpoints<br/>[views.py]"]
  node_note_api["Notes endpoints<br/>[views.py]"]
  node_folder_api["Folder endpoints<br/>[views.py]"]
  node_knowledge_api["Knowledge endpoints<br/>[views.py]"]
  node_sync_api["Sync endpoints<br/>[views.py]"]
end

subgraph group_knowledge["Knowledge and AI"]
  node_video_services["Video capture and analysis<br/>[analysis.py]"]
  node_indexing["Knowledge indexing"]
  node_embeddings["Embedding service<br/>[embeddings.py]"]
  node_retrieval["Semantic retrieval<br/>[retrieval.py]"]
  node_rag["Grounded answers<br/>[rag.py]"]
  node_previous_context["Previous Context jobs"]
end

subgraph group_data["Workspace data"]
  node_notes[("Notes and trash<br/>[models.py]")]
  node_folders[("Folders<br/>[models.py]")]
  node_videos[("Video records<br/>[models.py]")]
  node_knowledge_data[("Chunks and conversations<br/>[models.py]")]
  node_playlists[("Playlists<br/>[models.py]")]
  node_sync_data[("Sync records<br/>[models.py]")]
end

subgraph group_integrations["External services"]
  node_supabase["Supabase Auth"]
  node_kafka["Kafka"]
  node_postgres[("PostgreSQL with pgvector")]
  node_gemini["Gemini"]
  node_hf["Hugging Face fallback"]
end

node_learner(("Learner"))
node_youtube(("YouTube and web pages"))

node_learner -->|"uses"| node_extension
node_youtube -->|"provides material"| node_sidebar
node_sidebar -->|"requests learning tools"| node_api_client
node_dashboard -->|"requests workspace data"| node_api_client
node_video_ui -->|"requests video data"| node_api_client
node_sync_ui -->|"requests sync"| node_api_client
node_auth_ui -->|"delegates auth"| node_auth_client
node_auth_client -->|"authenticates"| node_supabase
node_api_client -->|"calls API"| node_video_api
node_api_client -->|"calls API"| node_note_api
node_api_client -->|"calls API"| node_folder_api
node_api_client -->|"calls API"| node_knowledge_api
node_api_client -->|"calls API"| node_sync_api
node_video_api -.->|"handles video analysis"| node_video_services
node_knowledge_api -->|"retrieves context"| node_retrieval
node_retrieval -->|"embeds query"| node_embeddings
node_knowledge_api -->|"generates answers"| node_rag
node_rag -->|"grounds answers"| node_retrieval
node_knowledge_api -->|"requests context"| node_previous_context
node_previous_context -->|"queues jobs"| node_kafka
node_video_services -->|"stores video analysis"| node_videos
node_indexing -->|"creates vectors"| node_embeddings
node_indexing -->|"stores chunks"| node_knowledge_data
node_retrieval -->|"searches chunks"| node_knowledge_data
node_notes -->|"triggers reindex"| node_indexing
node_video_api -.->|"reads and writes"| node_videos
node_note_api -.->|"reads and writes"| node_notes
node_folder_api -->|"reads and writes"| node_folders
node_sync_api -.->|"reads and writes"| node_sync_data
node_sync_data -->|"syncs notes"| node_notes
node_sync_data -->|"syncs folders"| node_folders
node_sync_data -->|"syncs playlists"| node_playlists
node_notes -->|"assigns folder"| node_folders
node_notes -->|"associates video"| node_videos
node_knowledge_data -->|"persists vectors"| node_postgres
node_rag -->|"generates response"| node_gemini
node_video_services -->|"analyzes video"| node_gemini
node_video_services -.->|"optional fallback"| node_hf

click node_extension "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/App.tsx"
click node_sidebar "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/Sidebar.tsx"
click node_dashboard "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/Dashboard.tsx"
click node_video_ui "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/VideosPage.tsx"
click node_sync_ui "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/SyncBridgePage.tsx"
click node_auth_ui "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/authFlow.ts"
click node_auth_client "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/backgroundAuth.ts"
click node_api_client "https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/ragApi.ts"
click node_video_api "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/views.py"
click node_note_api "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/notes/views.py"
click node_folder_api "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/folders/views.py"
click node_knowledge_api "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/views.py"
click node_sync_api "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/sync_bridge/views.py"
click node_video_services "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/services/analysis.py"
click node_indexing "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/analysis_indexing.py"
click node_embeddings "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/embeddings.py"
click node_retrieval "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/retrieval.py"
click node_rag "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/rag.py"
click node_previous_context "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/previous_context_jobs.py"
click node_notes "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/notes/models.py"
click node_folders "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/folders/models.py"
click node_videos "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/models.py"
click node_knowledge_data "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/models.py"
click node_playlists "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/playlists/models.py"
click node_sync_data "https://github.com/sainath8910/youtube_note_extension/blob/master/backend/sync_bridge/models.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_extension,node_sidebar,node_dashboard,node_video_ui,node_sync_ui,node_auth_ui,node_auth_client,node_api_client toneBlue
class node_video_api,node_note_api,node_folder_api,node_knowledge_api,node_sync_api toneAmber
class node_video_services,node_indexing,node_embeddings,node_retrieval,node_rag,node_previous_context toneMint
class node_notes,node_folders,node_videos,node_knowledge_data,node_playlists,node_sync_data toneRose
class node_supabase,node_kafka,node_postgres,node_gemini,node_hf,node_learner,node_youtube toneIndigo
```

## Components

### Browser workspace

- [Extension shell](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/App.tsx): `extension/src/App.tsx`
- [Learning sidebar](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/Sidebar.tsx): `extension/src/Sidebar.tsx`
- [Knowledge dashboard](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/Dashboard.tsx): `extension/src/Dashboard.tsx`
- [Video library](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/VideosPage.tsx): `extension/src/VideosPage.tsx`
- [Sync workspace](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/SyncBridgePage.tsx): `extension/src/SyncBridgePage.tsx`
- [Account access](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/authFlow.ts): `extension/src/authFlow.ts`
- [Supabase auth client](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/backgroundAuth.ts): `extension/src/backgroundAuth.ts`
- [Extension API clients](https://github.com/sainath8910/youtube_note_extension/blob/master/extension/src/ragApi.ts): `extension/src/ragApi.ts`

### Workspace API

- [Video endpoints](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/views.py): `backend/videos/views.py`
- [Notes endpoints](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/notes/views.py): `backend/notes/views.py`
- [Folder endpoints](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/folders/views.py): `backend/folders/views.py`
- [Knowledge endpoints](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/views.py): `backend/knowledge/views.py`
- [Sync endpoints](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/sync_bridge/views.py): `backend/sync_bridge/views.py`

### Knowledge and AI

- [Video capture and analysis](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/services/analysis.py): `backend/videos/services/analysis.py`
- [Knowledge indexing](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/analysis_indexing.py): `backend/knowledge/services/analysis_indexing.py`
- [Embedding service](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/embeddings.py): `backend/knowledge/services/embeddings.py`
- [Semantic retrieval](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/retrieval.py): `backend/knowledge/services/retrieval.py`
- [Grounded answers](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/rag.py): `backend/knowledge/services/rag.py`
- [Previous Context jobs](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/services/previous_context_jobs.py): `backend/knowledge/services/previous_context_jobs.py`

### Workspace data

- [Notes and trash](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/notes/models.py): `backend/notes/models.py`
- [Folders](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/folders/models.py): `backend/folders/models.py`
- [Video records](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/videos/models.py): `backend/videos/models.py`
- [Chunks and conversations](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/knowledge/models.py): `backend/knowledge/models.py`
- [Playlists](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/playlists/models.py): `backend/playlists/models.py`
- [Sync records](https://github.com/sainath8910/youtube_note_extension/blob/master/backend/sync_bridge/models.py): `backend/sync_bridge/models.py`

### External services

- **Supabase Auth**
- **Kafka**
- **PostgreSQL with pgvector**
- **Gemini**
- **Hugging Face fallback**

### Other components

- **Learner**
- **YouTube and web pages**

## Connections

- Learner → Extension shell: uses (evidence: `README.md`)
- YouTube and web pages → Learning sidebar: provides material (evidence: `README.md`)
- Learning sidebar → Extension API clients: requests learning tools (evidence: `README.md`)
- Knowledge dashboard → Extension API clients: requests workspace data (evidence: `README.md`)
- Video library → Extension API clients: requests video data (evidence: `README.md`)
- Sync workspace → Extension API clients: requests sync (evidence: `README.md`)
- Account access → Supabase auth client: delegates auth (evidence: `extension/src/authFlow.ts`)
- Supabase auth client → Supabase Auth: authenticates (evidence: `README.md`)
- Extension API clients → Video endpoints: calls API (evidence: `README.md`)
- Extension API clients → Notes endpoints: calls API (evidence: `README.md`)
- Extension API clients → Folder endpoints: calls API (evidence: `README.md`)
- Extension API clients → Knowledge endpoints: calls API (evidence: `README.md`)
- Extension API clients → Sync endpoints: calls API (evidence: `README.md`)
- Video endpoints → Video capture and analysis: handles video analysis
- Knowledge endpoints → Semantic retrieval: retrieves context (evidence: `README.md`)
- Semantic retrieval → Embedding service: embeds query (evidence: `backend/knowledge/services/retrieval.py`)
- Knowledge endpoints → Grounded answers: generates answers (evidence: `README.md`)
- Grounded answers → Semantic retrieval: grounds answers (evidence: `README.md`)
- Knowledge endpoints → Previous Context jobs: requests context (evidence: `README.md`)
- Previous Context jobs → Kafka: queues jobs (evidence: `README.md`)
- Video capture and analysis → Video records: stores video analysis
- Knowledge indexing → Embedding service: creates vectors (evidence: `backend/knowledge/services/analysis_indexing.py`)
- Knowledge indexing → Chunks and conversations: stores chunks (evidence: `backend/knowledge/services/analysis_indexing.py`)
- Semantic retrieval → Chunks and conversations: searches chunks (evidence: `backend/knowledge/services/retrieval.py`)
- Notes and trash → Knowledge indexing: triggers reindex
- Video endpoints → Video records: reads and writes
- Notes endpoints → Notes and trash: reads and writes
- Folder endpoints → Folders: reads and writes (evidence: `backend/folders/views.py`)
- Sync endpoints → Sync records: reads and writes
- Sync records → Notes and trash: syncs notes (evidence: `backend/sync_bridge/services.py`)
- Sync records → Folders: syncs folders (evidence: `backend/sync_bridge/services.py`)
- Sync records → Playlists: syncs playlists (evidence: `backend/sync_bridge/services.py`)
- Notes and trash → Folders: assigns folder (evidence: `backend/notes/models.py`)
- Notes and trash → Video records: associates video (evidence: `backend/notes/models.py`)
- Chunks and conversations → PostgreSQL with pgvector: persists vectors (evidence: `README.md`)
- Grounded answers → Gemini: generates response (evidence: `README.md`)
- Video capture and analysis → Gemini: analyzes video (evidence: `README.md`)
- Video capture and analysis → Hugging Face fallback: optional fallback (evidence: `README.md`)
