# southbridgeai/offmute architecture

> Architecture diagram of the GitHub repository southbridgeai/offmute, 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/southbridgeai/offmute
- Repository: https://github.com/southbridgeai/offmute

## Overview

##### Main System Components

a) Input Layer
- Audio/Video Input Handler
- File System Interface
- Configuration Manager (for API keys, settings)

b) Processing Pipeline
- Content Analysis Engine
- Transcription Engine
- Report Generation Engine

c) External Services
- Google Gemini API (with different model variants)
- FFmpeg Integration

##### Component Relationships

a) Core Flow (Left to Right):
**Input → Processing Pipeline → Output**

b) Processing Pipeline (Top to Bottom):
**Content Analysis**
**↓**
**Transcription & Diarization**
**↓**
**Report Generation**

##### Detailed Component Breakdown

- Rectangles: Core processing modules
- Hexagons: External services
- Rounded rectangles: Input/Output interfaces

- Blue: Core processing components
- Green: Input/Output handlers
- Purple: External services
- Orange: Storage components

**Raw Media → Chunks → Transcripts → Structured Report**

##### Processing Tiers

- First Tier
- Business Tier
- Economy Tier
- Budget Tier

##### Important Details to Highlight

- Parallel Processing: Show how audio chunks are processed concurrently
- Spreadfill Technique: Illustrate the three-step report generation process
- Model Selection: Indicate where different Gemini models are used
- Storage Patterns: Show intermediate file storage structure

##### Integration Points

- FFmpeg dependency
- Gemini API connectivity
- File system interactions
- CLI interface

Remember to include:
- Version compatibility (Node.js 14+)
- Required external dependencies
- Configuration requirements (API keys)
- Input/Output formats
- Error handling flows

This will provide a complete picture of the system's architecture while keeping it understandable and maintainable.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        AV[Audio/Video Input]
        FS[File System Interface]
        CM[Configuration Manager]
    end

    subgraph "Processing Pipeline"
        direction TB
        CAE["Content Analysis Engine"]
        TE["Transcription Engine"]
        RGE["Report Generation Engine"]
    end

    subgraph "External Services"
        GEM["Gemini API"]
        FF["FFmpeg Integration"]
    end

    subgraph "Utility Layer"
        AC["Audio Chunker"]
        SE["Screenshot Extractor"]
        TC["Type Checker"]
        GI["Gemini Interface"]
        PT["Prompt Templates"]
        RH["Runtime Handler"]
    end

    %% Main Flow
    AV --> CAE
    FS --> CAE
    CM --> CAE

    CAE --> TE
    TE --> RGE

    %% Utility Connections
    AC --> TE
    SE --> CAE
    TC --> CAE & TE & RGE
    GI --> CAE & TE & RGE
    PT --> CAE & TE & RGE
    RH --> CAE & TE & RGE
    FF --> CAE & TE

    %% External Service Connections
    GEM --> GI
    FF --> AC
    FF --> SE

    %% Click Events
    click CAE "https://github.com/SouthBridgeAI/offmute/blob/master/src/describe.ts"
    click TE "https://github.com/SouthBridgeAI/offmute/blob/master/src/transcribe.ts"
    click RGE "https://github.com/SouthBridgeAI/offmute/blob/master/src/report.ts"
    click AC "https://github.com/SouthBridgeAI/offmute/blob/master/src/utils/audio-chunk.ts"
    click SE "https://github.com/SouthBridgeAI/offmute/blob/master/src/utils/screenshot.ts"
    click FF "https://github.com/SouthBridgeAI/offmute/blob/master/src/utils/ffmpeg-check.ts"
    click GI "https://github.com/SouthBridgeAI/offmute/blob/master/src/utils/gemini.ts"
    click TC "https://github.com/SouthBridgeAI/offmute/blob/master/src/utils/check-type.ts"
    click PT "https://github.com/SouthBridgeAI/offmute/blob/master/src/prompts.ts"
    click RH "https://github.com/SouthBridgeAI/offmute/blob/master/src/run.ts"

    %% Styling
    classDef core fill:#2374ab
    classDef input fill:#57a773
    classDef external fill:#7d4cdb
    classDef utility fill:#ff7f50

    class CAE,TE,RGE core
    class AV,FS,CM input
    class GEM,FF external
    class AC,SE,TC,GI,PT,RH utility

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Input Handlers]:::input
        L3[External Services]:::external
        L4[Utility Components]:::utility
    end
```
