# zdrlfx/fullstop architecture

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

- Interactive diagram: https://gitdiagram.com/zdrlfx/fullstop
- Repository: https://github.com/zdrlfx/fullstop

## Overview

##### Project type and purpose
- This is a full‐stack voice & chat assistant (“JUNU”) with a React.js frontend and a FastAPI backend.
- Purpose: allow citizens to interact via text or voice to ask government-process questions. Backend handles chat (OpenAI/GPT), speech-to-text (Azure STT), and text-to-speech (Azure TTS).

##### File structure
- Top-level:
- frontend/ – React UI code (pages, components, build configs)
- server/ + main.py – FastAPI endpoints and logic (inference, model wrappers, speech processing, document indexing)
- Data/ – markdown docs used by the backend indexer
- config files: package.json, requirements.txt, .env expectations
- Architectural cues: separation of concerns (UI vs. API), modular backend (chat, STT, TTS, docs), no persistent database (in-memory or on-the-fly indexing).

##### Key insights from the README
- Backend exposes three REST endpoints: /chat, /stt, /tts
- Relies on Azure SDKs and OpenAI API
- Frontend built with Vite + Tailwind, deployed as a static bundle served by backend or CDN.

##### Detail level
- Backend modules (inference.py, model.py, speechprocessing.py, index_docs.py) as sub‐components
- Where Data/*.md is loaded and served to the Chat Service for context
- Lack of a persistent database (in-memory only) if relevant

## Diagram (Mermaid)

```mermaid
flowchart TB
    User["User"]:::external

    subgraph "Client/UI"
        FE["React SPA"]:::frontend
        Entry["main.jsx"]:::frontend
        App["App.jsx"]:::frontend
        ChatUI["ChatUI.jsx"]:::frontend
        VoiceUI["VoiceUI.jsx"]:::frontend
        Landing["LandingPage.jsx"]:::frontend
        Components["components/*.jsx"]:::frontend
        Utils["utils.js"]:::frontend
    end

    subgraph "Server/API"
        API["FastAPI App (main.py)"]:::backend

        subgraph "API Endpoints"
            ChatEP["/chat"]:::backend
            STTEP["/stt"]:::backend
            TTSEP["/tts"]:::backend
        end

        subgraph "Services"
            ChatSvc["Chat Service"]:::backend
            Indexer["Doc Indexer"]:::backend
            Speech["Speech Processing Service"]:::backend
        end

        DataStore["Data/*.md"]:::data
        SampleAudio["sample_audio.wav"]:::data
    end

    subgraph "External Services"
        OpenAI["OpenAI API"]:::external
        AzureSTT["Azure STT"]:::external
        AzureTTS["Azure TTS"]:::external
    end

    User -->|"interacts via UI"| FE
    FE -->|HTTP REST| API
    FE -->|renders| Entry
    FE -->|imports| App
    FE -->|uses| ChatUI
    FE -->|uses| VoiceUI
    FE -->|uses| Landing
    FE -->|uses| Components
    FE -->|uses| Utils

    API --> ChatEP
    API --> STTEP
    API --> TTSEP

    ChatEP --> ChatSvc
    ChatSvc --> Indexer
    ChatSvc -->|includes context| DataStore
    ChatSvc -->|calls| OpenAI
    Indexer --> DataStore

    STTEP --> Speech
    TTSEP --> Speech
    Speech -->|calls| AzureSTT
    Speech -->|calls| AzureTTS
    Speech -->|serves audio| SampleAudio

    API -->|responds| FE

    click FE "https://github.com/zdrlfx/fullstop/tree/main/frontend/"
    click Entry "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/main.jsx"
    click App "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/App.jsx"
    click ChatUI "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/pages/ChatUI.jsx"
    click VoiceUI "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/pages/VoiceUI.jsx"
    click Landing "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/pages/LandingPage.jsx"
    click Components "https://github.com/zdrlfx/fullstop/tree/main/frontend/src/components/"
    click Utils "https://github.com/zdrlfx/fullstop/blob/main/frontend/src/lib/utils.js"
    click API "https://github.com/zdrlfx/fullstop/blob/main/main.py"
    click ChatSvc "https://github.com/zdrlfx/fullstop/blob/main/server/inference.py"
    click Indexer "https://github.com/zdrlfx/fullstop/blob/main/server/index_docs.py"
    click Speech "https://github.com/zdrlfx/fullstop/blob/main/server/speechprocessing.py"
    click OpenAI "https://github.com/zdrlfx/fullstop/tree/main/n/a"
    click AzureSTT "https://github.com/zdrlfx/fullstop/tree/main/n/a"
    click AzureTTS "https://github.com/zdrlfx/fullstop/tree/main/n/a"
    click DataStore "https://github.com/zdrlfx/fullstop/tree/main/Data/"
    click SampleAudio "https://github.com/zdrlfx/fullstop/blob/main/sample_audio.wav"

    classDef frontend fill:#8ecae6,stroke:#023047,color:#000
    classDef backend fill:#a8dadc,stroke:#1d3557,color:#000
    classDef external fill:#ffb703,stroke:#fb8500,color:#000
    classDef data fill:#e0e0e0,stroke:#888,color:#000
```
