# souleyraquib71-web/bootcamp-chatbot-backend architecture

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

- Interactive diagram: https://gitdiagram.com/souleyraquib71-web/bootcamp-chatbot-backend
- Repository: https://github.com/souleyraquib71-web/bootcamp-chatbot-backend

## Overview

RodiumAI is a FastAPI backend for a conversational Python tutor. The main workflow accepts a chat turn, validates the selected model, builds provider-facing history, streams the tutor response, and saves the completed turn and any extras. The API also exposes conversation history, notes, and model choices. Most application behavior is concentrated in `main.py`; the excerpts do not expose every route or helper implementation, so the graph keeps those responsibilities grouped and notes relationships only where documented or shown.

Main entry points: [`main.py`](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py) (Chat turn handler), [`database/db.py`](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/db.py) (Session and engine), [`database/models.py`](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/models.py) (Conversation and message models), [`prompts/system.md`](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/prompts/system.md) (Tutor system prompt)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and conversations"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_conversation["Conversation history<br/>[main.py]"]
  node_notes["Personal notes<br/>[main.py]"]
  node_model_catalog["Model selection<br/>[main.py]"]
end

subgraph group_chat["Tutor generation"]
  node_turn["Chat turn handler<br/>[main.py]"]
  node_history["LLM history shaping<br/>[main.py]"]
  node_stream["Response streaming<br/>[main.py]"]
  node_extras["Quiz and summary<br/>[main.py]"]
  node_system_prompt["Tutor system prompt<br/>[system.md]"]
end

subgraph group_storage["Persistence"]
  node_db_access["Session and engine<br/>[db.py]"]
  node_entities["Conversation and message models<br/>[models.py]"]
  node_store[("SQLite or PostgreSQL")]
end

node_student(("Frontend user"))
node_llm{{"RodiumAI provider"}}

node_student -->|"sends requests"| node_api
node_api -->|"serves history"| node_conversation
node_api -->|"adds notes"| node_notes
node_api -->|"lists models"| node_model_catalog
node_api -->|"handles chat"| node_turn
node_turn -->|"validates model"| node_model_catalog
node_turn -->|"builds context"| node_history
node_turn -->|"streams reply"| node_stream
node_turn -->|"generates extras"| node_extras
node_turn -->|"loads prompt"| node_system_prompt
node_stream -->|"requests generation"| node_llm
node_extras -->|"requests extras"| node_llm
node_stream -->|"sends events"| node_student
node_conversation -->|"reads and writes"| node_db_access
node_notes -->|"writes notes"| node_db_access
node_turn -->|"saves completed turn"| node_db_access
node_db_access -->|"uses models"| node_entities
node_entities -->|"inherits base"| node_db_access
node_db_access -->|"connects to"| node_store

click node_api "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_conversation "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_notes "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_model_catalog "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_turn "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_history "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_stream "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_extras "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py"
click node_system_prompt "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/prompts/system.md"
click node_db_access "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/db.py"
click node_entities "https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/models.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_api,node_conversation,node_notes,node_model_catalog,node_student toneBlue
class node_turn,node_history,node_stream,node_extras,node_system_prompt toneAmber
class node_db_access,node_entities,node_store toneMint
class node_llm toneIndigo
```

## Components

### API and conversations

- [FastAPI endpoints](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Conversation history](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Personal notes](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Model selection](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`

### Tutor generation

- [Chat turn handler](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [LLM history shaping](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Response streaming](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Quiz and summary](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/main.py): `main.py`
- [Tutor system prompt](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/prompts/system.md): `prompts/system.md`

### Persistence

- [Session and engine](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/db.py): `database/db.py`
- [Conversation and message models](https://github.com/souleyraquib71-web/bootcamp-chatbot-backend/blob/main/database/models.py): `database/models.py`
- **SQLite or PostgreSQL**

### Other components

- **Frontend user**
- **RodiumAI provider**

## Connections

- Frontend user → FastAPI endpoints: sends requests (evidence: `README.md`)
- FastAPI endpoints → Conversation history: serves history (evidence: `main.py`)
- FastAPI endpoints → Personal notes: adds notes (evidence: `main.py`)
- FastAPI endpoints → Model selection: lists models (evidence: `main.py`)
- FastAPI endpoints → Chat turn handler: handles chat (evidence: `main.py`)
- Chat turn handler → Model selection: validates model (evidence: `main.py`)
- Chat turn handler → LLM history shaping: builds context (evidence: `main.py`)
- Chat turn handler → Response streaming: streams reply (evidence: `main.py`)
- Chat turn handler → Quiz and summary: generates extras (evidence: `main.py`)
- Chat turn handler → Tutor system prompt: loads prompt (evidence: `main.py`)
- Response streaming → RodiumAI provider: requests generation (evidence: `main.py`)
- Quiz and summary → RodiumAI provider: requests extras (evidence: `main.py`)
- Response streaming → Frontend user: sends events (evidence: `README.md`)
- Conversation history → Session and engine: reads and writes (evidence: `main.py`)
- Personal notes → Session and engine: writes notes (evidence: `main.py`)
- Chat turn handler → Session and engine: saves completed turn (evidence: `main.py`)
- Session and engine → Conversation and message models: uses models (evidence: `main.py`)
- Conversation and message models → Session and engine: inherits base (evidence: `database/models.py`)
- Session and engine → SQLite or PostgreSQL: connects to (evidence: `README.md`)
