# rehan0018/edufeedia architecture

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

- Interactive diagram: https://gitdiagram.com/rehan0018/edufeedia
- Repository: https://github.com/rehan0018/edufeedia

## Overview

Edufeedia is a student learning platform for ages 10–17. Students authenticate, receive a personalized study feed, explore lessons, ask a Socratic tutor, and complete quizzes and revision; teachers and guardians have separate oversight workflows. Content is verified and screened before it can enter the learning catalog. The graph combines documented product stages with source-index relationships and excerpted calls. Several router implementations and learning subsystems were not sampled, so their internal connections are omitted or shown only where the README documents them.

Main entry points: [`backend/app/main.py`](https://github.com/rehan0018/edufeedia/blob/main/backend/app/main.py) (FastAPI gateway), [`frontend/src/App.jsx`](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/App.jsx) (Learning app), [`backend/app/ingestion/pipeline.py`](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/pipeline.py) (Content ingestion), [`frontend/src/services/api.js`](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student and staff client"]
  node_web_app["Learning app<br/>[App.jsx]"]
  node_auth_ui["Authentication UI<br/>[AuthScreen.jsx]"]
  node_study_ui["Study interfaces<br/>[DailyPlanFeed.jsx]"]
  node_tutor_ui["Tutor chat"]
  node_teacher_ui["Teacher dashboard"]
end

subgraph group_api["API and access"]
  node_api_client["API client<br/>[api.js]"]
  node_gateway["FastAPI gateway<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_learning_routes["Learning routes<br/>[student.py]"]
  node_quiz_routes["Quiz and recall routes<br/>[quiz.py]"]
  node_tutor_routes["Tutor routes<br/>[tutor.py]"]
  node_ingest_routes["Ingestion routes<br/>[ingestion.py]"]
  node_teacher_routes["Teacher routes<br/>[teacher.py]"]
  node_store[("Application database<br/>[models.py]")]
end

subgraph group_content["Content lifecycle"]
  node_catalog_ingest["Content ingestion<br/>[pipeline.py]"]
  node_source_verify["Source verification<br/>[source_verifier.py]"]
  node_metadata["Metadata extraction"]
  node_embedder["Content embeddings<br/>[embedder.py]"]
end

subgraph group_learning["Learning and personalization"]
  node_rag["Hybrid RAG<br/>[rag_engine.py]"]
  node_llm["Model gateway<br/>[llm_client.py]"]
  node_socratic["Socratic policy<br/>[socratic_policy.py]"]
  node_mastery["Mastery and SM-2<br/>[mastery_engine.py]"]
  node_recommendations["Feed recommender<br/>[hybrid.py]"]
end

subgraph group_governance["Safety and oversight"]
  node_safety_gate["Safety engine<br/>[engine.py]"]
  node_ingest_safety["Ingestion screening"]
  node_privacy_routes["Privacy routes<br/>[privacy.py]"]
  node_consent["Guardian consent<br/>[consent_service.py]"]
  node_redis[("Redis sessions<br/>[redis_client.py]")]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_guardian(("Guardian"))
node_ai_providers["AI providers"]

node_student -->|"uses"| node_web_app
node_teacher -->|"reviews class"| node_teacher_ui
node_guardian -->|"uses"| node_web_app
node_web_app -->|"renders"| node_auth_ui
node_web_app -->|"renders"| node_study_ui
node_web_app -->|"renders"| node_tutor_ui
node_web_app -->|"renders"| node_teacher_ui
node_web_app -->|"fetches feed"| node_api_client
node_auth_ui -->|"authenticates"| node_api_client
node_study_ui -->|"loads study data"| node_api_client
node_tutor_ui -->|"sends questions"| node_api_client
node_teacher_ui -->|"loads analytics"| node_api_client
node_api_client -->|"calls API"| node_gateway
node_gateway -->|"mounts routes"| node_auth_routes
node_gateway -->|"mounts routes"| node_learning_routes
node_gateway -->|"mounts routes"| node_quiz_routes
node_gateway -->|"mounts routes"| node_tutor_routes
node_gateway -->|"mounts routes"| node_ingest_routes
node_gateway -->|"mounts routes"| node_teacher_routes
node_gateway -->|"mounts routes"| node_privacy_routes
node_ingest_routes -->|"invokes pipeline"| node_catalog_ingest
node_catalog_ingest -->|"verifies source"| node_source_verify
node_catalog_ingest -->|"extracts metadata"| node_metadata
node_catalog_ingest -->|"screens content"| node_safety_gate
node_catalog_ingest -->|"creates embeddings"| node_embedder
node_catalog_ingest -->|"persists content"| node_store
node_ingest_safety -->|"audits content"| node_safety_gate
node_rag -->|"embeds chunks"| node_embedder
node_rag -->|"retrieves chunks"| node_store
node_rag -->|"requests guidance"| node_llm
node_rag -->|"audits response"| node_socratic
node_llm -->|"audits output"| node_safety_gate
node_llm -.->|"queries providers"| node_ai_providers
node_tutor_routes -.->|"serves tutoring"| node_rag
node_quiz_routes -.->|"updates repetition"| node_mastery
node_learning_routes -.->|"serves study feed"| node_recommendations
node_recommendations -->|"reads learning data"| node_store
node_recommendations -->|"checks candidates"| node_safety_gate
node_teacher_routes -.->|"reads class data"| node_store
node_privacy_routes -.->|"handles consent"| node_consent
node_auth_routes -->|"revokes sessions"| node_redis
node_auth_routes -->|"reads and writes users"| node_store
node_mastery -.->|"persists mastery"| node_store

click node_web_app "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/AuthScreen.jsx"
click node_study_ui "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/DailyPlanFeed.jsx"
click node_tutor_ui "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/SocraticTutorChat.jsx"
click node_teacher_ui "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/TeacherDashboard.jsx"
click node_api_client "https://github.com/rehan0018/edufeedia/blob/main/frontend/src/services/api.js"
click node_gateway "https://github.com/rehan0018/edufeedia/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/auth.py"
click node_learning_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/student.py"
click node_quiz_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/quiz.py"
click node_tutor_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/tutor.py"
click node_ingest_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/ingestion.py"
click node_catalog_ingest "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/pipeline.py"
click node_source_verify "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/source_verifier.py"
click node_metadata "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/metadata_extractor.py"
click node_embedder "https://github.com/rehan0018/edufeedia/blob/main/backend/app/embeddings/embedder.py"
click node_safety_gate "https://github.com/rehan0018/edufeedia/blob/main/backend/app/safety/engine.py"
click node_ingest_safety "https://github.com/rehan0018/edufeedia/blob/main/backend/app/safety/ingestion_pipeline.py"
click node_rag "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/rag_engine.py"
click node_llm "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/llm_client.py"
click node_socratic "https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/socratic_policy.py"
click node_mastery "https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/mastery_engine.py"
click node_recommendations "https://github.com/rehan0018/edufeedia/blob/main/backend/app/recommender/hybrid.py"
click node_teacher_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/teacher.py"
click node_privacy_routes "https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/privacy.py"
click node_consent "https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/consent_service.py"
click node_store "https://github.com/rehan0018/edufeedia/blob/main/backend/app/models/models.py"
click node_redis "https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/redis_client.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_web_app,node_auth_ui,node_study_ui,node_tutor_ui,node_teacher_ui toneBlue
class node_api_client,node_gateway,node_auth_routes,node_learning_routes,node_quiz_routes,node_tutor_routes,node_ingest_routes,node_teacher_routes,node_store toneAmber
class node_catalog_ingest,node_source_verify,node_metadata,node_embedder toneMint
class node_rag,node_llm,node_socratic,node_mastery,node_recommendations toneRose
class node_safety_gate,node_ingest_safety,node_privacy_routes,node_consent,node_redis,node_student,node_teacher,node_guardian,node_ai_providers toneIndigo
```

## Components

### Student and staff client

- [Learning app](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication UI](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/AuthScreen.jsx): `frontend/src/components/AuthScreen.jsx`
- [Study interfaces](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/DailyPlanFeed.jsx): `frontend/src/components/DailyPlanFeed.jsx`
- [Tutor chat](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/SocraticTutorChat.jsx): `frontend/src/components/SocraticTutorChat.jsx`
- [Teacher dashboard](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/components/TeacherDashboard.jsx): `frontend/src/components/TeacherDashboard.jsx`

### API and access

- [API client](https://github.com/rehan0018/edufeedia/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [FastAPI gateway](https://github.com/rehan0018/edufeedia/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Learning routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/student.py): `backend/app/routers/student.py`
- [Quiz and recall routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/quiz.py): `backend/app/routers/quiz.py`
- [Tutor routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/tutor.py): `backend/app/routers/tutor.py`
- [Ingestion routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/ingestion.py): `backend/app/routers/ingestion.py`
- [Teacher routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/teacher.py): `backend/app/routers/teacher.py`
- [Application database](https://github.com/rehan0018/edufeedia/blob/main/backend/app/models/models.py): `backend/app/models/models.py`

### Content lifecycle

- [Content ingestion](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/pipeline.py): `backend/app/ingestion/pipeline.py`
- [Source verification](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/source_verifier.py): `backend/app/ingestion/source_verifier.py`
- [Metadata extraction](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ingestion/metadata_extractor.py): `backend/app/ingestion/metadata_extractor.py`
- [Content embeddings](https://github.com/rehan0018/edufeedia/blob/main/backend/app/embeddings/embedder.py): `backend/app/embeddings/embedder.py`

### Learning and personalization

- [Hybrid RAG](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/rag_engine.py): `backend/app/ai/rag_engine.py`
- [Model gateway](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/llm_client.py): `backend/app/ai/llm_client.py`
- [Socratic policy](https://github.com/rehan0018/edufeedia/blob/main/backend/app/ai/socratic_policy.py): `backend/app/ai/socratic_policy.py`
- [Mastery and SM-2](https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/mastery_engine.py): `backend/app/core/mastery_engine.py`
- [Feed recommender](https://github.com/rehan0018/edufeedia/blob/main/backend/app/recommender/hybrid.py): `backend/app/recommender/hybrid.py`

### Safety and oversight

- [Safety engine](https://github.com/rehan0018/edufeedia/blob/main/backend/app/safety/engine.py): `backend/app/safety/engine.py`
- [Ingestion screening](https://github.com/rehan0018/edufeedia/blob/main/backend/app/safety/ingestion_pipeline.py): `backend/app/safety/ingestion_pipeline.py`
- [Privacy routes](https://github.com/rehan0018/edufeedia/blob/main/backend/app/routers/privacy.py): `backend/app/routers/privacy.py`
- [Guardian consent](https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/consent_service.py): `backend/app/core/consent_service.py`
- [Redis sessions](https://github.com/rehan0018/edufeedia/blob/main/backend/app/core/redis_client.py): `backend/app/core/redis_client.py`

### Other components

- **Student**
- **Teacher**
- **Guardian**
- **AI providers**

## Connections

- Student → Learning app: uses
- Teacher → Teacher dashboard: reviews class
- Guardian → Learning app: uses
- Learning app → Authentication UI: renders (evidence: `frontend/src/App.jsx`)
- Learning app → Study interfaces: renders (evidence: `frontend/src/App.jsx`)
- Learning app → Tutor chat: renders (evidence: `frontend/src/App.jsx`)
- Learning app → Teacher dashboard: renders (evidence: `frontend/src/App.jsx`)
- Learning app → API client: fetches feed (evidence: `frontend/src/App.jsx`)
- Authentication UI → API client: authenticates (evidence: `frontend/src/components/AuthScreen.jsx`)
- Study interfaces → API client: loads study data (evidence: `frontend/src/services/api.js`)
- Tutor chat → API client: sends questions (evidence: `frontend/src/services/api.js`)
- Teacher dashboard → API client: loads analytics (evidence: `frontend/src/services/api.js`)
- API client → FastAPI gateway: calls API (evidence: `frontend/src/services/api.js`)
- FastAPI gateway → Authentication routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Learning routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Quiz and recall routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Tutor routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Ingestion routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Teacher routes: mounts routes (evidence: `backend/app/main.py`)
- FastAPI gateway → Privacy routes: mounts routes (evidence: `backend/app/main.py`)
- Ingestion routes → Content ingestion: invokes pipeline (evidence: `backend/app/routers/ingestion.py`)
- Content ingestion → Source verification: verifies source (evidence: `backend/app/ingestion/pipeline.py`)
- Content ingestion → Metadata extraction: extracts metadata (evidence: `backend/app/ingestion/pipeline.py`)
- Content ingestion → Safety engine: screens content (evidence: `backend/app/ingestion/pipeline.py`)
- Content ingestion → Content embeddings: creates embeddings (evidence: `backend/app/ingestion/pipeline.py`)
- Content ingestion → Application database: persists content (evidence: `backend/app/ingestion/pipeline.py`)
- Ingestion screening → Safety engine: audits content (evidence: `backend/app/safety/ingestion_pipeline.py`)
- Hybrid RAG → Content embeddings: embeds chunks (evidence: `backend/app/ai/rag_engine.py`)
- Hybrid RAG → Application database: retrieves chunks (evidence: `backend/app/ai/rag_engine.py`)
- Hybrid RAG → Model gateway: requests guidance (evidence: `backend/app/ai/rag_engine.py`)
- Hybrid RAG → Socratic policy: audits response (evidence: `backend/app/ai/rag_engine.py`)
- Model gateway → Safety engine: audits output (evidence: `backend/app/ai/llm_client.py`)
- Model gateway → AI providers: queries providers
- Tutor routes → Hybrid RAG: serves tutoring
- Quiz and recall routes → Mastery and SM-2: updates repetition
- Learning routes → Feed recommender: serves study feed
- Feed recommender → Application database: reads learning data (evidence: `backend/app/recommender/hybrid.py`)
- Feed recommender → Safety engine: checks candidates (evidence: `backend/app/recommender/hybrid.py`)
- Teacher routes → Application database: reads class data
- Privacy routes → Guardian consent: handles consent
- Authentication routes → Redis sessions: revokes sessions (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Application database: reads and writes users (evidence: `backend/app/routers/auth.py`)
- Mastery and SM-2 → Application database: persists mastery (evidence: `backend/app/core/mastery_engine.py`)
