# mbakgun/midjourney-images-compose-multiplatform architecture

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

- Interactive diagram: https://gitdiagram.com/mbakgun/midjourney-images-compose-multiplatform
- Repository: https://github.com/mbakgun/midjourney-images-compose-multiplatform

## Overview

##### Project Type and Core Architecture
This is a Kotlin Multiplatform Mobile (KMM) project using Compose Multiplatform to create a cross-platform image viewing application that runs on multiple platforms (Android, iOS, Web, Wear OS, Android Automotive, Android TV, and Desktop).

##### Main Components

A. Platform-Specific Apps Layer (Top Level):
- To the shared module

B. Shared Module Layer (Middle Level):
Create distinct sections for:
##### UI Layer
- MjImagesApp (Composable)
- MjImagesViewModel
- Theme components

##### Domain Layer
- UseCases (MjImagesUseCase, MjImagesFetchUseCase)
- Models (MjImage, MjImages)
- Mappers (MjImagesMapper)

##### Data Layer
- Repository (MjImagesRepository)
- Data Sources (Remote/Local)
- API Services (KtorApi, MjImagesService)

C. External Dependencies Layer (Bottom Level):
- Ktor for networking
- Koin for dependency injection
- Kotlinx Serialization
- Coil for image loading
- Multiplatform Settings

**┌─────────────────── Platform Apps ───────────────────┐**
- ┌─────┐ ┌────┐ ┌───────┐ ┌────┐ ┌────┐ ┌───────┐ │
- Android│ │iOS │ │Desktop│ │Web │ │Wear│ │TV/Auto│ │
- ┬─┘ └──┬─┘ └───┬───┘ └──┬─┘ └──┬─┘ └───┬───┘ │
- ┼──────┼───────┼────────┼─────┼───────┼──────┘

**┌──────┼──────┼───────┼────────┼─────┼───────┼──────┐**

- Shared Module (Common Code Implementation)        │
- ┌─────────────────────────────────────┐         │
- UI Layer                  │         │
- MjImagesApp                      │         │
- MjImagesViewModel                │         │
- ┘         │
- ┌─────────────────────────────────────┐         │
- Domain Layer                │         │
- UseCases                        │         │
- Models                          │         │
- Mappers                         │         │
- ┘         │
- ┌─────────────────────────────────────┐         │
- Data Layer                 │         │
- Repository                       │         │
- Remote/Local Data Sources        │         │
- API Services                     │         │
- ┘         │
- ┬───────────────────────────┘

**┌──────────────────────┼───────────────────────────┐**
- External Dependencies & Libraries             │
- Ktor ─ Koin ─ Kotlinx ─ Coil ─ Settings        │
- ┘

##### Important Elements to Highlight

- Platform-specific code (Blue)
- Shared code (Green)
- External dependencies (Gray)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform Apps Layer
    subgraph PlatformApps["Platform-Specific Applications"]
        direction TB
        Android["Android App"]:::platform
        iOS["iOS App"]:::platform
        Desktop["Desktop App"]:::platform
        Web["Web App"]:::platform
        Wear["Wear OS App"]:::platform
        TV["TV App"]:::platform
        Auto["Automotive App"]:::platform
    end

    %% Shared Module
    subgraph SharedModule["Shared Module"]
        direction TB
        
        %% UI Layer
        subgraph UILayer["UI Layer"]
            direction TB
            MjApp["MjImagesApp"]:::ui
            MjViewModel["MjImagesViewModel"]:::ui
            Theme["Theme Components"]:::ui
        end

        %% Domain Layer
        subgraph DomainLayer["Domain Layer"]
            direction TB
            UseCases["UseCases"]:::domain
            Models["Models"]:::domain
            Mappers["MjImagesMapper"]:::domain
        end

        %% Data Layer
        subgraph DataLayer["Data Layer"]
            direction TB
            Repo["MjImagesRepository"]:::data
            
            subgraph DataSources["Data Sources"]
                direction TB
                LocalDS["Local DataSource"]:::data
                RemoteDS["Remote DataSource"]:::data
            end
            
            subgraph APIServices["API Services"]
                direction TB
                KtorApi["KtorApi"]:::data
                MjService["MjImagesService"]:::data
            end
        end

        %% DI and Utils
        KoinModule["Koin Module"]:::util
        ImageLoader["Image Loader"]:::util
        Dispatchers["Dispatcher Provider"]:::util
    end

    %% External Dependencies
    subgraph ExternalDeps["External Dependencies"]
        direction TB
        Ktor["Ktor"]:::external
        Koin["Koin"]:::external
        Kotlinx["Kotlinx"]:::external
        Coil["Coil"]:::external
        Settings["Multiplatform Settings"]:::external
    end

    %% Relationships
    PlatformApps --> SharedModule
    UILayer --> DomainLayer
    DomainLayer --> DataLayer
    DataLayer --> ExternalDeps
    DataSources --> APIServices
    
    %% Click Events
    click Android "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/androidApp/src/androidMain/"
    click iOS "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/iosApp/iosApp/"
    click Desktop "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/desktopApp/src/jvmMain/"
    click Web "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/webApp/src/jsMain/"
    click Wear "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/wearApp/src/main/"
    click TV "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/televisionApp/src/main/"
    click Auto "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/automotiveApp/src/main/"
    click MjApp "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/ui/MjImagesApp.kt"
    click MjViewModel "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/ui/MjImagesViewModel.kt"
    click Theme "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/shared/src/commonMain/kotlin/ui/theme/"
    click UseCases "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/shared/src/commonMain/kotlin/domain/usecase/"
    click Models "https://github.com/mbakgun/midjourney-images-compose-multiplatform/tree/master/shared/src/commonMain/kotlin/domain/model/"
    click Mappers "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/domain/mapper/MjImagesMapper.kt"
    click Repo "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/data/repository/MjImagesRepository.kt"
    click LocalDS "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/data/source/local/MjImagesLocalDataSource.kt"
    click RemoteDS "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/data/source/remote/MjImagesRemoteDataSource.kt"
    click KtorApi "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/data/source/remote/KtorApi.kt"
    click MjService "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/data/source/remote/MjImagesService.kt"
    click KoinModule "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/di/KoinModule.kt"
    click ImageLoader "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/util/ImageLoader.kt"
    click Dispatchers "https://github.com/mbakgun/midjourney-images-compose-multiplatform/blob/master/shared/src/commonMain/kotlin/util/DispatcherProvider.kt"

    %% Styles
    classDef platform fill:#B2D7FF,stroke:#1E88E5,stroke-width:2px
    classDef ui fill:#A5D6A7,stroke:#388E3C,stroke-width:2px
    classDef domain fill:#FFE0B2,stroke:#F57C00,stroke-width:2px
    classDef data fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px
    classDef util fill:#B2DFDB,stroke:#00796B,stroke-width:2px
    classDef external fill:#CFD8DC,stroke:#546E7A,stroke-width:2px
```
