🚇 Metro
A compile-time dependency injection framework for Kotlin Multiplatform, powered by a Kotlin compiler plugin.

What is Metro?
Metro is a compile-time dependency injection framework that combines the best of Dagger, Anvil, and kotlin-inject into one cohesive solution.
Key Features:
Quick Start
1. Apply the Gradle plugin:
plugins {
id("dev.zacsweers.metro") version "<version>"
}
2. Define a dependency graph:
@DependencyGraph
interface AppGraph {
val repository: UserRepository
@Provides
fun provideApi(): Api = ApiImpl()
}
@Inject
class UserRepository(private val api: Api)
3. Create and use the graph:
val graph = createGraph<AppGraph>()
val repository = graph.repository
Documentation
📚 zacsweers.github.io/metro
Supported Platforms
Metro supports JVM, Android, JS, Wasm, and Native targets. The compiler plugin works with all Kotlin Multiplatform project types.
See the multiplatform docs for full details.
License
Copyright (C) 2025 Zac Sweers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance the License.
You may obtain a copy of the License at
https:
Unless applicable law agreed to writing, software
distributed under the License distributed an BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
See the License the specific language governing permissions
limitations under the License.