# taratara10/bus_kmp architecture

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

- Interactive diagram: https://gitdiagram.com/taratara10/bus_kmp
- Repository: https://github.com/taratara10/bus_kmp

## Overview

##### Main Components
- Shared Domain & Model Layers:
- “core/domain” and “core/model” modules. These contain the core business logic (use cases like GetBusDepartureTimeUseCase) and data models (e.g., BusRouteName, Timetable, etc.) that are independent of any platform.
- Feature Modules:
- The “feature/clock” module shows how specific app features (such as UI for a clock or timetable display) are implemented, leveraging the shared domain.
- Platform-specific UI/Clients:
- The “app-wasm” module represents the web version, where UI code is written for WASM (with resources such as index.html and styles.css).
- The “app-wearos” module represents the Wear OS application with its Android-specific implementation (including Activities, ViewModels, and resource folders for UI elements).
- The “iosApp” directory represents the iOS application, with configuration files, SwiftUI components (ContentView.swift, iOSApp.swift), and integration with the common Kotlin business logic.
- Build & Configuration Infrastructure:
- “build-logic” provides custom Gradle plugins and DSL (plugins for KMP Android, Wasm, etc.), which shows how the project’s build and dependency management is structured.
- Other configuration files (e.g., gradle.properties, settings.gradle.kts, and .github workflows) help manage continuous integration/deployment.

##### Relationships and Interactions
- Central Shared Layer:
- Feature Integration:
- Platform-specific UI Layer:
- For each platform (WASM, Wear OS, and iOS), indicate that there is a specific entry point (e.g., a Main.kt for WASM; MainActivity, TimelineViewModel in Wear OS; ContentView and iOSApp.swift for iOS).
- Build and Deployment:
- “build-logic” and CI/CD configuration elements (GitHub Actions under .github/workflows and Gradle build scripts) as supporting infrastructure. Show their role in compiling, packaging, and deploying the application to the web (via the provided URL) and other platforms.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- That platform-specific presentation layers are decoupled from the business logic layer (core/domain and core/model). This supports code reusability across multiple targets.
- Modularization:
- Multiplatform Strategy:
- Use of Kotlin Multiplatform design, with commonMain directories shared across platforms (seen in the core and feature modules) and platform-specific extensions in directories such as wasmJsMain (for Web) and iosMain (for iOS, even if only indirectly referenced in the README).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Shared Code"
        CD("Core Domain"):::core
        CM("Core Model"):::core
    end

    subgraph "Feature Modules"
        CF("Clock Feature"):::feature
    end

    subgraph "Platform UI"
        WASM("WASM UI"):::ui
        WEAROS("Wear OS UI"):::ui
        IOS("iOS UI"):::ui
    end

    subgraph "Build & Configuration"
        BUILD("Build & Config Infra"):::infra
    end

    %% Relationships from Feature Modules to Shared Code
    CF -->|"uses"| CD
    CF -->|"uses"| CM

    %% Relationships from Platform UI to Feature Modules and Shared Code
    WASM -->|"calls"| CF
    WEAROS -->|"calls"| CF
    IOS -->|"calls"| CF

    WASM -->|"invokes"| CD
    WEAROS -->|"invokes"| CD
    IOS -->|"invokes"| CD

    %% Build & Configuration builds and deploys the apps
    BUILD -->|"builds"&deploys| WASM
    BUILD -->|"builds"&deploys| WEAROS
    BUILD -->|"builds"&deploys| IOS

    %% Click Events
    click CD "https://github.com/taratara10/bus_kmp/tree/main/core/domain"
    click CM "https://github.com/taratara10/bus_kmp/tree/main/core/model"
    click CF "https://github.com/taratara10/bus_kmp/tree/main/feature/clock"
    click WASM "https://github.com/taratara10/bus_kmp/tree/main/app-wasm/src/wasmJsMain"
    click WEAROS "https://github.com/taratara10/bus_kmp/tree/main/app-wearos/src/main/java/io/github/kabos/bus/presentation"
    click IOS "https://github.com/taratara10/bus_kmp/tree/main/iosApp/iosApp"
    click BUILD "https://github.com/taratara10/bus_kmp/tree/main/build-logic"

    %% Styles
    classDef core fill:#C0E0F9,stroke:#0A74DA,stroke-width:2px;
    classDef feature fill:#C9F9C0,stroke:#0A744D,stroke-width:2px;
    classDef ui fill:#F9E0C0,stroke:#DA740A,stroke-width:2px;
    classDef infra fill:#E0C9F9,stroke:#740ADA,stroke-width:2px;
```
