
Composure
This repository provides a library implementing a lightweight, coroutine-based Unidirectional Data Flow (UDF) architecture for Kotlin applications, with a focus on Android and Jetpack Compose.
Overview
The UDF pattern establishes a single, directional flow of data through your application, making state management predictable and easier to debug.
Event → Action → Result → State
↓
Effect (side effects)
This project is organized into several modules:
Installation
Artifacts are published to Maven Central (mavenCentral() is already included by default in most modern Android and KMP projects).
Android projects
dependencies {
implementation("io.github.reid-mcpherson:arch:1.0.2")
implementation("io.github.reid-mcpherson:arch-android:1.0.2")
}
Kotlin Multiplatform projects
Add :arch to your shared commonMain source set. Gradle resolves
the correct platform variant (Android, iOS, etc.) automatically.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.reid-mcpherson:arch:1.0.2")
}
}
}
Supported targets: Android, iOS (iosArm64, iosSimulatorArm64)
:arch-android is Android-only and wraps :arch with ViewModel
and viewModelScope. Use it in your Android-specific source set.
Core Concepts
Data Flow Types
The pattern uses five main types to model the data flow:
Usage Example (Android ViewModel)