Ktor Tutorial #18: Dependency Injection with Koin

As your Ktor application grows, you create more repositories, services, and routes. Without dependency injection, you end up passing objects manually through every function. This makes your code hard to test and hard to change. In this tutorial, you will add Koin to your Ktor application. You will create a service layer, define dependency modules, and inject dependencies into your routes. What is Dependency Injection? Dependency injection (DI) means your classes receive their dependencies from the outside instead of creating them. ...

June 9, 2026 · 9 min

KMP Tutorial #9: Koin — Dependency Injection in Kotlin Multiplatform

In the previous tutorials, we created Ktor clients, SQLDelight databases, and DataStore instances by hand. We passed them manually to repositories, which we passed to ViewModels, which we passed to screens. That works for small apps. But as your app grows, the wiring becomes painful. You need a way to automatically connect everything together. That is what Koin does. It is a lightweight dependency injection framework for Kotlin — and it works perfectly in KMP. ...

April 3, 2026 · 7 min

Jetpack Compose Tutorial #14: Dependency Injection with Hilt

In the previous tutorials, we created databases and ViewModels manually. We wrote DatabaseProvider singletons. We passed dependencies by hand. It worked — but it doesn’t scale. When your app has 10 ViewModels, 5 repositories, 3 data sources, and a database — wiring everything manually becomes a nightmare. One missing connection and your app crashes. Hilt fixes this. You add annotations to your classes, and Hilt connects everything automatically. What is Dependency Injection? Dependency injection (DI) means: instead of a class creating its own dependencies, someone else provides them. ...

March 23, 2026 · 7 min