Koin

Pragmatic, lightweight dependency injection framework for Kotlin. Unlike Hilt/Dagger, Koin uses runtime resolution (not compile-time code generation) via a simple DSL: module { single { MyService() } factory { MyRepo() } }. Supports Android (ViewModel injection, Fragment, Activity), Ktor server, and Kotlin Multiplatform. Koin 3.5+ adds KSP-based compile-time verification as optional. Favored for simplicity over Hilt's annotation-heavy approach.

Evaluated Mar 06, 2026 (0d ago) v3.5+
Homepage ↗ Repo ↗ Developer Tools kotlin dependency-injection di android multiplatform ksp pragmatic
⚙ Agent Friendliness
66
/ 100
Can an agent use this?
🔒 Security
85
/ 100
Is it safe for agents?
⚡ Reliability
83
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
80
Auth Simplicity
95
Rate Limits
95

🔒 Security

TLS Enforcement
90
Auth Strength
85
Scope Granularity
82
Dep. Hygiene
85
Secret Handling
85

DI framework — no direct security surface. No network calls. Enables clean separation of auth credential injection.

⚡ Reliability

Uptime/SLA
88
Version Stability
83
Breaking Changes
78
Error Recovery
82
AF Security Reliability

Best When

You want pragmatic, readable DI without code generation complexity — Koin's DSL is readable and setup is fast, making it great for prototyping and smaller apps.

Avoid When

You need strict compile-time DI validation on a large Android codebase — Hilt provides better build-time safety guarantees for large projects.

Use Cases

  • Wire Android/Kotlin agent dependencies with a readable DSL without kapt/KSP code generation overhead
  • Inject ViewModels and repositories in Android agent apps using koinViewModel() and get() extension functions
  • Use Koin with Ktor server for server-side Kotlin dependency injection in agent API backends
  • Test agent components with Koin's checkModules() verification to catch missing bindings before runtime
  • Use Koin Multiplatform for shared DI configuration across Android and iOS agent targets in KMP projects

Not For

  • Applications where compile-time DI safety is critical — Hilt/Dagger catch errors at build time; Koin catches them at runtime (unless using KSP verification)
  • Large enterprise Android apps with strict performance requirements — Koin's runtime resolution has more startup overhead than Dagger's generated code
  • Teams that prefer annotation-based DI — Hilt's @Inject and @Provides annotations are more familiar to teams coming from Spring or Dagger

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

DI framework — no authentication. Auth credentials injected as dependencies.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Community-maintained open source library. Apache 2.0 license.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Koin's runtime resolution means missing bindings throw NoBeanDefFoundException at runtime, not compile time — always run checkModules() in tests to catch missing bindings early
  • ViewModel injection in Compose requires koin-androidx-compose — using the wrong artifact (koin-android vs koin-androidx-compose) causes different injection APIs that are incompatible
  • Koin modules are global by default — declaring the same binding in multiple modules without override = true causes DuplicateDefinitionException on Koin startup
  • Scope management in Koin requires explicit scope creation and closing — if you create a scope (e.g., session scope) and don't close it, it leaks until application scope ends
  • koinViewModel() in Compose works differently from viewModel() — it uses Koin's scope not Jetpack's ViewModelProvider; mixing both causes duplicate ViewModel instances
  • Koin 3.x changed module creation DSL from applicationContext to module — code examples from Koin 2.x are not compatible and will cause compilation errors

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Koin.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered