talira

Pragmatic dependency injection for Kotlin and Kotlin Multiplatform

open sourceApache-2.0free

Koin is a dependency injection framework for Kotlin and Kotlin Multiplatform, from Android apps and Compose Multiplatform to Ktor backends. You declare modules in a small Kotlin DSL (or with annotations and a compiler plugin), start Koin and inject dependencies, with support for Android ViewModels, Jetpack Compose and JUnit tests. It is developed by Kotzilla and open source contributors under the Apache 2.0 licence.

Problems it solves

  • dependency injection for my Kotlin Multiplatform app
  • a lighter alternative to Dagger for an Android app in Kotlin
  • inject dependencies into a Ktor server without code generation

Features

  • Kotlin DSL for modules
  • annotations and a compiler plugin
  • Android, Compose, Kotlin Multiplatform and Ktor support
  • testing helpers for JUnit

Alternatives

The same job

These do what Koin does.

  1. Dagger A fast dependency injector for Android and Java
  2. Guice Google's lightweight dependency injection framework for Java

Compare Koin with the top 3