{"id":15031051,"url":"https://github.com/arkivanov/decompose","last_synced_at":"2025-12-27T23:38:34.168Z","repository":{"id":37014387,"uuid":"437015897","full_name":"arkivanov/Decompose","owner":"arkivanov","description":"Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing (navigation) and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.)","archived":false,"fork":false,"pushed_at":"2025-04-23T07:07:12.000Z","size":219131,"stargazers_count":2468,"open_issues_count":5,"forks_count":85,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-28T12:06:40.905Z","etag":null,"topics":["android","kotlin","kotlin-multiplatform","multiplatform","navigation"],"latest_commit_sha":null,"homepage":"https://arkivanov.github.io/Decompose","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/arkivanov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"arkivanov","custom":["https://www.buymeacoffee.com/arkivanov","https://btc.com/1DXjn9e6rmbVvac3TH8hG3LdLtoA1CUvsM","https://etherscan.io/address/0xf027f5738f45676a54c15cf7753a0f66553947b9"]}},"created_at":"2021-12-10T14:56:48.000Z","updated_at":"2025-04-28T11:09:36.000Z","dependencies_parsed_at":"2023-10-17T04:21:59.850Z","dependency_job_id":"ad1ebfdb-1347-4c77-843f-289b80abb018","html_url":"https://github.com/arkivanov/Decompose","commit_stats":{"total_commits":929,"total_committers":39,"mean_commits":23.82051282051282,"dds":"0.14208826695371368","last_synced_commit":"6dcca391c7f5bb74970c9ee0482affa7f7aa249f"},"previous_names":[],"tags_count":150,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkivanov%2FDecompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkivanov%2FDecompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkivanov%2FDecompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkivanov%2FDecompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkivanov","download_url":"https://codeload.github.com/arkivanov/Decompose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311330,"owners_count":21569009,"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","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":["android","kotlin","kotlin-multiplatform","multiplatform","navigation"],"created_at":"2024-09-24T20:14:47.941Z","updated_at":"2025-12-27T23:38:34.161Z","avatar_url":"https://github.com/arkivanov.png","language":"Kotlin","funding_links":["https://github.com/sponsors/arkivanov","https://www.buymeacoffee.com/arkivanov","https://btc.com/1DXjn9e6rmbVvac3TH8hG3LdLtoA1CUvsM","https://etherscan.io/address/0xf027f5738f45676a54c15cf7753a0f66553947b9"],"categories":[],"sub_categories":[],"readme":"\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/arkivanov/Decompose/master/docs/media/logo/titled-1.png\"\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/arkivanov/Decompose/master/docs/media/logo/logo-titled-dark.png\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/arkivanov/Decompose/master/docs/media/logo/titled-1.png\" width=\"300\"\u003e\n\u003c/picture\u003e\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n[![Twitter URL](https://img.shields.io/badge/Twitter-@arkann1985-blue.svg?style=social\u0026logo=twitter)](https://twitter.com/arkann1985)\n\n---\n\nDecompose is a Kotlin Multiplatform library for breaking down your code into tree-structured lifecycle-aware business logic components (aka BLoC), with routing functionality and pluggable UI (Jetpack/Multiplatform Compose, Android Views, SwiftUI, Kotlin/React, etc.).\n\nPlease see the [project website](https://arkivanov.github.io/Decompose/) for documentation and APIs. \n\nShould you have any questions or ideas - there is [Discussions](https://github.com/arkivanov/Decompose/discussions) section. Also welcome to the Kotlin Slack channel - [#decompose](https://kotlinlang.slack.com/archives/C03H3N51SKT)! You can also try using [DeepWiki](https://deepwiki.com/arkivanov/Decompose)!\n\n## Why Decompose?\n\n* Decompose breaks the code down into small and independent components and organizes them into trees. Each parent component is only aware of its immediate children.\n* Decompose draws clear boundaries between UI and non-UI code, which gives the following benefits:\n  * Better separation of concerns\n  * Pluggable platform-specific UI (Compose, SwiftUI, Kotlin/React, etc.)\n  * Business logic code is testable with pure multiplatform unit tests\n* Navigation state is fully exposed - plug any UI you want, animate as you like using your favourite UI framework's API or use predefined API.\n* Navigation is a pure function from the old state to a new one - navigate without limits.\n* Proper dependency injection (DI) and inversion of control (IoC) via constructor, including but not limited to type-safe arguments.\n* Shared navigation logic\n* Lifecycle-aware components\n* Components in the back stack are not destroyed, they continue working in background without UI\n* State preservation (automatically on Android, manually on all other targets via `kotlinx-serialization`)\n* Instances retaining (aka ViewModels) over configuration changes (mostly useful in Android)\n\n### Meme time!\n\n\u003cimg src=\"docs/media/DecomposeMeme.png\" width=\"512\"\u003e\n\n## Setup\n\nPlease check the [Installation](https://arkivanov.github.io/Decompose/getting-started/installation/) section of the documentation.\n\n### Supported platforms\n\nIn general, Decompose supports the following targets: `android`, `jvm`, `ios`, `watchos`, `tvos`, `macos`, `wasmJs`, `js`. However, some modules do not support all targets or the support depends on the Decompose version. Please see the installation docs for details.\n\n## Overview\n\nHere are some key concepts of the library, more details can be found in the documentation.\n\n* [Component](https://arkivanov.github.io/Decompose/component/overview/) - every component represents a piece of logic with its own lifecycle, the UI is optional and is plugged externally\n* [ComponentContext](https://arkivanov.github.io/Decompose/component/overview/#componentcontext) - every component has its own [ComponentContext], which makes components lifecycle-aware and allows state preservation, instances retaining (aka AndroidX `ViewModel`) and back button handling\n* [Child Stack](https://arkivanov.github.io/Decompose/navigation/stack/overview/) - enables navigation between child components, nested navigation is also supported\n* [Child Slot](https://arkivanov.github.io/Decompose/navigation/slot/overview/) - allows only one child component at a time, or none\n* [Child Pages](https://arkivanov.github.io/Decompose/navigation/pages/overview/) - a list of child components with one selected component (e.g. pager-like navigation)\n* [Child Panels](https://arkivanov.github.io/Decompose/navigation/panels/overview/) - a multi-pane navigation \n* [Generic Navigation](https://arkivanov.github.io/Decompose/navigation/children/overview/) - provides a way to create your own custom navigation model, when none of the predefined models fit your needs\n* [Lifecycle](https://arkivanov.github.io/Decompose/component/lifecycle/) - provides a way to listen for lifecycle events in components\n* [StateKeeper](https://arkivanov.github.io/Decompose/component/state-preservation/) - makes it possible to preserve state or data in a component when it gets destroyed\n* [InstanceKeeper](https://arkivanov.github.io/Decompose/component/instance-retaining/) - retains instances in your components (similar to AndroidX `ViewModel`)\n* [BackPressedHandler](https://arkivanov.github.io/Decompose/component/back-button/) - provides a way to handle and intercept back button presses\n\n### Decompose is a library\n\nDecompose is a library that can be used as a framework. In its core, Decompose just manipulates instances of `ComponentContext` with strict parent-child relationship, which is also called \"navigation\". The possibility of creating custom implementations of the `ComponentContext` interface allows adding custom properties and functions, as well as storing additional data in each instance of `ComponentContext`. This makes it a very powerful tool with various use cases.\n\nThe \"component\" term is just one of the possible usages, the recommended one. The [Decompose-Router](https://github.com/xxfast/Decompose-Router) library is a great example of leveraging Decompose to create a custom navigation solution with a completely different API.\n\n### Component hierarchy\n\n\u003cimg src=\"docs/media/ComponentHierarchy.png\" width=\"512\"\u003e\n\n### Pluggable UI hierarchy\n\n\u003cimg src=\"docs/media/PluggableUiHierarchy.png\" width=\"512\"\u003e\n\n### Typical component structure\n\n\u003cimg src=\"docs/media/ComponentStructure.png\" width=\"512\"\u003e\n\n## Quick start\n\nPlease refer to the [Quick start](https://arkivanov.github.io/Decompose/getting-started/quick-start/) section of the docs.\n\n## Samples\n\nCheck out the [Samples](https://arkivanov.github.io/Decompose/samples/) section of the docs for a full description of each sample.\n\n## Template\n\nCheck out the [template repository](https://github.com/arkivanov/decompose-multiplatform-template) which may be used to kick-start a project for you.\n\n## \"Used by\" list\n\nCheckout a voluntary list of projects/companies using Decompose: https://github.com/arkivanov/Decompose/discussions/366. Feel free to add your project!\n\n## Articles\n\n- [Decompose — experiments with Kotlin Multiplatform lifecycle-aware components and navigation](https://proandroiddev.com/decompose-experiments-with-kotlin-multiplatform-lifecycle-aware-components-and-navigation-a04ef3c7f6a3?source=friends_link\u0026sk=f7d289cc329b6c8a765fc049e36c313f)\n- [Fully cross-platform Kotlin applications (almost)](https://proandroiddev.com/fully-cross-platform-kotlin-applications-almost-29c7054f8f28?source=friends_link\u0026sk=4619fdcb17912fde589bc4fca83efbbd)\n- [A comprehensive thirty-line navigation for Jetpack/Multiplatform Compose](https://medium.com/p/5b723c4f256e) - if you find Decompose verbose and would prefer something built on top of Compose.\n\n- \"Component-based Approach\" series by [Artur Artikov](https://twitter.com/artik_artikov)\n  - Part 1: [Fighting Complexity in Android Applications](https://medium.com/@a.artikov/component-based-approach-fighting-complexity-in-android-applications-2eaf5e8c5fad)\n  - Part 2: [Implementing Screens with the Decompose Library](https://medium.com/@a.artikov/component-based-approach-implementing-screens-with-the-decompose-library-19c41d8ed087)\n\n## Author\n\nTwitter: [@arkann1985](https://twitter.com/arkann1985)\n\nIf you like this project you can always \u003ca href=\"https://www.buymeacoffee.com/arkivanov\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" height=32\u003e\u003c/a\u003e ;-)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkivanov%2Fdecompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkivanov%2Fdecompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkivanov%2Fdecompose/lists"}