# arkonballoon/voicetodocweb architecture

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

- Interactive diagram: https://gitdiagram.com/arkonballoon/voicetodocweb
- Repository: https://github.com/arkonballoon/voicetodocweb

## Overview

- Frontend:
- Vue.js Application: Represent the user interface components responsible for transcription views, template management, configuration, and rich-text editing.
- Client-side Routing and State Management: Using Vue Router and Pinia.
- Backend:
- FastAPI Server: Acts as the core API endpoint provider for RESTful operations and WebSocket-based live audio streaming.
- Audio Processing Modules: Such as the audio_processor.py and transcriber.py, which wrap the Whisper model for transcription.
- Template and Data Handling:
▪ Template Processor and Service: Handle template-based text processing using GPT-4.
▪ Database and Storage Adapters: Modules in the “database” and “storage” directories that manage persistence (SQL adapter, filesystem adapter) and connection management.
- Queue Manager: Possibly managing asynchronous processing tasks.
- External Services and Infrastructure:
- OpenAI API: For processing templates with GPT-4.
- Docker & Docker Compose: Representing the containerized deployment of both frontend and backend.
- (Optional) WebRTC: For live audio streaming.
- NVIDIA GPU/CPU Selection: As a decision point for accelerated transcription (managed via config parameters).

##### Relationships and Data Flow
- Frontend-to-Backend Communication:
- REST API calls: For transcription requests, template saving, and configuration updates.
- WebSocket connections: For live audio streaming and real-time transcription feeds.
- Backend Internal Interactions:
- The API layer routes requests to the appropriate service modules (audio processing, template processing).
- Storage Layer: Interacts with both file-based storage and database modules; these modules handle data persistence, configuration management (using config files and JSON files in the data directory).
- Queue Manager: Oversees task scheduling between incoming transcription jobs and template processing tasks.
- External API Integration:
- When processing templates via GPT-4 through OpenAI’s API, data flows from the backend service to the external service and back.

##### Architectural Patterns/Design Principles
- Separation of Concerns:
- Frontend and backend responsibilities are clearly separated into distinct Docker containers.
- Modular Design:
- The backend code is organized into dedicated modules for modeling, database connectivity, data processing, storage management, and services—indicative of a layered architecture.
- Containerization:
- The use of Docker and Docker Compose promotes portability and consistent deployment environments.
- Real-Time Data Handling:
- Use of WebSocket indicates support for live, streaming data interactions in addition to standard RESTful interactions.

##### Technologies and Frameworks
- Frontend Technologies:
- Vue.js 3, Vue Router, Vue Quill, Pinia.
- Backend Technologies:
- FastAPI, Whisper, OpenAI’s GPT-4.
- Containerization and Deployment:
- Docker, Docker Compose.
- Additional Tools:
- ESLint, Prettier, and development utilities (e.g., install_pytorch.sh for PyTorch setup).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Deployment Layer
    subgraph "Deployment"
        d1["Containerization Setup"]:::deploy
    end

    %% Frontend Layer
    subgraph "Frontend"
        f1["Vue.js Frontend"]:::frontend
        f2["Template Processing View"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        b1["FastAPI Server"]:::backend
        b2["Audio Processing Module (Whisper)"]:::backend
        b3["Template Processor (GPT-4)"]:::backend
        b4["Template Service"]:::backend
        b5["Database Adapter"]:::database
        b6["Storage Adapters"]:::database
        b7["Queue Manager"]:::backend
        b8["Configuration & Data"]:::backend
    end

    %% External Services
    e1["OpenAI API"]:::external
    e2["WebRTC Service"]:::external

    %% Containerization connects to main services
    d1 --> f1
    d1 --> b1

    %% Frontend internal connection
    f1 -->|"includes_view"| f2

    %% Frontend to Backend Communication
    f1 -->|"REST_API"| b1
    f1 <-->|"WebSocket"| b1

    %% Backend internal communications
    b1 -->|"transcription"| b2
    b1 -->|"template_call"| b3
    b1 -->|"template_manage"| b4
    b1 -->|"database_access"| b5
    b1 -->|"storage_access"| b6
    b1 -->|"queue_schedule"| b7
    b8 -->|"config/data"| b1

    %% External integrations
    b3 -->|"GPT-4_call"| e1
    f1 <-->|"streaming"| e2
    b1 <-->|"RTC_signal"| e2

    %% Styling classes
    classDef frontend fill:#FFEFBA,stroke:#EAA823,stroke-width:2px;
    classDef backend fill:#B3E5FC,stroke:#039BE5,stroke-width:2px;
    classDef database fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px;
    classDef deploy fill:#D1C4E9,stroke:#673AB7,stroke-width:2px;

    %% Click Events
    click f1 "https://github.com/arkonballoon/voicetodocweb/tree/main/frontend/src"
    click f2 "https://github.com/arkonballoon/voicetodocweb/blob/main/TemplateProcessingView.vue"
    click f2 "https://github.com/arkonballoon/voicetodocweb/blob/main/frontend/src/views/TemplateProcessingView.vue"
    click b1 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/main.py"
    click b2 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/audio_processor.py"
    click b2 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/transcriber.py"
    click b3 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/services/template_processor.py"
    click b4 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/services/template_service.py"
    click b5 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/database/connection.py"
    click b5 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/database/models.py"
    click b6 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/storage/filesystem_adapter.py"
    click b6 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/storage/sql_adapter.py"
    click b6 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/storage/storage_adapter.py"
    click b6 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/storage/storage_factory.py"
    click b7 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/queue_manager.py"
    click b8 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/config.py"
    click b8 "https://github.com/arkonballoon/voicetodocweb/blob/main/backend/src/data/config.json"
    click b8 "https://github.com/arkonballoon/voicetodocweb/tree/main/backend/data/templates/"
    click d1 "https://github.com/arkonballoon/voicetodocweb/blob/main/docker-compose.yml"
    click d1 "https://github.com/arkonballoon/voicetodocweb/tree/main/backend/Dockerfile"
    click d1 "https://github.com/arkonballoon/voicetodocweb/tree/main/frontend/Dockerfile"
    click d1 "https://github.com/arkonballoon/voicetodocweb/blob/main/install_pytorch.sh"
```
