{"id":13407063,"url":"https://github.com/kosi-libs/Kodein","last_synced_at":"2025-03-14T11:30:59.195Z","repository":{"id":30492090,"uuid":"34046231","full_name":"kosi-libs/Kodein","owner":"kosi-libs","description":"Painless Kotlin Dependency Injection","archived":false,"fork":false,"pushed_at":"2024-10-02T04:44:07.000Z","size":5852,"stargazers_count":3203,"open_issues_count":6,"forks_count":174,"subscribers_count":50,"default_branch":"master","last_synced_at":"2024-10-29T15:03:14.304Z","etag":null,"topics":["android","compose","compose-desktop","injection","kodein","kodein-di","kodein-framework","kotlin","kotlin-dependency-injection","kotlin-multiplatform","ktor","tornadofx"],"latest_commit_sha":null,"homepage":"https://kosi-libs.org/kodein","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kosi-libs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2015-04-16T09:19:43.000Z","updated_at":"2024-10-29T12:33:24.000Z","dependencies_parsed_at":"2023-11-30T20:28:22.310Z","dependency_job_id":"d7eacb65-856d-4535-88ee-effbcc6b6b51","html_url":"https://github.com/kosi-libs/Kodein","commit_stats":{"total_commits":927,"total_committers":55,"mean_commits":"16.854545454545455","dds":0.6256742179072277,"last_synced_commit":"573b264a3f6f5f7145583081efc318c4303fc4d2"},"previous_names":["kodein-framework/kodein-di"],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosi-libs%2FKodein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosi-libs%2FKodein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosi-libs%2FKodein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kosi-libs%2FKodein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kosi-libs","download_url":"https://codeload.github.com/kosi-libs/Kodein/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324264,"owners_count":20273098,"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","compose","compose-desktop","injection","kodein","kodein-di","kodein-framework","kotlin","kotlin-dependency-injection","kotlin-multiplatform","ktor","tornadofx"],"created_at":"2024-07-30T20:00:18.945Z","updated_at":"2025-03-14T11:30:58.087Z","avatar_url":"https://github.com/kosi-libs.png","language":"Kotlin","funding_links":[],"categories":["Kotlin","Ktor Projects","Libraries","IoC"],"sub_categories":["Socials","💉 Dependency Injection"],"readme":"[![Maven Central](https://img.shields.io/maven-central/v/org.kodein.di/kodein-di)](https://mvnrepository.com/artifact/org.kodein.di/kodein-di)\n[![Kotlin](https://img.shields.io/badge/Kotlin-1.9.21-blue.svg?style=flat\u0026logo=kotlin)](https://kotlinlang.org)\n![Github Actions](https://github.com/kosi-libs/Kodein/actions/workflows/snapshot.yml/badge.svg)\n[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/kosi-libs/Kodein/blob/master/LICENSE.txt)\n[![Slack channel](https://img.shields.io/badge/Chat-Slack-green.svg?style=flat\u0026logo=slack)](https://kotlinlang.slack.com/messages/kodein/)\n\nKOtlin DEpendency INjection\n===========================\n\n**_KODEIN_** is a straightforward and yet very useful dependency retrieval container. it is effortless to use and configure.\n\n**_KODEIN_** works on all Kotlin Multiplatform targets:\n\n- JVM / Android.\n- all Native platforms (iOS, macOS, Linux, Windows, WebAssembly).\n- Javascript / WasmJs.\n\n**_KODEIN_** allows you to:\n\n- Lazily instantiate your dependencies when needed\n- Stop caring about dependency initialization order\n- Bind classes or interfaces to their instance or provider\n- Debug your dependency bindings and recursions\n\n**_KODEIN_** provides extensions to be integrable into:\n\n- [Android](https://developer.android.com/)\n- [Compose (Android / Desktop / Web)](https://kosi-libs.org/kodein/7.22/framework/compose.html)\n- [Ktor](https://ktor.io/)\n\nAn example is always better than a thousand words:\n\n```kotlin\nval di = DI {\n    bindProvider\u003cDice\u003e { RandomDice(0, 5) }\n    bindSingleton\u003cDataSource\u003e { SqliteDS.open(\"path/to/file\") }\n}\n\nclass Controller(private di: DI) {\n    private val ds: DataSource by di.instance()\n}\n```\n\n**_KODEIN_** is a good choice because:\n\n- It proposes a very simple and readable declarative DSL\n- It is not subject to type erasure (as Java is)\n- It integrates nicely with Android\n- It proposes a very kotlin-esque idiomatic API\n- It is fast and optimized (makes extensive use of `inline`)\n\nInstallation\n---------\n\nKodein is available on Maven Central.\n\n```kotlin\nrepositories {\n    mavenCentral()\n}\n```\n\n```kotlin\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(\"org.kodein.di:kodein-di:{version}\")\n            }\n        }\n    }\n}\n```\n\n**_KODEIN_** 7+ is the current major version, but documentation is available for previous versions.\n\n**[Kodein documentation](https://kosi-libs.org/kodein/)**\n\n\nKotlin \u0026 JVM compatibility\n---------\n\n|   Kodein    | Kotlin |   JDK   |\n|:-----------:|:------:|:-------:|\n|   7.21.+    | 1.9.+  | min 1.8 |\n|   7.20.1    | 1.8.10 | min 1.8 |\n|   7.19.0    | 1.8.10 | min 1.8 |\n|   7.18.0    | 1.8.0  | min 1.8 |\n|   7.17.1    | 1.8.0  | min 1.8 |\n|   7.17.0    | 1.8.0  | min 1.8 |\n\n\u003e Full table can be found [here](https://kosi-libs.org/kodein/7.22/core/platform-and-genericity.html)\n\nSupport\n-------\n\nSupport is held in the [Kodein Slack channel](https://kotlinlang.slack.com/messages/kodein/)\n(you can get an invitation to the Kotlin Slack [here](https://slack.kotlinlang.org/)).\n\n[//]: # (Testimonies)\n\n[//]: # (-----------)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e At [Collokia]\u0026#40;https://www.collokia.com/\u0026#41; we use Kodein in all of our backend service infrastructure and all modules in those services are loosely coupled through injection with Kodein.)\n\n[//]: # (\u003e It allows us to have nice module independence, and to opt-out of injection during testing or build separate modules in support of testing.  )\n\n[//]: # (\u003e It is a key component and building block in our architecture.  )\n\n[//]: # (\u003e -- [Jayson Minard]\u0026#40;https://github.com/apatrida\u0026#41;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e At [Moovel Group GmbH]\u0026#40;https://www.moovel.com/de/en\u0026#41;, we have successfully used the wonderful Kodein library into in [this Android app]\u0026#40;https://play.google.com/store/apps/details?id=com.daimler.moovel.android\u0026#41;.)\n\n[//]: # (\u003e As we improved it, we found Kodein to be much more useful than Dagger2 as it simplified our code throughout.  )\n\n[//]: # (\u003e Kodein is in my view, much easier to understand, doesn't have that nasty ceremony, and has really nice debug messages.  )\n\n[//]: # (\u003e We are also working now on other projects where we are using Kodein as well.  )\n\n[//]: # (\u003e -- [Sorin Albu-Irimies]\u0026#40;https://github.com/sorinirimies\u0026#41;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e Kodein has been instrumental in moving our entire production application to Kotlin at [InSite Applications]\u0026#40;https://insiteapplications.com\u0026#41;. It uses standard Kotlin idioms and features for ultimate clarity and simplicity. It was clear to us from the beginning that Kodein would be our DI solution. Our devs love it so much that they've transitioned to using it in their personal apps, both Java and Kotlin!  )\n\n[//]: # (\u003e -- [Eliezer Graber]\u0026#40;https://github.com/eygraber\u0026#41;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e At [Compsoft Creative]\u0026#40;https://www.compsoft.co.uk\u0026#41;, Kodein is central our new Kotlin based app architecture, giving us a solid underpinning to all apps we develop and allowing a simple yet powerful way to de-couple our services with a library that is lightweight and perfect for mobile apps.  )\n\n[//]: # (\u003e -- [Daniel Payne]\u0026#40;https://github.com/CompsoftCreative\u0026#41;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e Kodein is used in [the android app of the OhelShem school]\u0026#40;https://github.com/OhelShem/android\u0026#41;.  )\n\n[//]: # (\u003e -- [Yoav Sternberg]\u0026#40;https://github.com/yoavst\u0026#41;\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\n[//]: # ()\n[//]: # (\u003e Kodein was created at [Dental Monitoring]\u0026#40;https://dental-monitoring.com/\u0026#41; with the opinion that Dagger2 is way too verbose and complex.)\n\n[//]: # (\u003e It is now used in almost all our projects: the server, the internal production software \u0026 the Android application.  )\n\n[//]: # (\u003e Kodein is very easy to use and set up: it allows our team to easily share code and patterns, as well as quickly bootstrapping new ideas.  )\n\n[//]: # (\u003e -- [Salomon Brys]\u0026#40;https://github.com/SalomonBrys\u0026#41;)\n\n[//]: # ()\n[//]: # (\u0026nbsp;)\n\nIf you are using KODEIN, please [let us know](mailto:contact@kodein.net)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosi-libs%2FKodein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkosi-libs%2FKodein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosi-libs%2FKodein/lists"}