# ZacSweers/metro

A multiplatform, compile-time dependency injection framework for Kotlin

Repository: https://github.com/ZacSweers/metro
Canonical: https://ross.abutalabs.com/products/zacsweers-metro
Homepage: https://zacsweers.github.io/metro/
Language: Kotlin
License: Apache-2.0
License Family: permissive
Topics: compiler-plugin, dependency-injection, di, javax-inject, jsr-330, kotlin, jakarta-inject
Last push: 2026-08-26T18:48:42+00:00

## Health v2 (maintenance only)
Score: 84/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 85, longevity 47
- inputs: {"age_days": 666, "days_push": 7, "days_rel": 20, "gap_med": 4, "n_releases_24m": 78}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1372, forks 106 (observed 2026-08-28T04:04:32.326587+00:00)

## What it is
Metro is a compile-time dependency injection framework for Kotlin Multiplatform, implemented as a Kotlin compiler plugin with FIR/IR code generation. It combines ideas from Dagger, Anvil, and kotlin-inject, supporting JVM, JS, Wasm, and Native targets without KAPT or KSP.

## Use cases
- dependency injection in Kotlin Multiplatform projects
- catch DI graph errors at compile time instead of runtime
- migrate incrementally from Dagger or kotlin-inject
- avoid KAPT/KSP overhead with a compiler-plugin-based DI framework
- aggregate DI contributions across modules like Anvil
- share dependency graphs across JVM, JS, Wasm, and Native targets

## When to choose
- you want fast, compile-time-validated DI in Kotlin Multiplatform
- you prefer a Kotlin-first API over Java-oriented Dagger
- you need Anvil-style contribution aggregation
- you want to incrementally migrate from Dagger, Guice, or kotlin-inject

## When to avoid
- you need runtime or reflection-based DI like Guice or Koin
- your project is not on Kotlin 2.x with compiler plugin support
- you rely on Dagger features or ecosystems Metro does not yet support
- you need a very mature, battle-tested framework with a large community

## Facets
- artifact type: library
- maturity: active
- function: compiler, build-tool, developer-tools
- domain: programming-languages, developer-tools, cross-platform, compilers
- platform: jvm, wasm, cli
- tags: kotlin-multiplatform, compiler-plugin, dagger-alternative, jsr-330, anvil, code-generation, compile-time-validation, dependency-injection, nodejs

## Member repositories
- ZacSweers/metro (main) score 84

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:32.326587+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:40:45.587008+00:00, confidence not recorded.
  - readme: https://github.com/ZacSweers/metro (fetched 2026-08-28T04:04:32.326587+00:00, sha 58074eb98dc7)
  - homepage: https://zacsweers.github.io/metro/ (fetched 2026-08-29T11:57:18.684849+00:00, sha 36c6c3c2e4f9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
