# abroranvarov01/tomu_backend architecture

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

- Interactive diagram: https://gitdiagram.com/abroranvarov01/tomu_backend
- Repository: https://github.com/abroranvarov01/tomu_backend

## Overview

This is a NestJS learning-management backend with language-learning content, cohorts and lectures, learner progress and assessment, billing-related records, notifications, and an AI voice tutor. The main learner workflow is account access, course/content use, assessment and progress tracking; the AI voice endpoint is a distinct interaction path through an orchestrated voice pipeline. The README is generic Nest starter text and does not document product behavior. Relationships below are limited to calls visible in sampled controllers and services or explicit pipeline dependencies; broader modules are included as product capabilities evident from the tree, without guessing their wiring.

Main entry points: [`src/modules/ai/services/voice-processing-pipeline.service.ts`](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/voice-processing-pipeline.service.ts) (Voice pipeline), [`src/modules/auth/auth.service.ts`](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.service.ts) (Authentication service), [`src/modules/auth/auth.controller.ts`](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.controller.ts) (Authentication API), [`src/modules/user/user.controller.ts`](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/user/user.controller.ts) (User API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth_api["Authentication API<br/>[auth.controller.ts]"]
  node_auth_service["Authentication service<br/>[auth.service.ts]"]
  node_user_service["User service<br/>[user.service.ts]"]
  node_user_api["User API<br/>[user.controller.ts]"]
end

subgraph group_learning["Learning content"]
  node_course_api["Course API"]
  node_course_service["Course service<br/>[course.service.ts]"]
  node_lesson["Lesson content"]
  node_alphabet["Alphabet content"]
  node_grammar["Grammar content"]
  node_quiz_api["Quiz API<br/>[quiz.controller.ts]"]
  node_quiz_service["Quiz and attempts<br/>[quiz.service.ts]"]
end

subgraph group_classroom["Classroom and progress"]
  node_group["Groups and lectures"]
  node_lecture_api["Lecture API"]
  node_homework["Homework assignments"]
  node_homework_progress_api["Homework progress API"]
  node_lesson_progress["Lesson progress"]
end

subgraph group_ai["AI tutoring"]
  node_ai_api["AI chat API"]
  node_ai_chat["AI chat service<br/>[ai-chat.service.ts]"]
  node_voice_pipeline["Voice pipeline"]
  node_whisper["Speech recognition<br/>[whisper.service.ts]"]
  node_gpt["GPT responses<br/>[gpt.service.ts]"]
  node_tts["Speech synthesis<br/>[tts.service.ts]"]
  node_chroma["Chroma integration"]
end

subgraph group_operations["Commerce and services"]
  node_commerce["Orders and payments"]
  node_subscriptions["Tariffs and subscriptions"]
  node_notifications["Push notifications"]
  node_telegram["Telegram bot"]
end

node_learner(("Learner or staff"))
node_openai["OpenAI API"]
node_firebase["Firebase messaging"]

node_learner -->|"submits credentials"| node_auth_api
node_auth_api -->|"delegates"| node_auth_service
node_auth_service -->|"looks up user"| node_user_service
node_learner -->|"manages profile"| node_user_api
node_user_api -->|"delegates"| node_user_service
node_learner -->|"browses courses"| node_course_api
node_course_api -->|"delegates"| node_course_service
node_auth_service -->|"checks course"| node_course_service
node_learner -->|"takes assessment"| node_quiz_api
node_quiz_api -->|"submits quiz"| node_quiz_service
node_learner -->|"views lectures"| node_lecture_api
node_learner -->|"checks homework"| node_homework_progress_api
node_learner -->|"sends voice"| node_ai_api
node_ai_api -->|"delegates chat"| node_ai_chat
node_ai_chat -->|"runs pipeline"| node_voice_pipeline
node_voice_pipeline -->|"transcribes audio"| node_whisper
node_voice_pipeline -->|"generates reply"| node_gpt
node_voice_pipeline -->|"synthesizes speech"| node_tts
node_voice_pipeline -->|"uses retrieval"| node_chroma
node_chroma -.->|"requests embeddings"| node_openai
node_learner -->|"registers token"| node_notifications
node_notifications -.->|"sends push"| node_firebase

click node_auth_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.controller.ts"
click node_auth_service "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.service.ts"
click node_user_service "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/user/user.service.ts"
click node_user_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/user/user.controller.ts"
click node_course_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/course/course.controller.ts"
click node_course_service "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/course/course.service.ts"
click node_lesson "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/lesson"
click node_alphabet "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/alphabet"
click node_grammar "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/grammar"
click node_quiz_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/quiz/quiz.controller.ts"
click node_quiz_service "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/quiz/quiz.service.ts"
click node_group "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/group"
click node_lecture_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/lecture/lecture.controller.ts"
click node_homework "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/homework"
click node_homework_progress_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/homework-progress/homework-progress.controller.ts"
click node_lesson_progress "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/lesson-progress"
click node_ai_api "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/controllers/ai-chat.controller.ts"
click node_ai_chat "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/ai-chat.service.ts"
click node_voice_pipeline "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/voice-processing-pipeline.service.ts"
click node_whisper "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/whisper.service.ts"
click node_gpt "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/gpt.service.ts"
click node_tts "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/tts.service.ts"
click node_chroma "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/chroma-embedding.service.ts"
click node_commerce "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/orders"
click node_subscriptions "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/user-tariff"
click node_notifications "https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/notification/notification.controller.ts"
click node_telegram "https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/telegram-bot"

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_auth_api,node_auth_service,node_user_service,node_user_api toneBlue
class node_course_api,node_course_service,node_lesson,node_alphabet,node_grammar,node_quiz_api,node_quiz_service toneAmber
class node_group,node_lecture_api,node_homework,node_homework_progress_api,node_lesson_progress,node_openai toneMint
class node_ai_api,node_ai_chat,node_voice_pipeline,node_whisper,node_gpt,node_tts,node_chroma toneRose
class node_commerce,node_subscriptions,node_notifications,node_telegram,node_learner,node_firebase toneIndigo
```

## Components

### Identity and access

- [Authentication API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.controller.ts): `src/modules/auth/auth.controller.ts`
- [Authentication service](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/auth/auth.service.ts): `src/modules/auth/auth.service.ts`
- [User service](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/user/user.service.ts): `src/modules/user/user.service.ts`
- [User API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/user/user.controller.ts): `src/modules/user/user.controller.ts`

### Learning content

- [Course API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/course/course.controller.ts): `src/modules/course/course.controller.ts`
- [Course service](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/course/course.service.ts): `src/modules/course/course.service.ts`
- [Lesson content](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/lesson): `src/modules/lesson`
- [Alphabet content](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/alphabet): `src/modules/alphabet`
- [Grammar content](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/grammar): `src/modules/grammar`
- [Quiz API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/quiz/quiz.controller.ts): `src/modules/quiz/quiz.controller.ts`
- [Quiz and attempts](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/quiz/quiz.service.ts): `src/modules/quiz/quiz.service.ts`

### Classroom and progress

- [Groups and lectures](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/group): `src/modules/group`
- [Lecture API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/lecture/lecture.controller.ts): `src/modules/lecture/lecture.controller.ts`
- [Homework assignments](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/homework): `src/modules/homework`
- [Homework progress API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/homework-progress/homework-progress.controller.ts): `src/modules/homework-progress/homework-progress.controller.ts`
- [Lesson progress](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/lesson-progress): `src/modules/lesson-progress`

### AI tutoring

- [AI chat API](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/controllers/ai-chat.controller.ts): `src/modules/ai/controllers/ai-chat.controller.ts`
- [AI chat service](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/ai-chat.service.ts): `src/modules/ai/services/ai-chat.service.ts`
- [Voice pipeline](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/voice-processing-pipeline.service.ts): `src/modules/ai/services/voice-processing-pipeline.service.ts`
- [Speech recognition](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/whisper.service.ts): `src/modules/ai/services/whisper.service.ts`
- [GPT responses](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/gpt.service.ts): `src/modules/ai/services/gpt.service.ts`
- [Speech synthesis](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/tts.service.ts): `src/modules/ai/services/tts.service.ts`
- [Chroma integration](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/ai/services/chroma-embedding.service.ts): `src/modules/ai/services/chroma-embedding.service.ts`

### Commerce and services

- [Orders and payments](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/orders): `src/modules/orders`
- [Tariffs and subscriptions](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/user-tariff): `src/modules/user-tariff`
- [Push notifications](https://github.com/abroranvarov01/tomu_backend/blob/master/src/modules/notification/notification.controller.ts): `src/modules/notification/notification.controller.ts`
- [Telegram bot](https://github.com/abroranvarov01/tomu_backend/tree/master/src/modules/telegram-bot): `src/modules/telegram-bot`

### Other components

- **Learner or staff**
- **OpenAI API**
- **Firebase messaging**

## Connections

- Learner or staff → Authentication API: submits credentials
- Authentication API → Authentication service: delegates
- Authentication service → User service: looks up user
- Learner or staff → User API: manages profile
- User API → User service: delegates
- Learner or staff → Course API: browses courses
- Course API → Course service: delegates
- Authentication service → Course service: checks course
- Learner or staff → Quiz API: takes assessment
- Quiz API → Quiz and attempts: submits quiz
- Learner or staff → Lecture API: views lectures
- Learner or staff → Homework progress API: checks homework
- Learner or staff → AI chat API: sends voice
- AI chat API → AI chat service: delegates chat
- AI chat service → Voice pipeline: runs pipeline
- Voice pipeline → Speech recognition: transcribes audio
- Voice pipeline → GPT responses: generates reply
- Voice pipeline → Speech synthesis: synthesizes speech
- Voice pipeline → Chroma integration: uses retrieval
- Chroma integration → OpenAI API: requests embeddings
- Learner or staff → Push notifications: registers token
- Push notifications → Firebase messaging: sends push
