di

Installation
SKILL.md

Dependency injection

Ktor's own, and nothing else

Ktor has a DI plugin. Use it. No Koin, no Dagger, no service locator, no object singletons holding state.

The reason is not novelty — it is that the graph is the one thing -app exists to own. A third-party container adds annotations to classes in -core and -adapters that only the container understands, which is precisely the framework coupling those modules are structured to avoid. With Ktor's DI, a repository is a class with a constructor, and the only file that knows how it is built is the one whose job that is.

Register

// -app/config/Dependencies.kt
internal fun Application.registerBookDependencies() {
    dependencies {
        provide<BookRepository> { ExposedBookRepository(resolve()) }
        provide<SearchIndexPort> { OpenSearchIndexAdapter(resolve(), resolve()) }
Installs
11
First Seen
Aug 7, 2026
di — joaoseidel/ktor-toolkit