# veerababu-spf/one-one-chat architecture

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

- Interactive diagram: https://gitdiagram.com/veerababu-spf/one-one-chat
- Repository: https://github.com/veerababu-spf/one-one-chat

## Overview

This is a small FastAPI chat backend. A user connects over WebSocket, submits a message, and the server persists it before forwarding it to a connected recipient; users can also request ordered conversation history over HTTP. The sampled server implements persistence and message delivery directly, while separate database/model modules define a MySQL-oriented setup that is not shown wired into the server. The README is empty, so unsampled capabilities and integrations cannot be established.

Main entry points: [`python-backend/main.py`](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py) (WebSocket messaging), [`python-backend/chat.db`](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/chat.db) (SQLite chat store), [`python-backend/database.py`](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/database.py) (MySQL setup), [`python-backend/models.py`](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/models.py) (Message model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Chat runtime"]
  node_server["FastAPI server<br/>[main.py]"]
  node_ws["WebSocket messaging<br/>[main.py]"]
  node_connections["Connection registry<br/>[main.py]"]
  node_history["Conversation history<br/>[main.py]"]
end

subgraph group_storage["Persistence"]
  node_sqlite[("SQLite chat store<br/>[chat.db]")]
  node_mysql_setup["MySQL setup<br/>[database.py]"]
  node_message_model["Message model<br/>[models.py]"]
end

subgraph group_contracts["Data contracts"]
  node_schemas["Message schemas<br/>[schemas.py]"]
end

node_user(("Chat user"))

node_user -->|"connects and sends"| node_ws
node_ws -->|"registers connection"| node_connections
node_ws -->|"writes message"| node_sqlite
node_ws -->|"looks up recipient"| node_connections
node_ws -->|"forwards message"| node_user
node_user -->|"requests history"| node_history
node_history -->|"queries messages"| node_sqlite
node_server -->|"creates tables"| node_sqlite
node_mysql_setup -->|"uses Base metadata"| node_message_model

click node_server "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py"
click node_ws "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py"
click node_connections "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py"
click node_history "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py"
click node_sqlite "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/chat.db"
click node_mysql_setup "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/database.py"
click node_message_model "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/models.py"
click node_schemas "https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/schemas.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_server,node_ws,node_connections,node_history,node_user toneBlue
class node_sqlite,node_mysql_setup,node_message_model toneAmber
class node_schemas toneMint
```

## Components

### Chat runtime

- [FastAPI server](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py): `python-backend/main.py`
- [WebSocket messaging](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py): `python-backend/main.py`
- [Connection registry](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py): `python-backend/main.py`
- [Conversation history](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/main.py): `python-backend/main.py`

### Persistence

- [SQLite chat store](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/chat.db): `python-backend/chat.db`
- [MySQL setup](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/database.py): `python-backend/database.py`
- [Message model](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/models.py): `python-backend/models.py`

### Data contracts

- [Message schemas](https://github.com/veerababu-spf/one-one-chat/blob/main/python-backend/schemas.py): `python-backend/schemas.py`

### Other components

- **Chat user**

## Connections

- Chat user → WebSocket messaging: connects and sends (evidence: `python-backend/main.py`)
- WebSocket messaging → Connection registry: registers connection (evidence: `python-backend/main.py`)
- WebSocket messaging → SQLite chat store: writes message (evidence: `python-backend/main.py`)
- WebSocket messaging → Connection registry: looks up recipient (evidence: `python-backend/main.py`)
- WebSocket messaging → Chat user: forwards message (evidence: `python-backend/main.py`)
- Chat user → Conversation history: requests history (evidence: `python-backend/main.py`)
- Conversation history → SQLite chat store: queries messages (evidence: `python-backend/main.py`)
- FastAPI server → SQLite chat store: creates tables (evidence: `python-backend/main.py`)
- MySQL setup → Message model: uses Base metadata (evidence: `python-backend/database.py`)
