# saigayathrigudla-1184/fluency-net architecture

> Architecture diagram of the GitHub repository saigayathrigudla-1184/fluency-net, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saigayathrigudla-1184/fluency-net
- Repository: https://github.com/saigayathrigudla-1184/fluency-net

## Overview

Fluency-Net is a speech-therapy web application. The user records or streams speech through the browser; the backend transcribes it, combines text with acoustic cues, and uses an adaptive AI agent to produce clinical analysis and fluent speech output. The README documents multilingual transcription, SOAP notes, session persistence, and Kokoro/Edge TTS. The backend is concentrated in main.py; the excerpts show selected integrations and prompt handling, not every internal call or route.

Main entry points: [`main.py`](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py) (FastAPI Backend), [`index.html`](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/index.html) (Browser UI), [`data/sessions.db`](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/data/sessions.db) (Session Storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_web_ui["Browser UI<br/>[index.html]"]
  node_api["FastAPI Backend<br/>[main.py]"]
end

subgraph group_speech["Speech Processing"]
  node_transcription["Speech Transcription<br/>[main.py]"]
  node_acoustics["Acoustic Analysis<br/>[main.py]"]
  node_language["Language Handling<br/>[main.py]"]
end

subgraph group_therapy["Therapy Intelligence"]
  node_agent_state["Agent State<br/>[main.py]"]
  node_strategy["Therapy Strategy<br/>[main.py]"]
  node_analysis["Clinical Analysis<br/>[main.py]"]
end

subgraph group_delivery["Persistence &amp; Output"]
  node_regeneration["Fluent Regeneration<br/>[main.py]"]
  node_tts["TTS Router<br/>[main.py]"]
  node_sessions[("Session Storage<br/>[sessions.db]")]
end

node_user(("User"))
node_ollama["Ollama LLM"]
node_deepgram["Deepgram Fallback"]
node_kokoro["Kokoro TTS"]
node_edge_tts["Edge TTS"]

node_user -->|"records speech"| node_web_ui
node_web_ui -->|"streams audio"| node_api
node_api -->|"transcribes audio"| node_transcription
node_api -->|"extracts cues"| node_acoustics
node_api -->|"handles languages"| node_language
node_transcription -.->|"fallback transcription"| node_deepgram
node_api -->|"updates state"| node_agent_state
node_api -->|"selects tactic"| node_strategy
node_api -->|"requests analysis"| node_analysis
node_analysis -->|"infers analysis"| node_ollama
node_api -->|"reconstructs speech"| node_regeneration
node_regeneration -->|"routes synthesis"| node_tts
node_tts -->|"synthesizes English"| node_kokoro
node_tts -->|"synthesizes multilingual"| node_edge_tts
node_api -->|"persists progress"| node_sessions
node_api -->|"returns results"| node_web_ui

click node_web_ui "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/index.html"
click node_api "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_transcription "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_acoustics "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_language "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_agent_state "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_strategy "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_analysis "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_regeneration "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_tts "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py"
click node_sessions "https://github.com/saigayathrigudla-1184/fluency-net/blob/main/data/sessions.db"

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_web_ui,node_api,node_user toneBlue
class node_transcription,node_acoustics,node_language toneAmber
class node_agent_state,node_strategy,node_analysis toneMint
class node_regeneration,node_tts,node_sessions toneRose
class node_ollama,node_deepgram,node_kokoro,node_edge_tts toneIndigo
```

## Components

### User Interaction

- [Browser UI](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/index.html): `index.html`
- [FastAPI Backend](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`

### Speech Processing

- [Speech Transcription](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [Acoustic Analysis](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [Language Handling](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`

### Therapy Intelligence

- [Agent State](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [Therapy Strategy](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [Clinical Analysis](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`

### Persistence & Output

- [Fluent Regeneration](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [TTS Router](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/main.py): `main.py`
- [Session Storage](https://github.com/saigayathrigudla-1184/fluency-net/blob/main/data/sessions.db): `data/sessions.db`

### Other components

- **User**
- **Ollama LLM**
- **Deepgram Fallback**
- **Kokoro TTS**
- **Edge TTS**

## Connections

- User → Browser UI: records speech (evidence: `README.md`)
- Browser UI → FastAPI Backend: streams audio (evidence: `README.md`)
- FastAPI Backend → Speech Transcription: transcribes audio (evidence: `README.md`)
- FastAPI Backend → Acoustic Analysis: extracts cues (evidence: `README.md`)
- FastAPI Backend → Language Handling: handles languages (evidence: `README.md`)
- Speech Transcription → Deepgram Fallback: fallback transcription (evidence: `main.py`)
- FastAPI Backend → Agent State: updates state (evidence: `main.py`)
- FastAPI Backend → Therapy Strategy: selects tactic (evidence: `README.md`)
- FastAPI Backend → Clinical Analysis: requests analysis (evidence: `main.py`)
- Clinical Analysis → Ollama LLM: infers analysis (evidence: `main.py`)
- FastAPI Backend → Fluent Regeneration: reconstructs speech (evidence: `README.md`)
- Fluent Regeneration → TTS Router: routes synthesis (evidence: `main.py`)
- TTS Router → Kokoro TTS: synthesizes English (evidence: `README.md`)
- TTS Router → Edge TTS: synthesizes multilingual (evidence: `README.md`)
- FastAPI Backend → Session Storage: persists progress (evidence: `README.md`)
- FastAPI Backend → Browser UI: returns results (evidence: `README.md`)
