# borealnetwork/kmmui architecture

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

- Interactive diagram: https://gitdiagram.com/borealnetwork/kmmui
- Repository: https://github.com/borealnetwork/kmmui

## Overview

##### Project type and purpose
- This is a Kotlin Multiplatform Mobile project that shares business logic and UI code across Android and iOS.
- The goal is to write common Compose UI and Kotlin code once (in the `composeApp` module) and then ship it as an Android app (using Jetpack Compose) and as an iOS app (wrapping the shared code in a SwiftUI/Xcode entry point).

##### File structure
- Top-level modules:
- `composeApp/` – a Gradle-based Kotlin Multiplatform library and Android app module.
- `iosApp/` – an Xcode project for the iOS application.
- Inside `composeApp/`:
- `src/commonMain/` – shared Kotlin code and Compose Multiplatform UI (`App.kt`, `Greeting.kt`).
- `src/androidMain/` – Android-specific code (`MainActivity.kt`, `Platform.android.kt`, Android resources).
- `src/iosMain/` – iOS-specific Kotlin/Native glue (`MainViewController.kt`, `Platform.ios.kt`).
- `src/commonTest/` – shared unit tests.
- The `iosApp/` directory contains the SwiftUI entry point (`ContentView.swift`, `iOSApp.swift`) and assets, linking in the KMM framework produced by the Gradle build of `composeApp`.

##### README for additional insights
- Confirms the division between `commonMain` (shared code) and platform-specific sources.
- Describes how to build the Android app via Gradle and the iOS app via Xcode.
- Mentions Compose Multiplatform and that you may add native platform calls in `androidMain` or `iosMain`.

##### Detail
- Every source set as its own component if it has unique responsibilities (commonMain, androidMain, iosMain).
- Testing module (commonTest) to reflect the test layer.
- Don’t forget resources: Compose resources and Android/iOS asset catalogs.
- External systems only if they’re in scope (none here beyond platform SDKs).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Shared KMM Module"
        commonMain["commonMain: App.kt, Greeting.kt, Platform.kt"]:::shared
        commonTest["commonTest: ComposeAppCommonTest.kt"]:::shared
    end

    gradle["Gradle Build (build.gradle.kts)"]:::build

    subgraph "Android Application"
        androidMain["androidMain: MainActivity.kt, Platform.android.kt"]:::android
        androidRes["androidMain/res (drawable-*, mipmap-*, values/strings.xml)"]:::android
    end

    subgraph "iOS Application"
        iosMain["iosMain: MainViewController.kt, Platform.ios.kt"]:::ios
        iosFramework["Kotlin/Native Framework"]:::ios
        swiftEntry["SwiftUI Entry: ContentView.swift, iOSApp.swift"]:::ios
        xcode["Xcode Project & Config"]:::build
        iosAssets["Assets.xcassets, Info.plist"]:::ios
    end

    commonMain --> gradle
    commonTest --> gradle

    gradle --> androidMain
    gradle --> androidRes

    gradle --> iosMain
    iosMain --> iosFramework
    gradle --> iosFramework
    iosFramework --> swiftEntry
    xcode --> swiftEntry
    iosAssets --> xcode

    click commonMain "https://github.com/borealnetwork/kmmui/tree/main/composeApp/src/commonMain/kotlin/com/borealnetwork/kmmui"
    click commonTest "https://github.com/borealnetwork/kmmui/blob/main/composeApp/src/commonTest/kotlin/com/borealnetwork/kmmui/ComposeAppCommonTest.kt"
    click androidMain "https://github.com/borealnetwork/kmmui/tree/main/composeApp/src/androidMain/kotlin/com/borealnetwork/kmmui"
    click androidRes "https://github.com/borealnetwork/kmmui/tree/main/composeApp/src/androidMain/res"
    click gradle "https://github.com/borealnetwork/kmmui/blob/main/composeApp/build.gradle.kts"
    click iosMain "https://github.com/borealnetwork/kmmui/tree/main/composeApp/src/iosMain/kotlin/com/borealnetwork/kmmui"
    click swiftEntry "https://github.com/borealnetwork/kmmui/tree/main/iosApp/iosApp"
    click xcode "https://github.com/borealnetwork/kmmui/blob/main/iosApp/iosApp.xcodeproj"
    click iosAssets "https://github.com/borealnetwork/kmmui/blob/main/iosApp/iosApp/Assets.xcassets"

    classDef shared fill:#E3F2FD,stroke:#2196F3,color:#0D47A1,stroke-width:2px;
    classDef android fill:#E8F5E9,stroke:#4CAF50,color:#1B5E20,stroke-width:2px;
    classDef ios fill:#FFFDE7,stroke:#FFC107,color:#FF6F00,stroke-width:2px;
    classDef build fill:#FFF3E0,stroke:#FF9800,color:#E65100,stroke-width:2px;
```
