# anilkumar10-hub/ai-powered-personalyzed-tutor architecture

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

- Interactive diagram: https://gitdiagram.com/anilkumar10-hub/ai-powered-personalyzed-tutor
- Repository: https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor

## Overview

This is a personalized AI tutoring application: learners create a profile, take a pretest, follow a generated learning path, study resources, take quizzes, and review progress. The frontend calls a Flask API; backend agent orchestration creates paths and content, evaluates quiz work, and stores application data in MongoDB. The graph also preserves content enrichment, YouTube, analytics, and admin capabilities. Unsampled route and UI implementations are represented only where the API client, source index, or excerpts support them; edges avoid asserting unshown backend call chains.

Main entry points: [`frontend/lib/api.js`](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/api.js) (API client), [`backend/agents/enhanced_content_generator.py`](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_content_generator.py) (Content generation), [`frontend/app/resource/[id]/page.js`](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/resource/%5Bid%5D/page.js) (Study resource), [`backend/app.py`](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/app.py) (Flask API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learner_ui["Learner experience"]
  node_profile["Profile setup<br/>[page.js]"]
  node_pretest["Pretest<br/>[page.js]"]
  node_path_view["Learning path<br/>[page.js]"]
  node_resource_view["Study resource<br/>[page.js]"]
  node_quiz_view["Quiz<br/>[page.js]"]
  node_progress_view["Progress<br/>[page.js]"]
  node_dashboard["Dashboard and history<br/>[page.js]"]
  node_admin["Admin and analytics<br/>[page.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_backend["Learning services"]
  node_flask_api["Flask API<br/>[app.py]"]
  node_orchestrator["Agent orchestrator<br/>[orchestrator.py]"]
  node_path_generator["Path generator"]
  node_content_generator["Content generation"]
  node_learning_content["Learning content"]
  node_evaluator["Quiz evaluation"]
  node_domain_models["Learning models<br/>[models.py]"]
end

subgraph group_storage["Persistence and cache"]
  node_mongo_data[("Application data<br/>[app.py]")]
  node_mcp_cache[("Mongo cache<br/>[mongo_mcp.py]")]
end

subgraph group_identity["Identity and access"]
  node_auth_context["Auth context<br/>[AuthContext.js]"]
  node_auth_service["Auth service<br/>[auth.js]"]
  node_firebase["Firebase auth<br/>[firebase.js]"]
end

subgraph group_enrichment["Learning enrichment"]
  node_youtube["YouTube service<br/>[youtube_service.py]"]
  node_tutor_route["Tutor endpoint<br/>[route.js]"]
end

node_learner(("Learner"))
node_gemini["Gemini AI"]
node_youtube_service["YouTube"]

node_learner -.->|"creates profile"| node_profile
node_learner -.->|"takes pretest"| node_pretest
node_learner -.->|"follows path"| node_path_view
node_learner -.->|"studies resource"| node_resource_view
node_learner -.->|"submits answers"| node_quiz_view
node_learner -.->|"reviews progress"| node_progress_view
node_profile -->|"creates learner"| node_api_client
node_pretest -.->|"uses API"| node_api_client
node_path_view -.->|"uses API"| node_api_client
node_resource_view -->|"fetches resource"| node_api_client
node_quiz_view -.->|"uses API"| node_api_client
node_progress_view -.->|"uses API"| node_api_client
node_dashboard -.->|"uses API"| node_api_client
node_admin -->|"uses API"| node_api_client
node_api_client -->|"HTTP requests"| node_flask_api
node_flask_api -.->|"reads and writes"| node_mongo_data
node_flask_api -.->|"delegates learner setup"| node_orchestrator
node_orchestrator -->|"generates path"| node_path_generator
node_orchestrator -->|"saves profile and path"| node_mongo_data
node_path_generator -->|"imports generator"| node_content_generator
node_path_generator -->|"uses content generator"| node_learning_content
node_content_generator -->|"caches quiz content"| node_mcp_cache
node_content_generator -.->|"generates content"| node_gemini
node_evaluator -->|"imports generator"| node_content_generator
node_evaluator -->|"uses cache"| node_mcp_cache
node_path_generator -->|"uses cache"| node_mcp_cache
node_orchestrator -->|"creates models"| node_domain_models
node_content_generator -->|"creates questions"| node_domain_models
node_resource_view -.->|"optional tutor"| node_tutor_route
node_flask_api -.->|"video operations"| node_youtube
node_youtube -.->|"searches videos"| node_youtube_service
node_resource_view -.->|"requests videos"| node_youtube
node_auth_context -->|"uses auth service"| node_auth_service
node_auth_service -->|"sign-in and sign-out"| node_firebase

click node_profile "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/dashboard/create-profile/page.js"
click node_pretest "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/pretest/%5Bid%5D/page.js"
click node_path_view "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/learning-path/%5Bid%5D/page.js"
click node_resource_view "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/resource/%5Bid%5D/page.js"
click node_quiz_view "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/quiz/%5Bid%5D/page.js"
click node_progress_view "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/progress/%5Bid%5D/page.js"
click node_dashboard "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/dashboard/page.js"
click node_admin "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/admin/page.js"
click node_api_client "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/api.js"
click node_auth_context "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/AuthContext.js"
click node_auth_service "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/auth.js"
click node_firebase "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/firebase.js"
click node_flask_api "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/app.py"
click node_orchestrator "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/orchestrator.py"
click node_path_generator "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_path_generator.py"
click node_content_generator "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_content_generator.py"
click node_learning_content "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/learning_content_generator.py"
click node_evaluator "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_evaluator.py"
click node_domain_models "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/models.py"
click node_mongo_data "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/app.py"
click node_mcp_cache "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/mcp_server/mongo_mcp.py"
click node_youtube "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/services/youtube_service.py"
click node_tutor_route "https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/api/call-tutor/route.js"

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_profile,node_pretest,node_path_view,node_resource_view,node_quiz_view,node_progress_view,node_dashboard,node_admin,node_api_client toneBlue
class node_flask_api,node_orchestrator,node_path_generator,node_content_generator,node_learning_content,node_evaluator,node_domain_models toneAmber
class node_mongo_data,node_mcp_cache toneMint
class node_auth_context,node_auth_service,node_firebase toneRose
class node_youtube,node_tutor_route,node_learner,node_gemini,node_youtube_service toneIndigo
```

## Components

### Learner experience

- [Profile setup](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/dashboard/create-profile/page.js): `frontend/app/dashboard/create-profile/page.js`
- [Pretest](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/pretest/%5Bid%5D/page.js): `frontend/app/pretest/[id]/page.js`
- [Learning path](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/learning-path/%5Bid%5D/page.js): `frontend/app/learning-path/[id]/page.js`
- [Study resource](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/resource/%5Bid%5D/page.js): `frontend/app/resource/[id]/page.js`
- [Quiz](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/quiz/%5Bid%5D/page.js): `frontend/app/quiz/[id]/page.js`
- [Progress](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/progress/%5Bid%5D/page.js): `frontend/app/progress/[id]/page.js`
- [Dashboard and history](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/dashboard/page.js): `frontend/app/dashboard/page.js`
- [Admin and analytics](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/admin/page.js): `frontend/app/admin/page.js`
- [API client](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/api.js): `frontend/lib/api.js`

### Learning services

- [Flask API](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/app.py): `backend/app.py`
- [Agent orchestrator](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/orchestrator.py): `backend/agents/orchestrator.py`
- [Path generator](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_path_generator.py): `backend/agents/enhanced_path_generator.py`
- [Content generation](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_content_generator.py): `backend/agents/enhanced_content_generator.py`
- [Learning content](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/learning_content_generator.py): `backend/agents/learning_content_generator.py`
- [Quiz evaluation](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/enhanced_evaluator.py): `backend/agents/enhanced_evaluator.py`
- [Learning models](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/agents/models.py): `backend/agents/models.py`

### Persistence and cache

- [Application data](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/app.py): `backend/app.py`
- [Mongo cache](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/mcp_server/mongo_mcp.py): `backend/mcp_server/mongo_mcp.py`

### Identity and access

- [Auth context](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/AuthContext.js): `frontend/lib/AuthContext.js`
- [Auth service](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/auth.js): `frontend/lib/auth.js`
- [Firebase auth](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/lib/firebase.js): `frontend/lib/firebase.js`

### Learning enrichment

- [YouTube service](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/backend/services/youtube_service.py): `backend/services/youtube_service.py`
- [Tutor endpoint](https://github.com/anilkumar10-hub/ai-powered-personalyzed-tutor/blob/main/frontend/app/api/call-tutor/route.js): `frontend/app/api/call-tutor/route.js`

### Other components

- **Learner**
- **Gemini AI**
- **YouTube**

## Connections

- Learner → Profile setup: creates profile
- Learner → Pretest: takes pretest
- Learner → Learning path: follows path
- Learner → Study resource: studies resource
- Learner → Quiz: submits answers
- Learner → Progress: reviews progress
- Profile setup → API client: creates learner (evidence: `frontend/lib/api.js`)
- Pretest → API client: uses API
- Learning path → API client: uses API
- Study resource → API client: fetches resource (evidence: `frontend/app/resource/[id]/page.js`)
- Quiz → API client: uses API
- Progress → API client: uses API
- Dashboard and history → API client: uses API
- Admin and analytics → API client: uses API (evidence: `frontend/app/admin/page.js`)
- API client → Flask API: HTTP requests (evidence: `frontend/lib/api.js`)
- Flask API → Application data: reads and writes (evidence: `backend/app.py`)
- Flask API → Agent orchestrator: delegates learner setup
- Agent orchestrator → Path generator: generates path (evidence: `backend/agents/orchestrator.py`)
- Agent orchestrator → Application data: saves profile and path (evidence: `backend/agents/orchestrator.py`)
- Path generator → Content generation: imports generator (evidence: `backend/agents/enhanced_path_generator.py`)
- Path generator → Learning content: uses content generator (evidence: `backend/agents/enhanced_path_generator.py`)
- Content generation → Mongo cache: caches quiz content (evidence: `backend/agents/enhanced_content_generator.py`)
- Content generation → Gemini AI: generates content
- Quiz evaluation → Content generation: imports generator (evidence: `backend/agents/enhanced_evaluator.py`)
- Quiz evaluation → Mongo cache: uses cache (evidence: `backend/agents/enhanced_evaluator.py`)
- Path generator → Mongo cache: uses cache (evidence: `backend/agents/enhanced_path_generator.py`)
- Agent orchestrator → Learning models: creates models (evidence: `backend/agents/orchestrator.py`)
- Content generation → Learning models: creates questions (evidence: `backend/agents/enhanced_content_generator.py`)
- Study resource → Tutor endpoint: optional tutor
- Flask API → YouTube service: video operations (evidence: `backend/app.py`)
- YouTube service → YouTube: searches videos
- Study resource → YouTube service: requests videos
- Auth context → Auth service: uses auth service (evidence: `frontend/lib/AuthContext.js`)
- Auth service → Firebase auth: sign-in and sign-out (evidence: `frontend/lib/auth.js`)
