# natybeau7/1-group architecture

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

- Interactive diagram: https://gitdiagram.com/natybeau7/1-group
- Repository: https://github.com/natybeau7/1-group

## Overview

UniVoice Campus lets Hawassa University students ask document-grounded questions by voice or text, while administrators manage the indexed PDF library. The admin path is browser UI → API → authenticated PDF indexing and storage; the student path is browser UI → assistant API → transcription when needed → retrieval and grounded answer → optional speech. The graph preserves those stages and the major speech, language, document-management, and storage capabilities described in the README. Source excerpts do not show every implementation detail, so uncertain wiring is omitted.

Main entry points: [`backend/routes/documents.py`](https://github.com/natybeau7/1-group/blob/main/backend/routes/documents.py) (Document management), [`backend/routes/assistant.py`](https://github.com/natybeau7/1-group/blob/main/backend/routes/assistant.py) (Assistant endpoints), [`frontend/src/student/VoiceAssistant.jsx`](https://github.com/natybeau7/1-group/blob/main/frontend/src/student/VoiceAssistant.jsx) (Voice assistant UI), [`backend/services/addis_ai.py`](https://github.com/natybeau7/1-group/blob/main/backend/services/addis_ai.py) (Speech and chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_admin_ui["Admin dashboard<br/>[AdminPage.jsx]"]
  node_student_ui["Voice assistant UI<br/>[VoiceAssistant.jsx]"]
  node_conversation["Conversation history<br/>[Conversation.jsx]"]
  node_web_api["API client<br/>[api.js]"]
  node_doc_types["Document types<br/>[documentTypes.js]"]
  node_app["Web app entry<br/>[main.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["FastAPI application<br/>[main.py]"]
  node_auth["Admin authentication<br/>[admin.py]"]
  node_documents["Document management<br/>[documents.py]"]
  node_assistant["Assistant endpoints<br/>[assistant.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

subgraph group_rag["Document intelligence"]
  node_extract["PDF extraction<br/>[extract.py]"]
  node_chunk["Passage chunking<br/>[chunk.py]"]
  node_embeddings["Text embeddings<br/>[embeddings.py]"]
  node_retrieval["Vector retrieval<br/>[retrieval.py]"]
end

subgraph group_integrations["External services"]
  node_addis_client["Speech and chat<br/>[addis_ai.py]"]
  node_supabase_client["Supabase adapter<br/>[supabase.py]"]
  node_supabase_store[("Postgres and storage")]
  node_gemini["Google Gemini"]
  node_addis["Addis AI"]
  node_edge_tts["Edge neural TTS"]
end

node_admin_user(("Administrator"))
node_student(("Student"))

node_admin_user -->|"manages library"| node_admin_ui
node_student -->|"asks questions"| node_student_ui
node_app -->|"mounts"| node_admin_ui
node_app -->|"mounts"| node_student_ui
node_admin_ui -->|"requests admin actions"| node_web_api
node_student_ui -->|"requests answers"| node_web_api
node_student_ui -->|"renders history"| node_conversation
node_admin_ui -->|"uses categories"| node_doc_types
node_student_ui -->|"uses categories"| node_doc_types
node_web_api -->|"calls endpoints"| node_server
node_server -->|"mounts routes"| node_auth
node_server -->|"mounts routes"| node_documents
node_server -->|"mounts routes"| node_assistant
node_documents -->|"requires admin"| node_auth
node_documents -->|"extracts pages"| node_extract
node_documents -->|"chunks text"| node_chunk
node_documents -->|"embeds passages"| node_embeddings
node_documents -->|"stores documents"| node_supabase_client
node_assistant -->|"retrieves context"| node_retrieval
node_assistant -->|"transcribes and speaks"| node_addis_client
node_assistant -->|"generates answers"| node_addis_client
node_assistant -->|"lists indexed files"| node_supabase_client
node_retrieval -->|"embeds query"| node_embeddings
node_retrieval -->|"searches chunks"| node_supabase_client
node_supabase_client -->|"reads and writes"| node_supabase_store
node_embeddings -->|"requests vectors"| node_gemini
node_addis_client -->|"uses speech and chat"| node_addis
node_addis_client -.->|"fallback chat"| node_gemini
node_addis_client -->|"synthesizes speech"| node_edge_tts

click node_admin_ui "https://github.com/natybeau7/1-group/blob/main/frontend/src/admin/AdminPage.jsx"
click node_student_ui "https://github.com/natybeau7/1-group/blob/main/frontend/src/student/VoiceAssistant.jsx"
click node_conversation "https://github.com/natybeau7/1-group/blob/main/frontend/src/student/Conversation.jsx"
click node_web_api "https://github.com/natybeau7/1-group/blob/main/frontend/src/api.js"
click node_doc_types "https://github.com/natybeau7/1-group/blob/main/frontend/src/documentTypes.js"
click node_app "https://github.com/natybeau7/1-group/blob/main/frontend/src/main.jsx"
click node_server "https://github.com/natybeau7/1-group/blob/main/backend/main.py"
click node_auth "https://github.com/natybeau7/1-group/blob/main/backend/routes/admin.py"
click node_documents "https://github.com/natybeau7/1-group/blob/main/backend/routes/documents.py"
click node_assistant "https://github.com/natybeau7/1-group/blob/main/backend/routes/assistant.py"
click node_settings "https://github.com/natybeau7/1-group/blob/main/backend/config.py"
click node_extract "https://github.com/natybeau7/1-group/blob/main/backend/rag/extract.py"
click node_chunk "https://github.com/natybeau7/1-group/blob/main/backend/rag/chunk.py"
click node_embeddings "https://github.com/natybeau7/1-group/blob/main/backend/rag/embeddings.py"
click node_retrieval "https://github.com/natybeau7/1-group/blob/main/backend/rag/retrieval.py"
click node_addis_client "https://github.com/natybeau7/1-group/blob/main/backend/services/addis_ai.py"
click node_supabase_client "https://github.com/natybeau7/1-group/blob/main/backend/services/supabase.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_admin_ui,node_student_ui,node_conversation,node_web_api,node_doc_types,node_app toneBlue
class node_server,node_auth,node_documents,node_assistant,node_settings toneAmber
class node_extract,node_chunk,node_embeddings,node_retrieval toneMint
class node_addis_client,node_supabase_client,node_supabase_store,node_gemini,node_addis,node_edge_tts toneRose
class node_admin_user,node_student toneIndigo
```

## Components

### Web experience

- [Admin dashboard](https://github.com/natybeau7/1-group/blob/main/frontend/src/admin/AdminPage.jsx): `frontend/src/admin/AdminPage.jsx`
- [Voice assistant UI](https://github.com/natybeau7/1-group/blob/main/frontend/src/student/VoiceAssistant.jsx): `frontend/src/student/VoiceAssistant.jsx`
- [Conversation history](https://github.com/natybeau7/1-group/blob/main/frontend/src/student/Conversation.jsx): `frontend/src/student/Conversation.jsx`
- [API client](https://github.com/natybeau7/1-group/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Document types](https://github.com/natybeau7/1-group/blob/main/frontend/src/documentTypes.js): `frontend/src/documentTypes.js`
- [Web app entry](https://github.com/natybeau7/1-group/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### Backend API

- [FastAPI application](https://github.com/natybeau7/1-group/blob/main/backend/main.py): `backend/main.py`
- [Admin authentication](https://github.com/natybeau7/1-group/blob/main/backend/routes/admin.py): `backend/routes/admin.py`
- [Document management](https://github.com/natybeau7/1-group/blob/main/backend/routes/documents.py): `backend/routes/documents.py`
- [Assistant endpoints](https://github.com/natybeau7/1-group/blob/main/backend/routes/assistant.py): `backend/routes/assistant.py`
- [Runtime settings](https://github.com/natybeau7/1-group/blob/main/backend/config.py): `backend/config.py`

### Document intelligence

- [PDF extraction](https://github.com/natybeau7/1-group/blob/main/backend/rag/extract.py): `backend/rag/extract.py`
- [Passage chunking](https://github.com/natybeau7/1-group/blob/main/backend/rag/chunk.py): `backend/rag/chunk.py`
- [Text embeddings](https://github.com/natybeau7/1-group/blob/main/backend/rag/embeddings.py): `backend/rag/embeddings.py`
- [Vector retrieval](https://github.com/natybeau7/1-group/blob/main/backend/rag/retrieval.py): `backend/rag/retrieval.py`

### External services

- [Speech and chat](https://github.com/natybeau7/1-group/blob/main/backend/services/addis_ai.py): `backend/services/addis_ai.py`
- [Supabase adapter](https://github.com/natybeau7/1-group/blob/main/backend/services/supabase.py): `backend/services/supabase.py`
- **Postgres and storage**
- **Google Gemini**
- **Addis AI**
- **Edge neural TTS**

### Other components

- **Administrator**
- **Student**

## Connections

- Administrator → Admin dashboard: manages library (evidence: `README.md`)
- Student → Voice assistant UI: asks questions (evidence: `README.md`)
- Web app entry → Admin dashboard: mounts (evidence: `frontend/src/main.jsx`)
- Web app entry → Voice assistant UI: mounts (evidence: `frontend/src/main.jsx`)
- Admin dashboard → API client: requests admin actions (evidence: `frontend/src/admin/AdminPage.jsx`)
- Voice assistant UI → API client: requests answers (evidence: `frontend/src/student/VoiceAssistant.jsx`)
- Voice assistant UI → Conversation history: renders history (evidence: `frontend/src/student/VoiceAssistant.jsx`)
- Admin dashboard → Document types: uses categories (evidence: `frontend/src/admin/AdminPage.jsx`)
- Voice assistant UI → Document types: uses categories (evidence: `frontend/src/student/VoiceAssistant.jsx`)
- API client → FastAPI application: calls endpoints (evidence: `frontend/src/api.js`)
- FastAPI application → Admin authentication: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Document management: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Assistant endpoints: mounts routes (evidence: `backend/main.py`)
- Document management → Admin authentication: requires admin (evidence: `backend/routes/documents.py`)
- Document management → PDF extraction: extracts pages (evidence: `backend/routes/documents.py`)
- Document management → Passage chunking: chunks text (evidence: `backend/routes/documents.py`)
- Document management → Text embeddings: embeds passages (evidence: `backend/routes/documents.py`)
- Document management → Supabase adapter: stores documents (evidence: `backend/routes/documents.py`)
- Assistant endpoints → Vector retrieval: retrieves context (evidence: `backend/routes/assistant.py`)
- Assistant endpoints → Speech and chat: transcribes and speaks (evidence: `backend/routes/assistant.py`)
- Assistant endpoints → Speech and chat: generates answers (evidence: `backend/routes/assistant.py`)
- Assistant endpoints → Supabase adapter: lists indexed files (evidence: `backend/routes/assistant.py`)
- Vector retrieval → Text embeddings: embeds query (evidence: `backend/rag/retrieval.py`)
- Vector retrieval → Supabase adapter: searches chunks (evidence: `backend/rag/retrieval.py`)
- Supabase adapter → Postgres and storage: reads and writes (evidence: `README.md`)
- Text embeddings → Google Gemini: requests vectors (evidence: `backend/rag/embeddings.py`)
- Speech and chat → Addis AI: uses speech and chat (evidence: `README.md`)
- Speech and chat → Google Gemini: fallback chat (evidence: `README.md`)
- Speech and chat → Edge neural TTS: synthesizes speech (evidence: `README.md`)
