# kyslap/raite architecture

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

- Interactive diagram: https://gitdiagram.com/kyslap/raite
- Repository: https://github.com/kyslap/raite

## Overview

Raite is a Flutter learning platform for students and teachers, backed by Supabase and Gemini. The student workflow includes scanning notes into study materials, practicing with generated flashcards and quizzes, and tracking study habits; teachers manage classes and materials and use learning analytics to guide instruction. The graph preserves the documented AI tutor, class hub, OCR, goals, and cohort insights. Most Flutter implementation files were not sampled, so feature paths identify existing directories and relationships rely on README statements; the document-processing function is directly evidenced in source.

Main entry points: [`supabase/functions/process_document/index.ts`](https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts) (Document processing), [`lib/main.dart`](https://github.com/kyslap/raite/blob/main/lib/main.dart) (Flutter app), [`lib/features/ai_tutor/data/knowledge_base_repository.dart`](https://github.com/kyslap/raite/blob/main/lib/features/ai_tutor/data/knowledge_base_repository.dart) (Knowledge base), [`lib/features/ai_tutor`](https://github.com/kyslap/raite/tree/main/lib/features/ai_tutor) (AI tutor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app_entry["Flutter app<br/>[main.dart]"]
  node_auth["Authentication"]
end

subgraph group_learning["Student learning"]
  node_ai_tutor["AI tutor"]
  node_ocr["Note scanner<br/>[ocr_service.dart]"]
  node_study_deck["Study decks"]
  node_daily_goals["Daily goals"]
  node_study_tracking["Study tracking"]
end

subgraph group_teaching["Teacher tools"]
  node_class_hub["Class hub"]
  node_teacher_tools["Teacher tools"]
  node_knowledge["Knowledge base"]
  node_hive_mind["Hive Mind"]
end

subgraph group_platform["AI and platform"]
  node_doc_processor["Document processing<br/>[index.ts]"]
  node_document_store[("Class materials<br/>[index.ts]")]
  node_vector_chunks[("Document chunks<br/>[index.ts]")]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_gemini["Gemini API"]
node_supabase[("Supabase")]

node_student -->|"uses"| node_app_entry
node_teacher -->|"uses"| node_app_entry
node_app_entry -.->|"offers access"| node_auth
node_teacher -->|"manages classes"| node_class_hub
node_teacher -->|"uses"| node_teacher_tools
node_teacher -->|"uploads materials"| node_knowledge
node_knowledge -->|"processes documents"| node_doc_processor
node_doc_processor -->|"downloads files"| node_document_store
node_doc_processor -->|"embeds text"| node_gemini
node_doc_processor -->|"inserts chunks"| node_vector_chunks
node_doc_processor -->|"reads and writes"| node_supabase
node_student -->|"asks questions"| node_ai_tutor
node_ai_tutor -->|"retrieves course material"| node_knowledge
node_student -->|"scans notes"| node_ocr
node_ocr -->|"generates study materials"| node_study_deck
node_student -->|"practices"| node_study_deck
node_student -->|"tracks focus"| node_daily_goals
node_student -->|"records activity"| node_study_tracking
node_teacher -->|"reviews insights"| node_hive_mind

click node_app_entry "https://github.com/kyslap/raite/blob/main/lib/main.dart"
click node_auth "https://github.com/kyslap/raite/tree/main/lib/features/auth"
click node_class_hub "https://github.com/kyslap/raite/tree/main/lib/features/class"
click node_teacher_tools "https://github.com/kyslap/raite/tree/main/lib/features/teacher"
click node_knowledge "https://github.com/kyslap/raite/blob/main/lib/features/ai_tutor/data/knowledge_base_repository.dart"
click node_doc_processor "https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts"
click node_document_store "https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts"
click node_vector_chunks "https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts"
click node_ai_tutor "https://github.com/kyslap/raite/tree/main/lib/features/ai_tutor"
click node_ocr "https://github.com/kyslap/raite/blob/main/lib/features/study_deck/data/ocr_service.dart"
click node_study_deck "https://github.com/kyslap/raite/tree/main/lib/features/study_deck"
click node_daily_goals "https://github.com/kyslap/raite/tree/main/lib/features/daily_goals"
click node_study_tracking "https://github.com/kyslap/raite/tree/main/lib/features/contributions"
click node_hive_mind "https://github.com/kyslap/raite/tree/main/lib/features/hive_mind"

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_app_entry,node_auth toneBlue
class node_ai_tutor,node_ocr,node_study_deck,node_daily_goals,node_study_tracking,node_supabase toneAmber
class node_class_hub,node_teacher_tools,node_knowledge,node_hive_mind,node_gemini toneMint
class node_doc_processor,node_document_store,node_vector_chunks toneRose
class node_student,node_teacher toneIndigo
```

## Components

### App and access

- [Flutter app](https://github.com/kyslap/raite/blob/main/lib/main.dart): `lib/main.dart`
- [Authentication](https://github.com/kyslap/raite/tree/main/lib/features/auth): `lib/features/auth`

### Student learning

- [AI tutor](https://github.com/kyslap/raite/tree/main/lib/features/ai_tutor): `lib/features/ai_tutor`
- [Note scanner](https://github.com/kyslap/raite/blob/main/lib/features/study_deck/data/ocr_service.dart): `lib/features/study_deck/data/ocr_service.dart`
- [Study decks](https://github.com/kyslap/raite/tree/main/lib/features/study_deck): `lib/features/study_deck`
- [Daily goals](https://github.com/kyslap/raite/tree/main/lib/features/daily_goals): `lib/features/daily_goals`
- [Study tracking](https://github.com/kyslap/raite/tree/main/lib/features/contributions): `lib/features/contributions`

### Teacher tools

- [Class hub](https://github.com/kyslap/raite/tree/main/lib/features/class): `lib/features/class`
- [Teacher tools](https://github.com/kyslap/raite/tree/main/lib/features/teacher): `lib/features/teacher`
- [Knowledge base](https://github.com/kyslap/raite/blob/main/lib/features/ai_tutor/data/knowledge_base_repository.dart): `lib/features/ai_tutor/data/knowledge_base_repository.dart`
- [Hive Mind](https://github.com/kyslap/raite/tree/main/lib/features/hive_mind): `lib/features/hive_mind`

### AI and platform

- [Document processing](https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts): `supabase/functions/process_document/index.ts`
- [Class materials](https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts): `supabase/functions/process_document/index.ts`
- [Document chunks](https://github.com/kyslap/raite/blob/main/supabase/functions/process_document/index.ts): `supabase/functions/process_document/index.ts`

### Other components

- **Student**
- **Teacher**
- **Gemini API**
- **Supabase**

## Connections

- Student → Flutter app: uses (evidence: `README.md`)
- Teacher → Flutter app: uses (evidence: `README.md`)
- Flutter app → Authentication: offers access
- Teacher → Class hub: manages classes (evidence: `README.md`)
- Teacher → Teacher tools: uses (evidence: `README.md`)
- Teacher → Knowledge base: uploads materials (evidence: `README.md`)
- Knowledge base → Document processing: processes documents (evidence: `README.md`)
- Document processing → Class materials: downloads files (evidence: `supabase/functions/process_document/index.ts`)
- Document processing → Gemini API: embeds text (evidence: `supabase/functions/process_document/index.ts`)
- Document processing → Document chunks: inserts chunks (evidence: `supabase/functions/process_document/index.ts`)
- Document processing → Supabase: reads and writes (evidence: `supabase/functions/process_document/index.ts`)
- Student → AI tutor: asks questions (evidence: `README.md`)
- AI tutor → Knowledge base: retrieves course material (evidence: `README.md`)
- Student → Note scanner: scans notes (evidence: `README.md`)
- Note scanner → Study decks: generates study materials (evidence: `README.md`)
- Student → Study decks: practices (evidence: `README.md`)
- Student → Daily goals: tracks focus (evidence: `README.md`)
- Student → Study tracking: records activity (evidence: `README.md`)
- Teacher → Hive Mind: reviews insights (evidence: `README.md`)
