# unmonoqueteclea/voilib architecture

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

- Interactive diagram: https://gitdiagram.com/unmonoqueteclea/voilib
- Repository: https://github.com/unmonoqueteclea/voilib

## Overview

##### Main Components

a) Client Layer:
- Frontend (Svelte-based web application)
- Management Interface (Streamlit-based admin panel)

b) Backend Services:
- API Server (FastAPI)
- Worker Service (for async tasks)
- Authentication Service

c) Storage Layer:
- Vector Database (Qdrant)
- Relational Database (SQL with Alembic migrations)
- File Storage (for audio files)

d) Processing Pipeline:
- Collection Service (RSS feed crawler)
- Transcription Service (Whisper)
- Embedding Service (Vector processing)

##### Component Relationships

a) External Interactions:
- RSS Feeds → Collection Service
- User Uploads → Storage Layer
- User Queries → Frontend → API Server

b) Internal Data Flow:
- Collection Service → Storage Layer
- Audio Files → Transcription Service → Text Storage
- Text → Embedding Service → Vector Database
- Query Processing: User Input → Vector Embedding → Vector DB Search → Results

##### Specific Implementation Details

Technical elements:

a) Backend Structure:
- FastAPI Routers (/routers)
- Database Models (/models)
- Schema Definitions (/schemas)
- Task Queue System

b) Frontend Components:
- User Interface Routes
- Query Interface
- Audio Player
- Results Display

##### Key Processes to Highlight

Four main workflows:

##### Infrastructure Layer

Deployment-related components:
- Docker containers (as shown in compose.yml)
- Nginx reverse proxy
- Development vs Production environments

- Client Layer       |

- Service Layer      |

- Processing Layer    |

- Storage Layer      |

- Infrastructure Layer  |

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,color:white
    classDef backend fill:#2ecc71,color:white
    classDef storage fill:#f1c40f,color:black
    classDef external fill:#9b59b6,color:white
    classDef infra fill:#95a5a6,color:white

    %% Client Layer
    subgraph ClientLayer
        Frontend["Frontend Application"]:::frontend
        ManagementUI["Management Interface"]:::frontend
        UIRoutes["UI Routes"]:::frontend
        APIInterface["API Interface"]:::frontend
        Components["Frontend Components"]:::frontend
    end

    %% Backend Services Layer
    subgraph ServiceLayer
        APIServer["API Server"]:::backend
        Worker["Worker Service"]:::backend
        Auth["Authentication Service"]:::backend
        APIRoutes["API Routes"]:::backend
    end

    %% Processing Layer
    subgraph ProcessingLayer
        Collection["Collection Service"]:::backend
        Transcription["Transcription Service"]:::backend
        Embedding["Embedding Service"]:::backend
    end

    %% Storage Layer
    subgraph StorageLayer
        VectorDB["Vector Database (Qdrant)"]:::storage
        SQL["Relational Database"]:::storage
        FileStorage["File Storage"]:::storage
        DBModels["Database Models"]:::storage
        VectorOps["Vector Operations"]:::storage
        Migrations["Database Migrations"]:::storage
    end

    %% Infrastructure Layer
    subgraph InfraLayer
        DevConfig["Development Config"]:::infra
        ProdConfig["Production Config"]:::infra
        Docker["Docker Compose"]:::infra
    end

    %% External Systems
    RSSFeeds["RSS Feeds"]:::external
    UserInput["User Input"]:::external

    %% Relationships
    RSSFeeds --> Collection
    UserInput --> Frontend
    Frontend --> APIServer
    ManagementUI --> APIServer
    APIServer --> Auth
    APIServer --> Worker
    Collection --> FileStorage
    FileStorage --> Transcription
    Transcription --> Embedding
    Embedding --> VectorDB
    Worker --> ProcessingLayer
    APIServer --> VectorDB
    APIServer --> SQL

    %% Frontend Internal Relations
    Frontend --> UIRoutes
    Frontend --> APIInterface
    Frontend --> Components

    %% Click Events
    click Frontend "https://github.com/unmonoqueteclea/voilib/tree/main/frontend/src"
    click UIRoutes "https://github.com/unmonoqueteclea/voilib/tree/main/frontend/src/lib/pages"
    click APIInterface "https://github.com/unmonoqueteclea/voilib/blob/main/frontend/src/api.js"
    click Components "https://github.com/unmonoqueteclea/voilib/tree/main/frontend/src/lib"
    click ManagementUI "https://github.com/unmonoqueteclea/voilib/tree/main/backend/src/voilib/management/pages"
    click APIServer "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/main.py"
    click Worker "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/worker.py"
    click Auth "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/auth.py"
    click APIRoutes "https://github.com/unmonoqueteclea/voilib/tree/main/backend/src/voilib/routers"
    click Collection "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/collection/crawler.py"
    click Transcription "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/transcription.py"
    click Embedding "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/embedding.py"
    click DBModels "https://github.com/unmonoqueteclea/voilib/tree/main/backend/src/voilib/models"
    click VectorOps "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/vector.py"
    click FileStorage "https://github.com/unmonoqueteclea/voilib/blob/main/backend/src/voilib/storage.py"
    click Migrations "https://github.com/unmonoqueteclea/voilib/tree/main/backend/migrations"
    click DevConfig "https://github.com/unmonoqueteclea/voilib/tree/main/infra/development"
    click ProdConfig "https://github.com/unmonoqueteclea/voilib/tree/main/infra/production"
    click Docker "https://github.com/unmonoqueteclea/voilib/blob/main/compose.yml"
```
