# Metro DI for Ktor Backend: From a God Object through manual DI to Constructor Injection

DevFeed: [Metro DI for Ktor Backend: From a God Object through manual DI to Constructor Injection](<https://devfeed.tech/articles/metro-di-for-ktor-backend-from-a-god-object-through-manual-di-to-constructor-injection-22966.md>)

Original publisher: [Read original article](<https://funkymuse.github.io/posts/metro-di-ktor-server/>)

Author: FunkyMuse

Published: 2026-05-15T15:35:00Z

Content type: tutorial

Language: en

Sources: [FunkyMuse](<https://devfeed.tech/sources/funkymuse.md>)

Topics: [Ktor](<https://devfeed.tech/topics/ktor.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [modules](<https://devfeed.tech/topics/modules.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [di](<https://devfeed.tech/tags/di.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [redis](<https://devfeed.tech/tags/redis.md>), [server](<https://devfeed.tech/tags/server.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>)

## AI overview

This article describes replacing manual dependency injection in a Ktor backend with Metro. It explains how default constructor parameters and a central BackendComponent can accidentally couple tests to real dependencies such as Redis, while Metro wires constructor parameters at compile time and removes those defaults.

## Source excerpt

The Starting Point: a God Object When Rudio was a created a few months ago it used the simplest possible DI: one big object BackendComponent with everything wired manually via by lazy and lateinit var. No framework, no annotations, no ceremony, then i started adding things and manual DI became a tedious and tiring task because everywhere i used default parameters to achieve default constructor...