# alphobla/infiniling-app architecture

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

- Interactive diagram: https://gitdiagram.com/alphobla/infiniling-app
- Repository: https://github.com/alphobla/infiniling-app

## Overview

##### Project type and purpose
- This is a Python desktop (or packaged) application that helps users transcribe audio, generate text, translate, practice vocabulary via spaced repetition, and review statistics.
- Key indicators:
- main.py + main.spec ⇒ PyInstaller packaging of a standalone app
- data/transcriptions_and_audio ⇒ raw audio + subtitle files
- src/gentexter_mode & src/transcriber_mode ⇒ two major modes (text-generation & transcription)
- src/shared ⇒ reusable UI components, database models, translation, frequency analysis

##### File structure
- Top-level:
- main.py & main.spec – application entrypoint and build spec
- config.json & .claude/settings.local.json – global and local configuration
- data/… – persistent audio and transcripts on disk
- requirements.txt – third-party dependencies
- src/ – all source code, subdivided into three packages:
– gentexter_mode/ – modules for text generation, review UI, stats UI, spaced-repetition selector, audio generation
– transcriber_mode/ – modules to load audio, invoke transcription engine, display UI
– shared/ – common UI widgets (menus, reader panels, vocabulary panels), utility modules (audio controls, frequency analysis), database models, external API clients (GPT translator, Tatoeba client)
- vocabulary.db – SQLite database backing spaced-repetition and vocabulary tracking

##### Since README.md is empty, infer stack and architecture from names
- Likely uses OpenAI GPT APIs (gpt_translator.py, text_generator.py)
- May use Whisper or another speech-to-text engine in transcriber.py
- May use a text-to-speech engine in audio_generator.py

