# larroyo3/kmpsampleproject architecture

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

- Interactive diagram: https://gitdiagram.com/larroyo3/kmpsampleproject
- Repository: https://github.com/larroyo3/kmpsampleproject

## Overview

##### Main Components

A. Platform-Specific UI Layer
- Android UI (Jetpack Compose)
- iOS UI (SwiftUI)

B. Shared UI Layer (Compose Multiplatform)
- Common UI components
- Shared resources

C. Shared Business Logic Layer
- Common code
- Platform-specific implementations
- Data models
- Business rules

**┌─────────────────────────────────────────────────────────────┐**
- Platform-Specific UI                     │
- ┐            ┌────────────────────────┤
- Android UI Layer     │            │     iOS UI Layer       │
- (Jetpack Compose)    │            │      (SwiftUI)        │
- ┬───────────┘            └───────────┬────────────┘

- ▼                                    ▼
**┌─────────────────────────────────────────────────────────────┐**
- Compose Multiplatform Layer                 │

- (Shared UI Components & Resources)              │
- ┬─────────────────────────────────┘

- ▼
**┌─────────────────────────────────────────────────────────────┐**
- Shared Business Logic Layer                 │
- ┤
- ┌─────────────┐  ┌──────────────┐  ┌────────────────────┐  │
- Models    │  │  Components  │  │ Platform-Specific   │  │
- (RocketLaunch│  │   (Rocket   │  │   Implementations  │  │
- NewYear)   │  │  Component)  │  │                    │  │
- ┘  └──────────────┘  └────────────────────┘  │
- ┘

##### Component Relationships

- Data flow between layers (top to bottom for UI events, bottom to top for data updates)
- Dependencies between components
- Platform-specific implementations

##### Important Details

- The separation between `composeApp`, `shared`, and `iosApp` modules
- The common code in `commonMain` directories
- Platform-specific implementations in `androidMain` and `iosMain`
- Resource sharing mechanisms
- Key components like `RocketLaunch`, `NewYear`, and `RocketComponent`

##### Technical Stack Indicators

- Kotlin Multiplatform
- Jetpack Compose
- SwiftUI
- Kotlin Coroutines
- Ktor

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef android fill:#4285F4,color:white
    classDef ios fill:#999999,color:white
    classDef shared fill:#34A853,color:white
    classDef business fill:#FBBC05,color:white
    classDef implementation fill:#EA4335,color:white

    %% Platform-Specific UI Layer
    subgraph PlatformUI["Platform-Specific UI"]
        AndroidUI["Android UI\n(Jetpack Compose)"]:::android
        iOSUI["iOS UI\n(SwiftUI)"]:::ios
    end

    %% Shared UI Layer
    subgraph SharedUI["Compose Multiplatform Layer"]
        UIComponents["Shared UI Components"]:::shared
        Resources["Shared Resources"]:::shared
    end

    %% Business Logic Layer
    subgraph BusinessLogic["Shared Business Logic Layer"]
        subgraph Models["Models"]
            RocketLaunch["RocketLaunch"]:::business
            NewYear["NewYear"]:::business
        end
        
        subgraph Components["Components"]
            RocketComponent["RocketComponent"]:::business
        end
        
        subgraph PlatformImpl["Platform-Specific Implementations"]
            AndroidImpl["Android Implementation"]:::implementation
            iOSImpl["iOS Implementation"]:::implementation
        end
    end

    %% Relationships
    AndroidUI --> UIComponents
    iOSUI --> UIComponents
    UIComponents --> Resources
    UIComponents --> RocketComponent
    RocketComponent --> RocketLaunch
    RocketComponent --> NewYear
    RocketLaunch --> AndroidImpl
    RocketLaunch --> iOSImpl
    NewYear --> AndroidImpl
    NewYear --> iOSImpl

    %% Click Events
    click AndroidUI "https://github.com/larroyo3/KMPSampleProject/tree/master/composeApp/src/androidMain/kotlin/fr/acyll/kmpsampleproject/"
    click iOSUI "https://github.com/larroyo3/KMPSampleProject/tree/master/iosApp/iosApp/"
    click UIComponents "https://github.com/larroyo3/KMPSampleProject/tree/master/composeApp/src/commonMain/"
    click Resources "https://github.com/larroyo3/KMPSampleProject/tree/master/composeApp/src/commonMain/composeResources/"
    click RocketLaunch "https://github.com/larroyo3/KMPSampleProject/blob/master/shared/src/commonMain/kotlin/fr/acyll/kmpsampleproject/RocketLaunch.kt"
    click NewYear "https://github.com/larroyo3/KMPSampleProject/blob/master/shared/src/commonMain/kotlin/fr/acyll/kmpsampleproject/NewYear.kt"
    click RocketComponent "https://github.com/larroyo3/KMPSampleProject/blob/master/shared/src/commonMain/kotlin/fr/acyll/kmpsampleproject/RocketComponent.kt"
    click AndroidImpl "https://github.com/larroyo3/KMPSampleProject/blob/master/shared/src/androidMain/kotlin/fr/acyll/kmpsampleproject/Platform.android.kt"
    click iOSImpl "https://github.com/larroyo3/KMPSampleProject/blob/master/shared/src/iosMain/kotlin/fr/acyll/kmpsampleproject/Platform.ios.kt"

    %% Legend
    subgraph Legend["Legend"]
        L1["Android UI"]:::android
        L2["iOS UI"]:::ios
        L3["Shared Components"]:::shared
        L4["Business Logic"]:::business
        L5["Platform Implementation"]:::implementation
    end
```
