{"id":13537370,"url":"https://github.com/copper-leaf/ballast","last_synced_at":"2025-10-08T08:17:50.850Z","repository":{"id":37236326,"uuid":"429665847","full_name":"copper-leaf/ballast","owner":"copper-leaf","description":"Opinionated Application State Management framework for Kotlin Multiplatform","archived":false,"fork":false,"pushed_at":"2025-09-26T04:14:38.000Z","size":60933,"stargazers_count":158,"open_issues_count":9,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-26T06:11:25.849Z","etag":null,"topics":["hacktoberfest","hacktoberfest2023","kotlin","kotlin-multiplatform","mvi"],"latest_commit_sha":null,"homepage":"https://copper-leaf.github.io/ballast/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/copper-leaf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-19T04:08:39.000Z","updated_at":"2025-09-05T18:26:24.000Z","dependencies_parsed_at":"2024-03-06T17:38:38.398Z","dependency_job_id":"9f972dad-fce6-4645-9445-68346b9e287f","html_url":"https://github.com/copper-leaf/ballast","commit_stats":{"total_commits":202,"total_committers":8,"mean_commits":25.25,"dds":0.0643564356435643,"last_synced_commit":"3b3d3a9e277aa6fb4fa8184ff225a24cb3ad7a98"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/copper-leaf/ballast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copper-leaf%2Fballast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copper-leaf%2Fballast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copper-leaf%2Fballast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copper-leaf%2Fballast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copper-leaf","download_url":"https://codeload.github.com/copper-leaf/ballast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copper-leaf%2Fballast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278910196,"owners_count":26067003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest2023","kotlin","kotlin-multiplatform","mvi"],"created_at":"2024-08-01T09:00:58.222Z","updated_at":"2025-10-08T08:17:50.821Z","avatar_url":"https://github.com/copper-leaf.png","language":"Kotlin","funding_links":[],"categories":["Libraries","Utilities / Libraries"],"sub_categories":["Architecture","🏗 Architecture"],"readme":"---\n---\n\n# Ballast\n\n\u003e Opinionated Application State Management framework for Kotlin Multiplatform\n\n![Kotlin Version](https://img.shields.io/badge/Kotlin-1.9.22-orange)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/copper-leaf/ballast)](https://github.com/copper-leaf/ballast/releases)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.copper-leaf/ballast-core)](https://search.maven.org/artifact/io.github.copper-leaf/ballast-core)\n[![Intellij Plugin Version](https://img.shields.io/jetbrains/plugin/v/18702-ballast)](https://plugins.jetbrains.com/plugin/18702-ballast)\n\n```kotlin\nobject TodosContract { \n    data class State(\n        val loading: Boolean = false, \n        val todos: List\u003cString\u003e = emptyList(), \n    )\n  \n    sealed interface Inputs {\n        data object FetchSavedTodos : Inputs\n        data class AddTodo(val text: String) : Inputs\n        data class RemoveTodo(val text: String) : Inputs\n    }\n}\n\nclass TodosInputHandler : InputHandler\u003cInputs, Events, State\u003e {\n    override suspend fun InputHandlerScope\u003cInputs, Events, State\u003e.handleInput(\n        input: TodosContract.Inputs\n    ) = when (input) {\n        is FetchSavedTodos -\u003e { \n            updateState { it.copy(loading = true) }\n            val todos = todosApi.fetchTodos()\n            updateState { it.copy(loading = false, todos = todos) }\n        }\n        is AddTodo -\u003e {\n            updateState { it.copy(todos = it.todos + input.text) }\n        }\n        is RemoveTodo -\u003e {\n            updateState { it.copy(todos = it.todos - input.text) }\n        }\n    }\n}\n\n@Composable\nfun App() { \n    val coroutineScope = rememberCoroutineScope()\n    val vm = remember(coroutineScope) { TodosViewModel(coroutineScope) }\n    val vmState by vm.observeStates().collectAsState()\n    \n    LaunchedEffect(vm) { \n        vm.send(TodosContract.FetchSavedTodos)\n    }\n    \n    TodosList(vmState) { vm.trySend(it) }\n}\n\n@Composable\nfun TodosList(\n    vmState: TodosContract.State,\n    postInput: (TodosContract.Inputs)-\u003eUnit,\n) {\n    // ...\n}\n```\n\n* _This snippet omits some details for brevity, to demonstrate the general idea_\n\n# Supported Platforms/Features\n\nBallast was intentionally designed to not be tied directly to any particular platform or UI toolkit. In fact, while most\nKotlin MVI libraries were initially developed for Android and show many artifacts of that initial base, Ballast started\nas a State Management solution for Compose Desktop.\n\nBecause Ballast was initially designed entirely in a non-Android context, it should work in any Kotlin target or\nplatform as long as it works with Coroutines and Flows. However, the following targets are officially supported, in\nthat they have been tested and are known to work there, or have specific features for that platform\n\n- [Android](https://copper-leaf.github.io/ballast/wiki/platforms/android)\n- [iOS](https://copper-leaf.github.io/ballast/wiki/platforms/ios)\n- [WasmJS](https://copper-leaf.github.io/ballast/wiki/platforms/wasmjs)\n- [Compose](https://copper-leaf.github.io/ballast/wiki/platforms/compose)\n- [KVision](https://copper-leaf.github.io/ballast/wiki/platforms/kvision)\n\n# Installation\n\n```kotlin\nrepositories {\n    mavenCentral()\n  \n    // SNAPSHOT builds are available as well at the MavenCentral Snapshots repository\n    maven(url = \"https://s01.oss.sonatype.org/content/repositories/snapshots\")\n}\n\n// for plain JVM or Android projects\ndependencies {\n    implementation(\"io.github.copper-leaf:ballast-core:{{site.version}}\")\n    \n    implementation(\"io.github.copper-leaf:ballast-repository:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-saved-state:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-sync:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-undo:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-navigation:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-schedules:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-crash-reporting:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-analytics:{{site.version}}\")\n    implementation(\"io.github.copper-leaf:ballast-debugger-client:{{site.version}}\")\n    \n    testImplementation(\"io.github.copper-leaf:ballast-test:{{site.version}}\")\n}\n\n// for multiplatform projects\nkotlin {\n    sourceSets {\n        val commonMain by getting {\n            dependencies {\n                implementation(\"io.github.copper-leaf:ballast-core:{{site.version}}\")\n\n                implementation(\"io.github.copper-leaf:ballast-repository:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-saved-state:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-sync:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-undo:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-navigation:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-schedules:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-crash-reporting:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-analytics:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-debugger-client:{{site.version}}\")=\n            }\n        }\n        val commonTest by getting {\n            dependencies {\n                implementation(\"io.github.copper-leaf:ballast-test:{{site.version}}\")\n            }\n        }\n        val androidMain by getting {\n            dependencies {\n                implementation(\"io.github.copper-leaf:ballast-firebase-crashlytics:{{site.version}}\")\n                implementation(\"io.github.copper-leaf:ballast-firebase-analytics:{{site.version}}\")\n            }\n        }\n    }\n}\n```\n\n# Documentation\n\nSee the [website](https://copper-leaf.github.io/ballast/) for detailed documentation and usage instructions.\n\n# Community Chat\n\nJoin us at https://kotlinlang.slack.com in the `#ballast` channel for support, or to show off what you're building with Ballast!\n\nhttps://kotlinlang.slack.com/archives/C03GTEJ9Y3E\n\n# License\n\nBallast is licensed under the BSD 3-Clause License, see [LICENSE.md](https://github.com/copper-leaf/ballast/tree/main/LICENSE.md).\n\n# References\n\nBallast is not new, it was built upon years of experience building UI applications in Android and observing the\ndirection UI programming has gone in the past few years. The MVI model has proven itself to be robust to a wide array\nof applications, and there are different implementations of the pattern that focus on different aspects of the pattern.\n\nThe following are some of the main libraries I drew inspiration from while using Ballast. If Ballast does not fit your\nproject's needs, maybe one of these will suit you better. See the [feature comparison][4] for a better breakdown of the\nspecific features of these libraries, to demonstrate the similarities and differences between them.\n\n- [Redux][1]: The OG of the MVI programming model. It also was not the first MVI library, but React+Redux has certainly\n  been one of the biggest contributors to this pattern's popularity today, especially in JS, but also in many other\n  tech spaces\n- [Orbit MVI][2]: A primary source of inspiration for Ballast. This library is mature and well-built, but in my opinion\n  was built a little too closely to Android, making it less useful on other KMP targets. It also uses terminology from\n  Redux like \"reducer\" and \"transformer\" that are intended to bridge the gap from users familiar with Redux, but are\n  a bit confusing for developers new to MVI. It is also missing some key features that one would expect from an MVI\n  library, like a graphical debugger.\n- [How to write your own MVI system and why you shouldn't][3]: An intro video to the [Orbit MVI][2] library, and one of\n  the best introductions to the MVI model I've seen. By walking you through the thought process behind developing a\n  simple MVI library, it reinforces the concepts of the pattern and helps you understand how to use a mature MVI library\n  like Orbit or Ballast.\n\n\n[1]: https://github.com/reduxjs/redux\n[2]: https://github.com/orbit-mvi/orbit-mvi\n[3]: https://www.youtube.com/watch?v=E6obYmkkdko\n[4]: https://copper-leaf.github.io/ballast/wiki/feature-comparison/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopper-leaf%2Fballast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopper-leaf%2Fballast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopper-leaf%2Fballast/lists"}