# arnoulddw/transcriber architecture

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

- Interactive diagram: https://gitdiagram.com/arnoulddw/transcriber
- Repository: https://github.com/arnoulddw/transcriber

## Overview

##### Project Overview and Type
- The project is a full-stack web application designed for audio transcription using a user-friendly web interface.
- Its primary purpose is to allow users to upload audio files and receive transcriptions via two external transcription APIs (AssemblyAI and OpenAI Whisper). The README indicates that the application handles large files by splitting them into chunks.
- The project also supports deployment through Docker and Docker Compose.

##### Analyzing the File Structure
- Top-Level Files:
- Dockerfile and docker-compose.yml reside at the project root; these define the containerized deployment.
- README.md provides comprehensive usage and deployment instructions.
- app Folder (Frontend):
- Contains static assets: CSS in app/static/css, JavaScript in app/static/js.
- Contains HTML templates in app/templates (e.g., index.html) which serve as the user interface.
- backend Folder:
- Contains the Python backend implementation (app.py) that likely contains the Flask server code.
- Files like config.py and delete_old_files.py indicate custom configurations and automated housekeeping scripts.
- requirements.txt list dependencies, showing that the backend is built around Python (Flask) and integrates with transcription APIs.

##### Main System Components
a. Web Frontend:
- Static assets and HTML templates that create the user interface.
- Client browser where users interact with the application, uploading audio files and receiving transcription results.
b. Backend Server:
- The Python (Flask) application (backend/app.py) managing request handling, API calls to external services, data processing (e.g., file splitting logic), and database or file-based storage (if applicable).
- The config.py and delete_old_files.py to denote configurations and background maintenance tasks.
c. External Transcription APIs:
- AssemblyAI API and OpenAI Whisper API, displayed as external services that the backend consumes.
d. Container Environment:
- Docker and Docker Compose components. Sketch Docker as the encapsulation for the entire service along with defined environment variables and network/port configuration (port 5001 mapping).

##### Relationships and Interactions
- User Interaction: Clients access the frontend via a web browser.
- Frontend and Backend Communication: HTTP requests (via forms or AJAX) from the web interface to Flask endpoints in the backend.
- Backend to External APIs: Backend sends audio file data (or references) and receives transcription responses.
- Maintenance Process: A separate process or scheduled task (delete_old_files.py) cleaning up old files periodically.
- Containerization: The entire stack is packaged in a Docker container, orchestrated using Docker Compose with environment variable settings.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Frontend (presentation layer) is separated from the backend (logic and API calls).
- Modular Design: Different functionality (transcription handling, file uploads, API integration, and housekeeping) is managed by separate components/files.
- Containerization: Usage of Docker and Docker Compose abstracts the deployment environment.
- API Integration: Use of external services (AssemblyAI and Whisper) indicates an integration-heavy design.

## Diagram (Mermaid)

```mermaid
graph TD
    Browser("User Browser"):::client

    subgraph "Web Frontend"
        UI1("HTML Template"):::frontend
        UI2("CSS"):::frontend
        UI3("JavaScript"):::frontend
    end

    subgraph "Backend Server"
        BE1("Flask App"):::backend
        BE2("Configuration"):::backend
        BE3("Maintenance Task"):::backend
        BE4("Dependencies"):::backend
    end

    subgraph "External Transcription APIs"
        API1("AssemblyAI API"):::external
        API2("OpenAI Whisper API"):::external
    end

    subgraph "Container Environment"
        CON1("Dockerfile"):::container
        CON2("Docker-Compose"):::container
        NOTE("PortMapping(5001)&EnvVars"):::container
    end

    Browser -->|"Load_UI"| UI1
    UI1 -->|"Submit_Audio"| BE1
    BE1 -->|"Transcribe_API"| API1
    BE1 -->|"Transcribe_API"| API2
    BE1 -->|"Cleanup"| BE3
    NOTE -->|"Deploys"| UI1
    NOTE -->|"Deploys"| BE1

    click UI1 "https://github.com/arnoulddw/transcriber/blob/main/app/templates/index.html"
    click UI2 "https://github.com/arnoulddw/transcriber/blob/main/app/static/css/style.css"
    click UI3 "https://github.com/arnoulddw/transcriber/blob/main/app/static/js/app.js"
    click BE1 "https://github.com/arnoulddw/transcriber/blob/main/backend/app.py"
    click BE2 "https://github.com/arnoulddw/transcriber/blob/main/backend/config.py"
    click BE3 "https://github.com/arnoulddw/transcriber/blob/main/backend/delete_old_files.py"
    click BE4 "https://github.com/arnoulddw/transcriber/blob/main/backend/requirements.txt"
    click CON1 "https://github.com/arnoulddw/transcriber/tree/main/Dockerfile"
    click CON2 "https://github.com/arnoulddw/transcriber/blob/main/docker-compose.yml"

    classDef client fill:#a6e22e,stroke:#333,stroke-width:2px;
    classDef frontend fill:#66d9ef,stroke:#333,stroke-width:2px;
    classDef backend fill:#fd971f,stroke:#333,stroke-width:2px;
    classDef external fill:#ae81ff,stroke:#333,stroke-width:2px;
    classDef container fill:#f92672,stroke:#333,stroke-width:2px;
```
