koin
Koin Dependency Injection (Android and KMP)
Pragmatic Kotlin DI — no annotation processor for the Classic DSL, full KMP support, and a verify() check that catches missing bindings at test time. Koin vs Hilt: Koin runs in commonMain (Hilt does not) and verifies the graph via verify() instead of codegen; Hilt is Android-only, validates the graph through codegen, and integrates deeply with Jetpack (@HiltViewModel, hiltViewModel()). Both are first-class. Related: android-skills:kmp-ktor (per-platform engine wired via Koin), android-skills:android-data-layer.
Dependencies (via koin-bom, so artifacts stay version-aligned): koin-core (KMP engine), koin-android (Application/Context), koin-androidx-compose (koinViewModel/koinInject on Android), koin-compose-viewmodel (KMP Compose), koin-compose-viewmodel-navigation (Nav 3), koin-test, and optional koin-annotations + koin-ksp-compiler for KSP.
Module Declarations — Classic DSL
Constructor arguments resolve via get().
val featureModule = module {
single<HttpClient> { createHttpClient(get(), baseUrl = "https://api.example.com/") }
single<UserRepository> { UserRepositoryImpl(get()) }
factory { UserFormValidator() }
viewModel { UserListViewModel(get()) }
viewModel { (id: String) -> UserDetailViewModel(id, get()) } // runtime param
}