# pduy99/heliostranslator architecture

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

- Interactive diagram: https://gitdiagram.com/pduy99/heliostranslator
- Repository: https://github.com/pduy99/heliostranslator

## Overview

##### Project Overview & Main Components
- Key layers and modules:
- Shared Module: Contains the common business logic and supports Clean Architecture layers such as core (data, network, database, domain, and presentation), feature-specific modules (conversation, history, scan, text translation, etc.), and SQLDelight configuration.
- Android Module (androidApp): Provides native Android implementation – it includes dependency injection (with Hilt), navigation (NavHost and type-safe navigation), core components, and composables implementing the UI.
- iOS Module (iosApp): Holds iOS-specific setup, layout resources, and SwiftUI integration.
- CI/CD: The .circleci directory shows that CircleCI is used for continuous integration.
- External services and libraries such as MLKit (for image translation OCR), DeepL (for advanced translation using HTTP network calls via Ktor), SQLDelight (for local database persistence), and shared logging/Kermit.

##### Relationships and Interactions
- From the UI components (Android Composables or SwiftUI screens) to ViewModels.
- From ViewModels to Use Cases in the Domain layer.
- From Use Cases to Repositories in the Data layer.
- From Repositories to external data sources (network APIs, local database via SQLDelight, etc.).

##### Architectural Patterns & Design Principles
- Data, Domain, and Presentation layers in the shared code.
- Platform-specific concerns (native UI, dependency injection, navigation) isolated in androidApp and iosApp.
- Multiplatform-first approach, where the shared module is the core and both client apps reuse its business logic.

##### Technology & Frameworks
- Kotlin Multiplatform, Jetpack Compose (Android), SwiftUI (iOS)
- Ktor (HTTP networking), SQLDelight (database), MLKit (image translation), CameraX (camera functionality)
- Hilt for dependency injection (Android), and Kermit for logging.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["SunVerta Application"]:::external
    A -->|"contains"| B["Shared Business Logic"]:::shared
    A -->|"implements"| C["Android Module"]:::android
    A -->|"implements"| D["iOS Module"]:::ios
    A -->|"managed by"| E["CI/CD Pipeline"]:::ci

    %% Shared Business Logic Subgraph
    B -->|"includes"| F["Data Layer"]:::shared
    B -->|"includes"| G["Domain Layer"]:::shared
    B -->|"includes"| H["Presentation Layer"]:::shared
    B -->|"offers"| I["Conversation Translation Feature"]:::shared
    B -->|"offers"| J["Text Translation Feature"]:::shared
    B -->|"offers"| K["Image/Scan Translation Feature"]:::shared
    B -->|"offers"| L["Translate History Feature"]:::shared
    B -->|"configures"| M["SQLDelight Setup"]:::external
    B -->|"integrates"| N["DeepL Integration"]:::external
    B -->|"utilizes"| O["HTTP Client (Ktor)"]:::external

    %% Android Module Subgraph
    C -->|"comprises"| P["Android UI (Jetpack Compose)"]:::android
    C -->|"manages"| Q["Dependency Injection (Hilt)"]:::android
    C -->|"handles"| R["Navigation"]:::android
    C -->|"contains"| S["Feature Implementations"]:::android

    %% iOS Module Subgraph
    D -->|"comprises"| T["iOS UI (SwiftUI)"]:::ios

    %% Data flow arrows across layers
    P -->|"calls"| H
    T -->|"calls"| H
    H -->|"updates"| G
    G -->|"fetches"| F
    F -->|"persists to"| M
    F -->|"requests via"| O
    G -->|"integrates with"| N

    %% Feature interactions
    I -->|"triggers"| H
    J -->|"triggers"| H
    K -->|"triggers"| H
    L -->|"triggers"| H

    %% Click Events for Shared Business Logic
    click F "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/core/data"
    click G "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/core/domain"
    click H "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/core/presentation"
    click I "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/features/conversationtranslate"
    click J "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/features/texttranslate"
    click K "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/features/scantranslate"
    click L "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/features/history"
    click M "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/sqldelight"
    click N "https://github.com/pduy99/heliostranslator/tree/main/shared/src/commonMain/kotlin/com/helios/sunverta/core/network/deepl"
    click O "https://github.com/pduy99/heliostranslator/blob/main/shared/src/commonMain/kotlin/com/helios/sunverta/core/network/HttpClientFactory.kt"

    %% Click Events for Android Module
    click P "https://github.com/pduy99/heliostranslator/tree/main/androidApp/src/main/java/com/helios/sunverta/android/app/ui"
    click Q "https://github.com/pduy99/heliostranslator/tree/main/androidApp/src/main/java/com/helios/sunverta/android/app/di"
    click R "https://github.com/pduy99/heliostranslator/tree/main/androidApp/src/main/java/com/helios/sunverta/android/app/navigation"
    click S "https://github.com/pduy99/heliostranslator/tree/main/androidApp/src/main/java/com/helios/sunverta/android/features"

    %% Click Event for iOS Module
    click T "https://github.com/pduy99/heliostranslator/tree/main/iosApp/iosApp"

    %% Click Event for CI/CD
    click E "https://github.com/pduy99/heliostranslator/blob/main/.circleci"

    %% Styles
    classDef shared fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef android fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef ios fill:#ffcdd2,stroke:#c62828,stroke-width:2px;
    classDef external fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef ci fill:#d7ccc8,stroke:#4e342e,stroke-width:2px;
```
