# buabaj/feyn architecture

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

- Interactive diagram: https://gitdiagram.com/buabaj/feyn
- Repository: https://github.com/buabaj/feyn

## Overview

##### Main Components Identification
First, let's identify the key architectural components based on the source structure:

a. Core Components:
- Speech Processing System (speech_processor.py)
- Text Handling System (text_handler.py)
- Engine (engine.py)
- Transcript Management (transcript_manager.py)
- Report Generation (report_generator.py)

b. Mode System:
- Mode Management (modes/mode.py)
- Different Learning Modes (standard, quiz, challenge)

**┌─ User Interface Layer ─────────────────────┐**
- CLI Interface (feyn.py)                    │
- ┬─────────────────────────┘
- ↓
**┌─ Core Processing Layer ───────────────────┐**
- ┌─────────────┐    ┌──────────────┐      │
- Input Handler│←→│ Core Engine   │      │
- ┘    └──────────────┘      │
- ↑                     ↕              │
- ┌─────────────┐    ┌──────────────┐      │
- Speech Proc. │    │Text Handler  │      │
- ┘    └──────────────┘      │
- ┬──────────────────┘
- ↓
**┌─ Learning Mode Layer ──────────────────────┐**
- ┌─────────────┐ ┌──────────┐ ┌──────────┐ │
- Standard   │ │   Quiz   │ │Challenge │ │
- ┘ └──────────┘ └──────────┘ │
- ┬──────────────────┘
- ↓
**┌─ Storage & Output Layer ─────────────────┐**
- ┌─────────────┐    ┌──────────────┐     │
- Transcript  │    │   Report     │     │
- Manager    │    │  Generator   │     │
- ┘    └──────────────┘     │
- ┘

##### Component Relationships

- Double lines: API calls to external services

##### Notes for Implementation

- The modular nature of the system
- Clear separation of concerns
- Extensibility points for future features
- Configuration management
- Error handling flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef mode fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white

    %% User Interface Layer
    CLI["CLI Interface"]:::ui
    click CLI "https://github.com/buabaj/feyn/blob/main/src/feyn.py"

    %% Configuration
    Config["Global Configuration"]:::config
    click Config "https://github.com/buabaj/feyn/blob/main/src/config.py"

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        Engine["Core Engine"]:::core
        InputHandler["Input Handler"]:::core
        SpeechProc["Speech Processor"]:::core
        TextHandler["Text Handler"]:::core
    end
    click Engine "https://github.com/buabaj/feyn/blob/main/src/core/engine.py"
    click SpeechProc "https://github.com/buabaj/feyn/blob/main/src/core/speech_processor.py"
    click TextHandler "https://github.com/buabaj/feyn/blob/main/src/core/text_handler.py"

    %% External Services
    WhisperAPI["OpenAI Whisper API"]:::external
    GPTAPI["OpenAI GPT API"]:::external

    %% Learning Mode Layer
    subgraph ModeLayer["Learning Mode Layer"]
        ModeManager["Mode Manager"]:::mode
        Standard["Standard Mode"]:::mode
        Quiz["Quiz Mode"]:::mode
        Challenge["Challenge Mode"]:::mode
    end
    click ModeManager "https://github.com/buabaj/feyn/blob/main/src/modes/mode.py"

    %% Storage & Output Layer
    subgraph StorageLayer["Storage & Output Layer"]
        TranscriptMgr["Transcript Manager"]:::storage
        ReportGen["Report Generator"]:::storage
    end
    click TranscriptMgr "https://github.com/buabaj/feyn/blob/main/src/core/transcript_manager.py"
    click ReportGen "https://github.com/buabaj/feyn/blob/main/src/core/report_generator.py"

    %% Relationships
    CLI --> Config
    CLI --> InputHandler
    InputHandler <--> Engine
    Engine <--> TextHandler
    Engine <--> SpeechProc
    SpeechProc <--> WhisperAPI
    TextHandler <--> GPTAPI
    Engine <--> ModeManager
    ModeManager --> Standard
    ModeManager --> Quiz
    ModeManager --> Challenge
    Engine --> TranscriptMgr
    TranscriptMgr --> ReportGen

    %% Legend
    subgraph Legend
        UI["User Interface"]:::ui
        CoreComp["Core Component"]:::core
        ModeComp["Mode Component"]:::mode
        StorageComp["Storage Component"]:::storage
        ExtComp["External Service"]:::external
        ConfigComp["Configuration"]:::config
    end
```
