{"id":36416907,"url":"https://github.com/floschu/store","last_synced_at":"2026-01-23T12:57:18.671Z","repository":{"id":307979065,"uuid":"420541571","full_name":"floschu/store","owner":"floschu","description":"🔁 opinionated kmp library to manage state","archived":false,"fork":false,"pushed_at":"2025-11-22T13:00:29.000Z","size":756,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T18:31:12.336Z","etag":null,"topics":["coroutines","kmp","kotlin","library","multiplatform","store"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floschu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-10-23T23:04:20.000Z","updated_at":"2025-11-22T13:00:33.000Z","dependencies_parsed_at":"2026-01-11T17:00:03.295Z","dependency_job_id":null,"html_url":"https://github.com/floschu/store","commit_stats":null,"previous_names":["floschu/store"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/floschu/store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floschu%2Fstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floschu%2Fstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floschu%2Fstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floschu%2Fstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floschu","download_url":"https://codeload.github.com/floschu/store/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floschu%2Fstore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28692487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["coroutines","kmp","kotlin","library","multiplatform","store"],"created_at":"2026-01-11T16:59:58.529Z","updated_at":"2026-01-23T12:57:18.663Z","avatar_url":"https://github.com/floschu.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg alt=\"flow\" width=\"350\" src=\".media/logo.webp\"\u003e\u003c/p\u003e\n\n\u003cp align=center\u003e\n    \u003ca href=\"https://search.maven.org/artifact/at.florianschuster.store/store\"\u003e\u003cimg alt=\"version\" src=\"https://img.shields.io/maven-central/v/at.florianschuster.store/store?label=version\u0026logoColor=1AA2D4\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=center\u003e\n    \u003ca href=\"https://github.com/floschu/store/actions\"\u003e\u003cimg alt=\"build\" src=\"https://github.com/floschu/store/workflows/build/badge.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/floschu/store/\"\u003e\u003cimg alt=\"last commit\" src=\"https://img.shields.io/github/last-commit/floschu/store?logoColor=B75EA4\" /\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg alt=\"license\" src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg?color=7b6fe2\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## installation\n\n``` groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation(\"at.florianschuster.store:store:$version\")\n}\n```\n\nsee [changelog](https://github.com/floschu/store/blob/main/CHANGELOG.md) for versions\n\n## usage\n\nGo to [store](https://github.com/floschu/store/blob/main/lib/src/commonMain/kotlin/at/florianschuster/store/Store.kt) as entry point for more information.\n\n```kotlin\nclass LoginEnvironment(\n    val authenticationService: AuthenticationService,\n    val tokenRepository: TokenRepository,\n)\n\nsealed interface LoginAction {\n    data class EmailChanged(val value: String): LoginAction\n    data class PasswordChanged(val value: String): LoginAction\n    data object Login: LoginAction\n    data class LoginResult(val result: Result\u003cToken\u003e): LoginAction\n}\n\ndata class LoginState(\n    val emailAddress: String = \"\",\n    val password: String = \"\",\n    val loading: Boolean = false,\n    val displayLoginError: Boolean = false,\n) {\n    val isInputValid = emailAddress.isNotEmpty() \u0026\u0026 password.isNotEmpty()\n}\n\nval LoginReducer = Reducer\u003cLoginEnvironment, LoginAction, LoginState\u003e { previousState, action -\u003e\n    when(action) {\n        is LoginAction.EmailChanged -\u003e previousState.copy(emailAddress = action.value)\n        is LoginAction.PasswordChanged -\u003e previousState.copy(password = action.value)\n        is LoginAction.Login -\u003e {\n            if(!previousState.isInputValid) return@Reducer previousState\n            cancelEffect(id = LoginAction.Login) // if an authentication is already in progress, we cancel it\n            effect(id = LoginAction.Login) {\n                val result = environment.authenticationService.authenticate(\n                    previousState.emailAddress,\n                    previousState.password,\n                )\n                dispatch(LoginAction.LoginResult(result))\n            }\n            previousState.copy(\n                loading = true,\n                displayLoginError = false\n            )\n        }\n        is LoginAction.LoginResult -\u003e {\n            action.result.onSuccess { token -\u003e\n                effect(id = LoginAction.LoginResult::class) {\n                    environment.tokenRepository.store(token)\n                }\n            }\n            previousState.copy(\n                loading = false,\n                displayLoginError = action.result.isFailure\n            )\n        }\n    }\n}\n\nclass LoginStore(\n    effectScope: CoroutineScope,\n    environment: LoginEnvironment,\n): Store\u003cLoginEnvironment, LoginAction, LoginState\u003e by Store(\n    initialState = LoginState(),\n    environment = environment,\n    effectScope = effectScope,\n    reducer = LoginReducer,\n)\n```\n\nA more complex [Compose Multiplatform](https://www.jetbrains.com/compose-multiplatform/) example can be found in the [example directory](https://github.com/floschu/store/blob/main/example).\n\n## author\n\nvisit my [website](https://florianschuster.at/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloschu%2Fstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloschu%2Fstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloschu%2Fstore/lists"}