# openmf/mobile-wallet architecture

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

- Interactive diagram: https://gitdiagram.com/openmf/mobile-wallet
- Repository: https://github.com/openmf/mobile-wallet

## Overview

##### Main system components
- Feature Modules: Each business feature (e.g., accounts, auth, edit password, faq, finance, home, invoices, kyc, make-transfer, etc.) is placed in its own subdirectory under “feature”. They encapsulate the individual business functionalities.
- Platform-specific Modules: These include modules like “mifospay-android”, “mifospay-ios”, “mifospay-desktop”, “mifospay-web” and even “mifospay-shared” which bring together the multiplaform logic and UI navigation. They serve as the entry points per platform.
- Build & Library Infrastructure: The “build-logic” directory contains custom Gradle scripts and convention plugins, and the “libs” directory (for example, mifos-passcode) contains additional reusable libraries.
- CI/CD & Deployment: The .github workflows, Dockerfile, and fastlane directories point to automated build, testing, deployment, and release processes.

##### Relationships and interactions
- The Data layer comprises components under “core/data”, “core/datastore”, etc., which handle repository implementations, mappers, and API communication via Ktor.
- The Domain layer (“core/domain”) holds business logic or use cases driven by Domain-Driven Design.
- The Presentation (UI) layer is handled in “core/ui”, “core/designsystem” and the feature modules (each feature contains its own ViewModels, screens, navigators, etc.) that use Compose for building UI.
- Diagnostic/analytics features under “core/analytics” may sit as an overlay interacting with both the domain and UI layers.
- Integration points:
- Dependency injection using Koin flows between modules (note the various “di” directories in feature modules and core components).
- API networking interactions using Ktor/Ktorfit in the “core/network” modules, which interact with the backend Fineract API.
- Shared configuration across platforms is orchestrated through common build scripts from “build-logic”.

##### Architectural patterns/design principles
- The project uses a modular architecture where each feature or cross-cutting concern is isolated in its own module.
- It follows separation of concerns and dependency inversion; the UI layer calls into ViewModels, which then trigger domain use cases that communicate with the data layer.
- Multiplaform principles are evident where “commonMain” code is shared and “androidMain”, “iosMain”, etc. provide platform-specific implementations.
- DI is consistently applied through Koin “modules” found across the project.
- Modern reactive/procedural UI design is leveraged through Jetpack Compose constructs across platforms.

##### Technical stack details
- Languages and Platforms: Kotlin, Kotlin Multiplatform.
- UI Framework: Jetpack Compose (including Compose Multiplatform).
- Networking: Ktor and Ktorfit.
- Dependency Injection: Koin.
- Build Tools: Gradle (using convention plugins from “build-logic”) and fastlane for mobile deployment.
- Testing & CI: GitHub Actions workflows for pre-push, PR checks, monthly tags, etc.

##### Elements
- Clear labels for each component:
- External API calls from the network module and flows between dependency injection modules.
- For multi-platform boundaries, consider using grouping (such as a frame around platform-specific modules).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform-specific Clients
    subgraph "Platform-specific Clients"
        A["Android"]:::platform
        B["iOS"]:::platform
        C["Desktop"]:::platform
        D["Web"]:::platform
        E["Shared Multiplatform"]:::platform
    end

    %% Shared Core Modules
    subgraph "Shared Core Modules"
        F["Analytics"]:::core
        G["Common Utilities"]:::core
        H["Data"]:::core
        I["Datastore"]:::core
        J["Design System"]:::core
        K["Domain"]:::core
        L["Model"]:::core
        M["Network"]:::core
        N["UI"]:::core
    end

    %% Feature Modules
    subgraph "Feature Modules"
        O["Accounts"]:::feature
        P["Auth"]:::feature
        Q["Edit Password"]:::feature
        R["FAQ"]:::feature
        S["Finance"]:::feature
        T["Home"]:::feature
        U["Invoices"]:::feature
        V["KYC"]:::feature
        W["Make Transfer"]:::feature
        X["Other Features"]:::feature
    end

    %% Infrastructure & CI/CD
    subgraph "Infrastructure & CI/CD"
        Y["Build & Libs"]:::infrastructure
        AB["Reusable Libs"]:::infrastructure
        Z["CI/CD & Deployment"]:::infrastructure
    end

    %% External Service
    AA["Fineract API"]:::external

    %% Connections between layers
    A --> E
    B --> E
    C --> E
    D --> E

    E --> K

    I --> H
    H --> K
    J --> N

    K --> O
    K --> P
    K --> Q
    K --> R
    K --> S
    K --> T
    K --> U
    K --> V
    K --> W
    K --> X

    X --> Y
    Y --> AB
    Y --> Z

    M -->|"calls"| AA

    %% Click Events for Platform-specific Modules
    click A "https://github.com/openmf/mobile-wallet/tree/development/mifospay-android"
    click B "https://github.com/openmf/mobile-wallet/tree/development/mifospay-ios"
    click C "https://github.com/openmf/mobile-wallet/tree/development/mifospay-desktop"
    click D "https://github.com/openmf/mobile-wallet/tree/development/mifospay-web"
    click E "https://github.com/openmf/mobile-wallet/tree/development/mifospay-shared"

    %% Click Events for Shared Core Modules
    click F "https://github.com/openmf/mobile-wallet/tree/development/core/analytics"
    click G "https://github.com/openmf/mobile-wallet/tree/development/core/common"
    click H "https://github.com/openmf/mobile-wallet/tree/development/core/data"
    click I "https://github.com/openmf/mobile-wallet/tree/development/core/datastore"
    click J "https://github.com/openmf/mobile-wallet/tree/development/core/designsystem"
    click K "https://github.com/openmf/mobile-wallet/tree/development/core/domain"
    click L "https://github.com/openmf/mobile-wallet/tree/development/core/model"
    click M "https://github.com/openmf/mobile-wallet/tree/development/core/network"
    click N "https://github.com/openmf/mobile-wallet/tree/development/core/ui"

    %% Click Events for Feature Modules
    click O "https://github.com/openmf/mobile-wallet/tree/development/feature/accounts"
    click P "https://github.com/openmf/mobile-wallet/tree/development/feature/auth"
    click Q "https://github.com/openmf/mobile-wallet/tree/development/feature/editpassword"
    click R "https://github.com/openmf/mobile-wallet/tree/development/feature/faq"
    click S "https://github.com/openmf/mobile-wallet/tree/development/feature/finance"
    click T "https://github.com/openmf/mobile-wallet/tree/development/feature/home"
    click U "https://github.com/openmf/mobile-wallet/tree/development/feature/invoices"
    click V "https://github.com/openmf/mobile-wallet/tree/development/feature/kyc"
    click W "https://github.com/openmf/mobile-wallet/tree/development/feature/make-transfer"

    %% Click Events for Infrastructure & CI/CD
    click Y "https://github.com/openmf/mobile-wallet/tree/development/build-logic"
    click AB "https://github.com/openmf/mobile-wallet/tree/development/libs/mifos-passcode"
    click Z "https://github.com/openmf/mobile-wallet/blob/development/.github"

    %% Styling
    classDef platform fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef feature fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#000,stroke-width:2px;
```
