# jhubi1/ollama-app architecture

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

- Interactive diagram: https://gitdiagram.com/jhubi1/ollama-app
- Repository: https://github.com/jhubi1/ollama-app

## Overview

##### Main Components
- Frontend/UI Layer: Represent the Flutter UI components in the lib directory (e.g. main.dart, screen_welcome.dart, screen_settings.dart, screen_voice.dart). These form the presentation layer.
- Business Logic/Worker: The components in lib/worker (clients, desktop, haptic, sender, setter, theme, update) indicate where the core processing, device-specific logic, and integration with the backend occur.
- Localization & Settings: The lib/l10n and lib/settings directories show that the app is built with localization support (using ARB files and generated Dart files) and has a settings module for configuring the UI, voice, behavior, etc.
- Platform-specific Layers: The separate directories for android, linux, windows, and web indicate that the app’s code is compiled and adapted for different target platforms. Include these as design nodes that integrate with the common Flutter code.
- External API Integration: Since the README emphasizes that the app connects to an externally hosted Ollama server via its API, include an “External Ollama Server” node that interacts with the core business logic through API calls.
- CI/CD and Deployment: Although not part of runtime architecture, the presence of GitHub workflows, Fastlane configuration, and various build scripts/shell scripts can be noted as part of the deployment pipeline which ensures smooth continuous integration and continuous delivery.

##### Relationships and Data Flows
- That the localization and settings components feed into the UI layer to configure display and behavior.
- Platform-specific modules (Android, Linux, Windows, Web) as nodes that “wrap” the shared Flutter code. These nodes serve as the container environment ensuring proper system integration.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Demonstrate how the UI, business logic, and platform-specific integrations are separated.
- Cross-Platform Reusability: Emphasize the use of Flutter, with a clear boundary between the “lib” core code and the native project folders supporting different operating systems.
- Modularization: Indicate that localization, settings, and worker functionality are modular, making it clear where a change in one component (such as a new language support feature) will sit in the overall system.

##### Relevant Technologies & Frameworks
- Flutter and Dart as the primary framework and programming language.
- Fastlane and GitHub Actions (via .github/workflows) for automated build and deployment.
- Specific platform build tools (Gradle for Android, CMake for Linux/Windows).
- Any referenced third-party libraries/components (alluded to indirectly by the existence of worker components and localization) can be noted as fitting into the core application logic layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD & Deployment
    subgraph "CI/CD & Deployment"
        CICD1["GitHub Actions"]:::deploy
        CICD2["Fastlane"]:::deploy
        CICD3["Scripts"]:::deploy
    end

    %% Platform-specific Wrappers
    subgraph "Platform-specific Wrappers"
        Android["Android"]:::platform
        Linux["Linux"]:::platform
        Windows["Windows"]:::platform
        Web["Web"]:::platform
    end

    %% Flutter UI (Presentation)
    subgraph "Flutter UI (Presentation)"
        UI_Main["Main - lib/main.dart"]:::presentation
        UI_Welcome["Welcome Screen - lib/screen_welcome.dart"]:::presentation
        UI_Settings["Settings Screen - lib/settings.dart"]:::presentation
        UI_Voice["Voice Screen - lib/screen_voice.dart"]:::presentation
    end

    %% Localization & Settings
    subgraph "Localization & Settings"
        Localization["Localization - lib/l10n/"]:::config
        Settings["Settings Module - lib/settings/"]:::config
    end

    %% Business Logic/Worker
    subgraph "Business Logic/Worker"
        Worker["Worker Modules - lib/worker/"]:::worker
    end

    %% Assets and External API
    Assets["Assets & Resources - assets"]:::assets
    External["External Ollama Server"]:::external

    %% Connections from CI/CD to Platform-specific Wrappers
    CICD1 -->|"build"&nbsp;trigger| Android
    CICD1 -->|"build"&nbsp;trigger| Linux
    CICD1 -->|"build"&nbsp;trigger| Windows
    CICD1 -->|"build"&nbsp;trigger| Web

    CICD2 -->|"package"| Android
    CICD2 -->|"package"| Linux
    CICD2 -->|"package"| Windows
    CICD2 -->|"package"| Web

    CICD3 -->|"script-run"| Worker

    %% Connections from Platform-specific Wrappers to Flutter UI
    Android -->|"hosts"| UI_Main
    Linux -->|"hosts"| UI_Main
    Windows -->|"hosts"| UI_Main
    Web -->|"hosts"| UI_Main

    %% UI Layer triggers Business Logic
    UI_Main -->|"triggers"| Worker
    UI_Welcome -->|"triggers"| Worker
    UI_Settings -->|"triggers"| Worker
    UI_Voice -->|"triggers"| Worker

    %% Business Logic interacts with External API
    Worker -->|"APIcalls"| External

    %% Localization & Settings feed into UI
    Localization -->|"configures"| UI_Settings
    Settings -->|"configures"| UI_Settings

    %% Assets supply the UI
    Assets -->|"resources"| UI_Main

    %% Click Events
    click UI_Main "https://github.com/jhubi1/ollama-app/blob/main/lib/main.dart"
    click UI_Welcome "https://github.com/jhubi1/ollama-app/blob/main/lib/screen_welcome.dart"
    click UI_Settings "https://github.com/jhubi1/ollama-app/blob/main/lib/screen_settings.dart"
    click UI_Voice "https://github.com/jhubi1/ollama-app/blob/main/lib/screen_voice.dart"
    click Worker "https://github.com/jhubi1/ollama-app/tree/main/lib/worker/"
    click Localization "https://github.com/jhubi1/ollama-app/tree/main/lib/l10n/"
    click Settings "https://github.com/jhubi1/ollama-app/tree/main/lib/settings/"
    click Android "https://github.com/jhubi1/ollama-app/tree/main/android/"
    click Linux "https://github.com/jhubi1/ollama-app/tree/main/linux/"
    click Windows "https://github.com/jhubi1/ollama-app/tree/main/windows/"
    click Web "https://github.com/jhubi1/ollama-app/tree/main/web/"
    click Assets "https://github.com/jhubi1/ollama-app/tree/main/assets/"
    click CICD1 "https://github.com/jhubi1/ollama-app/tree/main/.github/"
    click CICD2 "https://github.com/jhubi1/ollama-app/tree/main/fastlane/"
    click CICD3 "https://github.com/jhubi1/ollama-app/tree/main/scripts/"

    %% Styles
    classDef deploy fill:#f9c,stroke:#333,stroke-width:2px;
    classDef platform fill:#ccf,stroke:#333,stroke-width:2px;
    classDef presentation fill:#cfc,stroke:#333,stroke-width:2px;
    classDef config fill:#fcf,stroke:#333,stroke-width:2px;
    classDef worker fill:#cff,stroke:#333,stroke-width:2px;
    classDef assets fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
```
