kosi-libs/Kodein

Painless Kotlin Dependency Injection

Kotlin

3,334

659 commits

updated Oct 11, 2026

See the code

README

Maven Central Kotlin Github Actions MIT License Slack channel

KOtlin DEpendency INjection

KODEIN is a straightforward and yet very useful dependency retrieval container. it is effortless to use and configure.

KODEIN works on all Kotlin Multiplatform targets:

  • JVM / Android.
  • all Native platforms (iOS, macOS, Linux, Windows, WebAssembly).
  • Javascript / WasmJs.

KODEIN allows you to:

  • Lazily instantiate your dependencies when needed
  • Stop caring about dependency initialization order
  • Bind classes or interfaces to their instance or provider
  • Debug your dependency bindings and recursions

KODEIN provides extensions to be integrable into:

An example is always better than a thousand words:

val di = DI {
    bindProvider<Dice> { RandomDice(0, 5) }
    bindSingleton<DataSource> { SqliteDS.open("path/to/file") }
}

class Controller(private di: DI) {
    private val ds: DataSource by di.instance()
}

KODEIN is a good choice because:

  • It proposes a very simple and readable declarative DSL
  • It is not subject to type erasure (as Java is)
  • It integrates nicely with Android
  • It proposes a very kotlin-esque idiomatic API
  • It is fast and optimized (makes extensive use of inline)

Installation

Kodein is available on Maven Central.

repositories {
    mavenCentral()
}
kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation("org.kodein.di:kodein-di:{version}")
            }
        }
    }
}

KODEIN 7+ is the current major version, but documentation is available for previous versions.

Kodein documentation

Kotlin & JVM compatibility

KodeinKotlinJDK
7.272.2.+min 17
7.262.1.+min 17
7.232.0.+min 17
7.222.0.+min 11
7.211.9.+min 1.8
7.201.8.10min 1.8
7.191.8.10min 1.8
7.181.8.0min 1.8
7.171.8.0min 1.8

Full table can be found here

Support

Support is held in the Kodein Slack channel (you can get an invitation to the Kotlin Slack here).

If you are using KODEIN, please let us know!

Supported by

JetBrains logo.

android
compose
compose-desktop
injection
kodein
kodein-di
kodein-framework
kotlin
kotlin-dependency-injection
kotlin-multiplatform
ktor
tornadofx

kosi-libs/Kodein

Painless Kotlin Dependency Injection

Kotlin

3,334

659 commits

updated Oct 11, 2026

See the code

README

Maven Central Kotlin Github Actions MIT License Slack channel

KOtlin DEpendency INjection

KODEIN is a straightforward and yet very useful dependency retrieval container. it is effortless to use and configure.

KODEIN works on all Kotlin Multiplatform targets:

  • JVM / Android.
  • all Native platforms (iOS, macOS, Linux, Windows, WebAssembly).
  • Javascript / WasmJs.

KODEIN allows you to:

  • Lazily instantiate your dependencies when needed
  • Stop caring about dependency initialization order
  • Bind classes or interfaces to their instance or provider
  • Debug your dependency bindings and recursions

KODEIN provides extensions to be integrable into:

An example is always better than a thousand words:

val di = DI {
    bindProvider<Dice> { RandomDice(0, 5) }
    bindSingleton<DataSource> { SqliteDS.open("path/to/file") }
}

class Controller(private di: DI) {
    private val ds: DataSource by di.instance()
}

KODEIN is a good choice because:

  • It proposes a very simple and readable declarative DSL
  • It is not subject to type erasure (as Java is)
  • It integrates nicely with Android
  • It proposes a very kotlin-esque idiomatic API
  • It is fast and optimized (makes extensive use of inline)

Installation

Kodein is available on Maven Central.

repositories {
    mavenCentral()
}
kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation("org.kodein.di:kodein-di:{version}")
            }
        }
    }
}

KODEIN 7+ is the current major version, but documentation is available for previous versions.

Kodein documentation

Kotlin & JVM compatibility

KodeinKotlinJDK
7.272.2.+min 17
7.262.1.+min 17
7.232.0.+min 17
7.222.0.+min 11
7.211.9.+min 1.8
7.201.8.10min 1.8
7.191.8.10min 1.8
7.181.8.0min 1.8
7.171.8.0min 1.8

Full table can be found here

Support

Support is held in the Kodein Slack channel (you can get an invitation to the Kotlin Slack here).

If you are using KODEIN, please let us know!

Supported by

JetBrains logo.

android
compose
compose-desktop
injection
kodein
kodein-di
kodein-framework
kotlin
kotlin-dependency-injection
kotlin-multiplatform
ktor
tornadofx

Significant stargazers

Dennis Ameling

151 followers · starred Aug 2022

Sebastian Sellmair

303 followers · starred Jul 2018

YKK

129 followers · starred Feb 2026

Ronnie Magatti

76 followers · starred Jun 2017