##### Main components
a. UI Layer (“Front-end” within the desktop app):
- Gentexter Mode UI (config, review, stats)
- Transcriber Mode UI
- Shared widgets (menu, reader UI, vocabulary panel)
b. Orchestration / Business Logic Layer (“Back-end” modules):
- Orchestrator (orchestrator_updated.py) – routes user actions to services
- Text Generator (text_generator.py)
- Audio Generator (audio_generator.py)
- Transcriber Service (transcriber.py)
- Spaced Repetition Selector (spaced_repetition_selector.py)
- Frequency Analysis (frequency_analysis.py)
- GPT Translator (gpt_translator.py)
- Tatoeba Client (tatoeba_client.py)
- Database Models (database_models.py)
c. Data Layer:
- Local file storage (data/transcriptions_and_audio/*.mp3, .srt)
- SQLite database (vocabulary.db)
- Configuration files (config.json, settings.local.json)
d. External Services:
- OpenAI API (GPT text completion/translation)
- Tatoeba API (example sentence retrieval)
- (Optional) Speech-to-Text engine / TTS engine endpoints

##### Relationships and interactions
- UI components send user events to the Orchestrator
- Orchestrator invokes Business Logic services
- Services read/write transcripts from/to local storage
- Services persist/retrieve vocabulary & review data via database_models → vocabulary.db
- TextGenerator & GPT Translator call OpenAI API
- TatoebaClient calls external Tatoeba REST API
- AudioGenerator outputs .mp3 files to data folder
- Transcriber consumes .mp3, returns .srt transcripts

##### Architectural patterns and design principles
- Layered architecture (UI → Orchestrator → Services → Data)
- Modular modes (gentexter vs transcriber) share common components via src/shared
- Single Orchestrator to decouple UI modules from service implementations
- Persistence via a small embedded SQLite store + flat-file assets

##### Key callouts to capture in detail
- The shared/src folder: highlight common widgets & utilities reused by both modes
- The orchestrator_updated.py as the central dispatcher
- Flow of an audio transcription session vs. a text-generation/spaced-repetition session side by side
- Configuration sources: config.json vs local overrides

## Diagram (Mermaid)

```mermaid
flowchart TD
    Main["Application Entrypoint (main.py / main.spec)"]:::service
    subgraph "UI Layer"
        GentexterConfig["Gentexter Config UI"]:::ui
        GentexterReview["Gentexter Review UI"]:::ui
        GentexterStats["Gentexter Stats UI"]:::ui
        TranscriberUI["Transcriber Mode UI"]:::ui
    end

    subgraph "Backend Layer"
        Orchestrator["Orchestrator (Dispatcher)"]:::service
        subgraph "Gentexter Mode Services"
            TextGen["Text Generator Service"]:::service
            AudioGen["Audio Generator Service"]:::service
            SpacedRep["Spaced Repetition Selector"]:::service
        end
        Frequency["Frequency Analysis Utility"]:::service
        TranscriberSrv["Transcriber Service"]:::service
        GPTTrans["GPT Translator Client"]:::service
        Tatoeba["Tatoeba API Client"]:::service
        DBModels["Database Models (SQLite ORM)"]:::service
        AudioCtrl["Audio Controls Utility"]:::service
    end

    subgraph "Data Storage"
        FileStorage["Local File Storage (Audio & Transcripts)"]:::storage
        VocabularyDB["Vocabulary Database (vocabulary.db)"]:::db
        ConfigFiles["Configuration Files"]:::config
    end

    subgraph "External Services"
        OpenAI["OpenAI API"]:::external
        TatoebaExt["Tatoeba Service"]:::external
    end

    Main -->|launches| GentexterConfig
    Main -->|launches| GentexterReview
    Main -->|launches| GentexterStats
    Main -->|launches| TranscriberUI

    GentexterConfig -->|user action| Orchestrator
    GentexterReview -->|user action| Orchestrator
    GentexterStats -->|user action| Orchestrator
    TranscriberUI -->|user action| Orchestrator

    Orchestrator -->|invoke| TextGen
    Orchestrator -->|invoke| AudioGen
    Orchestrator -->|invoke| SpacedRep
    Orchestrator -->|invoke| TranscriberSrv
    Orchestrator -->|invoke| Frequency
    Orchestrator -->|invoke| GPTTrans
    Orchestrator -->|invoke| Tatoeba
    Orchestrator -->|invoke| DBModels
    Orchestrator -->|invoke| AudioCtrl

    TextGen -->|calls| OpenAI
    GPTTrans -->|calls| OpenAI
    Tatoeba -->|calls| TatoebaExt

    AudioGen -->|writes| FileStorage
    TranscriberSrv -->|reads/writes| FileStorage

    DBModels -->|reads/writes| VocabularyDB
    Orchestrator -->|loads| ConfigFiles

    classDef ui fill:lightblue,stroke:#333,stroke-width:1px
    classDef service fill:lightgreen,stroke:#333,stroke-width:1px
    classDef db fill:yellow,stroke:#333,stroke-width:1px
    classDef storage fill:lightgray,stroke:#333,stroke-width:1px
    classDef config fill:yellow,stroke:#333,stroke-width:1px
    classDef external stroke-dasharray:5 5,fill:none,stroke:#999

    click GentexterConfig "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/gentexter_config_ui.py"
    click GentexterReview "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/gentexter_review_ui.py"
    click GentexterStats "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/gentexter_stats_ui.py"
    click TranscriberUI "https://github.com/alphobla/infiniling-app/blob/main/src/transcriber_mode/ui.py"
    click Orchestrator "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/orchestrator_updated.py"
    click TextGen "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/text_generator.py"
    click AudioGen "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/audio_generator.py"
    click SpacedRep "https://github.com/alphobla/infiniling-app/blob/main/src/gentexter_mode/spaced_repetition_selector.py"
    click Frequency "https://github.com/alphobla/infiniling-app/blob/main/src/shared/frequency_analysis.py"
    click GPTTrans "https://github.com/alphobla/infiniling-app/blob/main/src/shared/gpt_translator.py"
    click Tatoeba "https://github.com/alphobla/infiniling-app/blob/main/src/shared/tatoeba_client.py"
    click DBModels "https://github.com/alphobla/infiniling-app/blob/main/src/shared/database_models.py"
    click AudioCtrl "https://github.com/alphobla/infiniling-app/blob/main/src/shared/audio_controls.py"
    click ConfigFiles "https://github.com/alphobla/infiniling-app/blob/main/config.json"
    click FileStorage "https://github.com/alphobla/infiniling-app/tree/main/data/transcriptions_and_audio/"
    click VocabularyDB "https://github.com/alphobla/infiniling-app/blob/main/vocabulary.db"
    click Main "https://github.com/alphobla/infiniling-app/blob/main/main.py"
```
