# rudrasalokhe/trainify-bot architecture

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

- Interactive diagram: https://gitdiagram.com/rudrasalokhe/trainify-bot
- Repository: https://github.com/rudrasalokhe/trainify-bot

## Overview

Trainify.ai combines a signed-in language-training interface with an Express service for AI chat and document translation. Users enter through the React app, where they can manage conversations, choose language/model settings, upload files, and export chats. The backend separately exposes chat and translation endpoints, using Groq for generation and temporary disk storage plus PDF/text extraction for translation. The excerpts do not show the frontend’s request wiring to those endpoints, so that connection is omitted; the Vite proxy configuration alone does not establish it.

Main entry points: [`Frontend/src/App.tsx`](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx) (Training app), [`Backend/server.js`](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js) (Translation endpoint), [`Frontend/src/main.tsx`](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/main.tsx) (React bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Training interface"]
  node_entry["React bootstrap<br/>[main.tsx]"]
  node_app["Training app<br/>[App.tsx]"]
  node_conversations["Conversations<br/>[App.tsx]"]
  node_chat_interface["Chat interface<br/>[App.tsx]"]
  node_file_controls["File controls<br/>[App.tsx]"]
  node_chat_export["Chat export<br/>[App.tsx]"]
end

subgraph group_backend["AI service"]
  node_api["HTTP API<br/>[server.js]"]
  node_chat_handler["Chat endpoint<br/>[server.js]"]
  node_translation_handler["Translation endpoint<br/>[server.js]"]
  node_file_processing["Text extraction<br/>[server.js]"]
  node_uploads[("Temporary uploads<br/>[server.js]")]
end

subgraph group_external["External services"]
  node_clerk["Clerk identity"]
  node_groq["Groq inference"]
end

node_user(("Learner"))

node_user -->|"uses"| node_app
node_entry -->|"renders"| node_app
node_entry -->|"provides auth"| node_clerk
node_app -->|"reads auth"| node_clerk
node_app -->|"manages"| node_conversations
node_app -->|"renders"| node_chat_interface
node_app -->|"renders"| node_file_controls
node_app -->|"exports with"| node_chat_export
node_api -->|"routes chat"| node_chat_handler
node_api -->|"routes translation"| node_translation_handler
node_translation_handler -->|"extracts text"| node_file_processing
node_translation_handler -->|"cleans up"| node_uploads
node_file_processing -->|"reads file"| node_uploads
node_chat_handler -->|"requests completion"| node_groq
node_translation_handler -->|"requests translation"| node_groq

click node_entry "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/main.tsx"
click node_app "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx"
click node_conversations "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx"
click node_chat_interface "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx"
click node_file_controls "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx"
click node_chat_export "https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx"
click node_api "https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js"
click node_chat_handler "https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js"
click node_translation_handler "https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js"
click node_file_processing "https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js"
click node_uploads "https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js"

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_entry,node_app,node_conversations,node_chat_interface,node_file_controls,node_chat_export toneBlue
class node_api,node_chat_handler,node_translation_handler,node_file_processing,node_uploads toneAmber
class node_clerk,node_groq toneMint
class node_user toneIndigo
```

## Components

### Training interface

- [React bootstrap](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/main.tsx): `Frontend/src/main.tsx`
- [Training app](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Conversations](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Chat interface](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [File controls](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Chat export](https://github.com/rudrasalokhe/trainify-bot/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`

### AI service

- [HTTP API](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js): `Backend/server.js`
- [Chat endpoint](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js): `Backend/server.js`
- [Translation endpoint](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js): `Backend/server.js`
- [Text extraction](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js): `Backend/server.js`
- [Temporary uploads](https://github.com/rudrasalokhe/trainify-bot/blob/main/Backend/server.js): `Backend/server.js`

### External services

- **Clerk identity**
- **Groq inference**

### Other components

- **Learner**

## Connections

- Learner → Training app: uses (evidence: `Frontend/src/App.tsx`)
- React bootstrap → Training app: renders (evidence: `Frontend/src/main.tsx`)
- React bootstrap → Clerk identity: provides auth (evidence: `Frontend/src/main.tsx`)
- Training app → Clerk identity: reads auth (evidence: `Frontend/src/App.tsx`)
- Training app → Conversations: manages (evidence: `Frontend/src/App.tsx`)
- Training app → Chat interface: renders (evidence: `Frontend/src/App.tsx`)
- Training app → File controls: renders (evidence: `Frontend/src/App.tsx`)
- Training app → Chat export: exports with (evidence: `Frontend/src/App.tsx`)
- HTTP API → Chat endpoint: routes chat (evidence: `Backend/server.js`)
- HTTP API → Translation endpoint: routes translation (evidence: `Backend/server.js`)
- Translation endpoint → Text extraction: extracts text (evidence: `Backend/server.js`)
- Translation endpoint → Temporary uploads: cleans up (evidence: `Backend/server.js`)
- Text extraction → Temporary uploads: reads file (evidence: `Backend/server.js`)
- Chat endpoint → Groq inference: requests completion (evidence: `Backend/server.js`)
- Translation endpoint → Groq inference: requests translation (evidence: `Backend/server.js`)
