by InsertKoinIO

InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin

6.1K Stars 408 Forks Last release: Not found Apache License 2.0 1.7K Commits 50 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


What is KOIN? - https://insert-koin.io

A pragmatic lightweight dependency injection framework for Kotlin developers.

Written in pure Kotlin, using functional resolution only: no proxy, no code generation, no reflection.

Koin is a DSL, a light container and a pragmatic API

Latest News ๐ŸŒ

Documentation ๐Ÿš’

Ask a Question? ๐Ÿš‘

Reporting issues ๐Ÿ’ฅ

Found a bug on a specific feature? Open an issue on Github issues

Contribute ๐Ÿ› 

Want to help or share a proposal about Koin? problem on a specific feature?

  • Open an issue to explain the issue you want to solve Open an issue
  • Come talk on slack #koin-dev channel
  • After discussion to validate your ideas, you can open a PR or even a draft PR if the contribution is a big one Current PRs

Additional readings about basic setup: https://github.com/InsertKoinIO/koin/blob/master/CONTRIBUTING.adoc


Current Version

// latest stable
koin_version = '2.2.0-rc-3'



Check that you have the

// Add Jcenter to your repositories if needed
repositories {


Pick one of your Koin dependency:

Gradle Plugin

buildscript {
    repositories {
    dependencies {
        classpath "org.koin:koin-gradle-plugin:$koin_version"

apply plugin: 'koin'

Core features

// Koin for Kotlin
implementation "org.koin:koin-core:$koin_version"
// Koin extended & experimental features
implementation "org.koin:koin-core-ext:$koin_version"
// Koin for Unit tests
testImplementation "org.koin:koin-test:$koin_version"
// Koin for Java developers is now part of core
// implementation "org.koin:koin-java:$koin_version"


// Koin for Android
implementation "org.koin:koin-android:$koin_version"
// Koin Android Scope features
implementation "org.koin:koin-android-scope:$koin_version"
// Koin Android ViewModel features
implementation "org.koin:koin-android-viewmodel:$koin_version"
// Koin Android Experimental features
implementation "org.koin:koin-android-ext:$koin_version"


// Koin AndroidX Scope features
implementation "org.koin:koin-androidx-scope:$koin_version"
// Koin AndroidX ViewModel features
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
// Koin AndroidX Fragment features
implementation "org.koin:koin-androidx-fragment:$koin_version"
// Koin AndroidX WorkManager
implementation "org.koin:koin-androidx-workmanager:$koin_version"
// Koin AndroidX Jetpack Compose
implementation "org.koin:koin-androidx-compose:$koin_version"
// Koin AndroidX Experimental features
implementation "org.koin:koin-androidx-ext:$koin_version"


// Koin for Ktor Kotlin
implementation "org.koin:koin-ktor:$koin_version"


Declare a Koin module

Write with the Koin DSL what you need to assemble:

// Given some classes 
class Controller(val service : BusinessService) 
class BusinessService() 

// just declare it val myModule = module { single { Controller(get()) } single { BusinessService() } }

Starting Koin

Use the startKoin() function to start Koin in your application.

In a Kotlin app:

fun main(vararg args : String) { 
  // start Koin!
  startKoin {
    // your modules

In an Android app:

class MyApplication : Application() {
  override fun onCreate(){
    // start Koin!
    startKoin {
      // Android context
      androidContext([email protected])
      // modules

Talking about Koin


Videos & Podcasts

Koin Developers Hub


This project exists thanks to all the people who contribute. [Contribute].


Backers on Open Collective Sponsors on Open Collective


Thank you to all our backers! ๐Ÿ™ [Become a backer]


Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.