{"id":42600390,"url":"https://github.com/zacsweers/metro","last_synced_at":"2026-04-25T00:01:58.377Z","repository":{"id":277005954,"uuid":"883876139","full_name":"ZacSweers/metro","owner":"ZacSweers","description":"A multiplatform, compile-time dependency injection framework for Kotlin","archived":false,"fork":false,"pushed_at":"2026-04-22T01:06:34.000Z","size":32878,"stargazers_count":1151,"open_issues_count":26,"forks_count":93,"subscribers_count":11,"default_branch":"main","last_synced_at":"2026-04-22T01:31:11.702Z","etag":null,"topics":["compiler-plugin","dependency-injection","di","jakarta-inject","javax-inject","jsr-330","kotlin"],"latest_commit_sha":null,"homepage":"https://zacsweers.github.io/metro/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZacSweers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"zacsweers","thanks_dev":"u/gh/zacsweers"}},"created_at":"2024-11-05T18:19:16.000Z","updated_at":"2026-04-22T00:25:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b7c1313-ab9a-4fb1-8770-aedf5ab51ca6","html_url":"https://github.com/ZacSweers/metro","commit_stats":null,"previous_names":["zacsweers/metro"],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/ZacSweers/metro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fmetro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fmetro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fmetro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fmetro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZacSweers","download_url":"https://codeload.github.com/ZacSweers/metro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fmetro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32245151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-plugin","dependency-injection","di","jakarta-inject","javax-inject","jsr-330","kotlin"],"created_at":"2026-01-29T00:20:12.070Z","updated_at":"2026-04-25T00:01:58.372Z","avatar_url":"https://github.com/ZacSweers.png","language":"Kotlin","funding_links":["https://github.com/sponsors/zacsweers","https://thanks.dev/u/gh/zacsweers"],"categories":[],"sub_categories":[],"readme":"# 🚇 Metro\n\nA compile-time dependency injection framework for Kotlin Multiplatform, powered by a Kotlin compiler plugin.\n\n[![Maven Central](https://img.shields.io/maven-central/v/dev.zacsweers.metro/runtime.svg)](https://github.com/ZacSweers/metro/releases)\n[![Kotlin](https://img.shields.io/badge/Kotlin-2.2.20%20--%202.4.0--dev--2124-blue.svg?logo=kotlin)](docs/compatibility.md)\n[![Build Status](https://github.com/ZacSweers/metro/actions/workflows/ci.yml/badge.svg)](https://github.com/ZacSweers/metro/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\n---\n\n## What is Metro?\n\nMetro is a compile-time dependency injection framework that combines the best of [Dagger](https://github.com/google/dagger), [Anvil](https://github.com/square/anvil), and [kotlin-inject](https://github.com/evant/kotlin-inject) into one cohesive solution.\n\n**Key Features:**\n\n- ✅ **Compile-time validation** – Catch dependency graph errors during compilation, not at runtime\n- 🧩 **FIR/IR code generation** – No KAPT or KSP required, just a Kotlin compiler plugin\n- 🎯 **Kotlin-first API** – Inspired by kotlin-inject with top-level function injection and optional dependencies\n- 🗡️ **Dagger-esque runtime** – Lean generated code with familiar patterns\n- ⚒️ **Anvil-style aggregation** – `@ContributesTo`, `@ContributesBinding`, and more\n- 🌐 **Multiplatform** – Supports JVM, JS, WASM, and Native targets\n- 💡 **Helpful diagnostics** – Detailed error messages with actionable suggestions\n- 🔗 **Advanced interop** – Migrate incrementally from Dagger, kotlin-inject, or Guice\n- ⚡️ **Fast** - At build time, at runtime\n\n---\n\n## Quick Start\n\n**1. Apply the Gradle plugin:**\n\n```kotlin\nplugins {\n  id(\"dev.zacsweers.metro\") version \"\u003cversion\u003e\"\n}\n```\n\n**2. Define a dependency graph:**\n\n```kotlin\n@DependencyGraph\ninterface AppGraph {\n  val repository: UserRepository\n\n  @Provides\n  fun provideApi(): Api = ApiImpl()\n}\n\n@Inject\nclass UserRepository(private val api: Api)\n```\n\n**3. Create and use the graph:**\n\n```kotlin\nval graph = createGraph\u003cAppGraph\u003e()\nval repository = graph.repository\n```\n\n---\n\n## Documentation\n\n📚 **[zacsweers.github.io/metro](https://zacsweers.github.io/metro/latest/)**\n\n| Topic                                                                            |                                                |\n|----------------------------------------------------------------------------------|------------------------------------------------|\n| [Installation](https://zacsweers.github.io/metro/latest/installation/)           | Setup and configuration                        |\n| [Dependency Graphs](https://zacsweers.github.io/metro/latest/dependency-graphs/) | Define and create graphs                       |\n| [Provides](https://zacsweers.github.io/metro/latest/provides/)                   | Provider functions and properties              |\n| [Injection Types](https://zacsweers.github.io/metro/latest/injection-types/)     | Constructor, assisted, and member injection    |\n| [Scopes](https://zacsweers.github.io/metro/latest/scopes/)                       | Scoping and lifecycle management               |\n| [Aggregation](https://zacsweers.github.io/metro/latest/aggregation/)             | Anvil-style contributions across modules       |\n| [Interop](https://zacsweers.github.io/metro/latest/interop/)                     | Dagger, kotlin-inject, and Guice compatibility |\n| [Performance](https://zacsweers.github.io/metro/latest/performance/)             | Build and runtime performance                  |\n| [Compatibility](https://zacsweers.github.io/metro/latest/compatibility/)         | Supported Kotlin versions                      |\n| [FAQ](https://zacsweers.github.io/metro/latest/faq/)                             | Frequently asked questions                     |\n| [API Docs](https://zacsweers.github.io/metro/latest/api/)                        | Generated KDocs                                |\n\n---\n\n## Supported Platforms\n\nMetro supports JVM, Android, JS, WASM, and Native targets. The compiler plugin works with all Kotlin Multiplatform project types.\n\nSee the [multiplatform docs](https://zacsweers.github.io/metro/latest/multiplatform/) for full details.\n\n---\n\nLicense\n-------\n\n    Copyright (C) 2025 Zac Sweers\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       https://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacsweers%2Fmetro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacsweers%2Fmetro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacsweers%2Fmetro/lists"}