# csulb-ai-club-projects/material-enhancement-assistant3 architecture

> Architecture diagram of the GitHub repository csulb-ai-club-projects/material-enhancement-assistant3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/csulb-ai-club-projects/material-enhancement-assistant3
- Repository: https://github.com/csulb-ai-club-projects/material-enhancement-assistant3

## Overview

Material Enhancement Assistant lets instructors upload course files, organize them in projects, inspect previews, and use AI-assisted chat and generated learning materials while retaining approval control. The main flow crosses the Next.js project and upload interfaces into FastAPI endpoints, which delegate persistence and document workflows to backend services; Gemini supports generation and retrieval. The README also documents quizzes and export of approved revisions. The sampled excerpts establish only some service calls, so unsampled UI and backend links are included only where the README documents the capability; other uncertain connections are omitted.

Main entry points: [`backend/app/services/data_service.py`](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/data_service.py) (Domain data workflows), [`backend/app/api/projects.py`](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/projects.py) (Project and chat API), [`frontend/src/components/material-enhancement/PreviewWorkspace.tsx`](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/PreviewWorkspace.tsx) (Preview and chat), [`frontend/src/components/material-enhancement/MaterialEnhancementWorkspace.tsx`](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/MaterialEnhancementWorkspace.tsx) (Project workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Instructor interface"]
  node_project_ui["Project workspace"]
  node_upload_ui["Course upload"]
  node_preview_ui["Preview and chat"]
  node_dashboard["Project dashboard"]
end

subgraph group_api["Backend API"]
  node_project_api["Project and chat API<br/>[projects.py]"]
  node_upload_api["Upload API<br/>[upload.py]"]
  node_quiz_api["Quiz API<br/>[quiz.py]"]
  node_account_api["Account API<br/>[account.py]"]
end

subgraph group_services["Processing services"]
  node_data["Domain data workflows<br/>[data_service.py]"]
  node_parser["Document extraction<br/>[parser_service.py]"]
  node_preview["Source previews<br/>[preview_service.py]"]
  node_export["Material export<br/>[export_service.py]"]
  node_auth["Authentication<br/>[auth_service.py]"]
end

subgraph group_state["Persistence and models"]
  node_database[("Postgres database<br/>[db.py]")]
  node_storage[("Object storage<br/>[storage_service.py]")]
  node_models["Domain records"]
end

subgraph group_ai["AI capabilities"]
  node_llm["Gemini generation<br/>[llm_service.py]"]
  node_embedding["Text embeddings"]
end

node_instructor(("Instructor"))
node_gemini{{"Google Gemini"}}
node_object_service[("S3-compatible storage")]

node_instructor -->|"uses"| node_project_ui
node_instructor -->|"uploads files"| node_upload_ui
node_instructor -->|"reviews materials"| node_preview_ui
node_project_ui -.->|"manages projects"| node_project_api
node_upload_ui -.->|"submits files"| node_upload_api
node_preview_ui -->|"asks questions"| node_project_api
node_preview_ui -->|"clears history"| node_project_api
node_dashboard -.->|"loads projects"| node_project_api
node_project_api -->|"delegates operations"| node_data
node_upload_api -.->|"delegates uploads"| node_data
node_quiz_api -->|"delegates quiz work"| node_data
node_account_api -.->|"handles accounts"| node_auth
node_data -->|"reads and writes"| node_database
node_data -->|"stores files"| node_storage
node_data -->|"extracts text"| node_parser
node_data -->|"renders previews"| node_preview
node_data -->|"indexes text"| node_embedding
node_data -->|"requests AI work"| node_llm
node_data -->|"builds records"| node_models
node_project_api -->|"exports materials"| node_export
node_auth -->|"uses transactions"| node_database
node_llm -->|"generates content"| node_gemini
node_embedding -->|"embeds chunks"| node_gemini
node_storage -->|"reads and writes objects"| node_object_service
node_instructor -.->|"approves revisions"| node_export

click node_project_ui "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/MaterialEnhancementWorkspace.tsx"
click node_upload_ui "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/course-content-upload/CourseContentUploadClient.tsx"
click node_preview_ui "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/PreviewWorkspace.tsx"
click node_dashboard "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/dashboard/DashboardClientPage.tsx"
click node_project_api "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/projects.py"
click node_upload_api "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/upload.py"
click node_quiz_api "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/quiz.py"
click node_account_api "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/account.py"
click node_data "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/data_service.py"
click node_parser "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/parser_service.py"
click node_preview "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/preview_service.py"
click node_export "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/export_service.py"
click node_auth "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/auth_service.py"
click node_database "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/db.py"
click node_storage "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/storage_service.py"
click node_models "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/tree/main/backend/app/models"
click node_llm "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/llm_service.py"
click node_embedding "https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/embedding_service.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_project_ui,node_upload_ui,node_preview_ui,node_dashboard toneBlue
class node_project_api,node_upload_api,node_quiz_api,node_account_api,node_object_service toneAmber
class node_data,node_parser,node_preview,node_export,node_auth toneMint
class node_database,node_storage,node_models toneRose
class node_llm,node_embedding,node_instructor,node_gemini toneIndigo
```

## Components

### Instructor interface

- [Project workspace](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/MaterialEnhancementWorkspace.tsx): `frontend/src/components/material-enhancement/MaterialEnhancementWorkspace.tsx`
- [Course upload](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/course-content-upload/CourseContentUploadClient.tsx): `frontend/src/components/course-content-upload/CourseContentUploadClient.tsx`
- [Preview and chat](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/material-enhancement/PreviewWorkspace.tsx): `frontend/src/components/material-enhancement/PreviewWorkspace.tsx`
- [Project dashboard](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/frontend/src/components/dashboard/DashboardClientPage.tsx): `frontend/src/components/dashboard/DashboardClientPage.tsx`

### Backend API

- [Project and chat API](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/projects.py): `backend/app/api/projects.py`
- [Upload API](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/upload.py): `backend/app/api/upload.py`
- [Quiz API](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/quiz.py): `backend/app/api/quiz.py`
- [Account API](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/api/account.py): `backend/app/api/account.py`

### Processing services

- [Domain data workflows](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/data_service.py): `backend/app/services/data_service.py`
- [Document extraction](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/parser_service.py): `backend/app/services/parser_service.py`
- [Source previews](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/preview_service.py): `backend/app/services/preview_service.py`
- [Material export](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/export_service.py): `backend/app/services/export_service.py`
- [Authentication](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`

### Persistence and models

- [Postgres database](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/db.py): `backend/app/services/db.py`
- [Object storage](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`
- [Domain records](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/tree/main/backend/app/models): `backend/app/models`

### AI capabilities

- [Gemini generation](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`
- [Text embeddings](https://github.com/csulb-ai-club-projects/material-enhancement-assistant3/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`

### Other components

- **Instructor**
- **Google Gemini**
- **S3-compatible storage**

## Connections

- Instructor → Project workspace: uses (evidence: `README.md`)
- Instructor → Course upload: uploads files (evidence: `README.md`)
- Instructor → Preview and chat: reviews materials (evidence: `README.md`)
- Project workspace → Project and chat API: manages projects
- Course upload → Upload API: submits files
- Preview and chat → Project and chat API: asks questions (evidence: `frontend/src/components/material-enhancement/PreviewWorkspace.tsx`)
- Preview and chat → Project and chat API: clears history (evidence: `frontend/src/components/material-enhancement/PreviewWorkspace.tsx`)
- Project dashboard → Project and chat API: loads projects
- Project and chat API → Domain data workflows: delegates operations (evidence: `backend/app/api/projects.py`)
- Upload API → Domain data workflows: delegates uploads (evidence: `backend/app/api/upload.py`)
- Quiz API → Domain data workflows: delegates quiz work (evidence: `backend/app/api/quiz.py`)
- Account API → Authentication: handles accounts
- Domain data workflows → Postgres database: reads and writes (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Object storage: stores files (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Document extraction: extracts text (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Source previews: renders previews (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Text embeddings: indexes text (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Gemini generation: requests AI work (evidence: `backend/app/services/data_service.py`)
- Domain data workflows → Domain records: builds records (evidence: `backend/app/services/data_service.py`)
- Project and chat API → Material export: exports materials (evidence: `backend/app/api/projects.py`)
- Authentication → Postgres database: uses transactions (evidence: `backend/app/services/auth_service.py`)
- Gemini generation → Google Gemini: generates content (evidence: `backend/app/services/llm_service.py`)
- Text embeddings → Google Gemini: embeds chunks (evidence: `backend/app/services/embedding_service.py`)
- Object storage → S3-compatible storage: reads and writes objects (evidence: `backend/app/services/storage_service.py`)
- Instructor → Material export: approves revisions (evidence: `README.md`)
