# samber/do

⚙️  A dependency injection toolkit based on Go 1.18+ Generics.

Repository: https://github.com/samber/do
Canonical: https://ross.abutalabs.com/products/do
Homepage: https://do.samber.dev
Language: Go
License: MIT
License Family: permissive
Topics: di, go, golang, container, dependency, dependency-graph, generics, graceful-shutdown, healthcheck, injection, injector, invoke, ioc, lifecycle, provide, service, typesafe
Last push: 2026-08-25T16:28:11+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 61, longevity 100
- inputs: {"age_days": 1569, "days_push": 8, "days_rel": 44, "gap_med": 301, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2794, forks 109 (observed 2026-08-28T04:07:22.277648+00:00)

## What it is
samber/do is a dependency injection toolkit for Go 1.18+ built on generics, offering a type-safe, reflection-free API with no external dependencies. It provides service registration and invocation, scope trees, health checks, graceful shutdown, and dependency graph debugging tools including a Web UI.

## Use cases
- wire up services in a Go application with compile-time type safety
- replace uber/dig or uber/fx with a generics-based DI container
- manage service lifecycle with health checks and graceful shutdown
- organize services into scoped modules with visibility control
- visualize and debug a service dependency graph
- avoid code generation steps like google/wire in the build pipeline

## When to choose
- you want compile-time-checked dependency resolution without a build step
- you need built-in health checks and dependency-aware graceful shutdown
- you want zero external dependencies and no reflection
- you need runtime flexibility like conditional registration, overrides, and scopes

## When to avoid
- you want zero runtime cost and a fully static graph (use google/wire)
- you're building a large modular app that benefits from uber/fx's batteries-included framework
- you prefer a minimal reflection-based container to build your own framework on (use uber/dig)

## Facets
- artifact type: library
- maturity: stable
- function: middleware, developer-tools, configuration-management
- domain: developer-tools, backend, apis
- platform: go, cross-platform
- tags: dependency-injection, generics, ioc-container, service-lifecycle, healthcheck, graceful-shutdown, type-safe, no-codegen

## Member repositories
- samber/do (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:22.277648+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-30T08:14:49.681748+00:00, confidence not recorded.
  - readme: https://github.com/samber/do (fetched 2026-08-28T04:07:22.277648+00:00, sha 77cd16cadee6)
  - homepage: https://do.samber.dev (fetched 2026-08-29T09:55:00.320655+00:00, sha 9ab3031b1a5c)
  - site_page: https://do.samber.dev/docs/comparison/samber-do-vs-uber-fx (fetched 2026-08-29T09:55:00.333681+00:00, sha 360b64411afd)
  - site_page: https://do.samber.dev/docs/comparison/samber-do-vs-google-wire (fetched 2026-08-29T09:55:00.335514+00:00, sha 1f579816c550)
  - site_page: https://do.samber.dev/docs/comparison/samber-do-vs-uber-dig (fetched 2026-08-29T09:55:00.337322+00:00, sha 4ec1367d78b9)
  - site_page: https://do.samber.dev/docs/about (fetched 2026-08-29T09:55:00.329779+00:00, sha f76a3af202fd)
  - site_page: https://do.samber.dev/docs/getting-started (fetched 2026-08-29T09:55:00.331830+00:00, sha 57184d6964aa)
- Data as of 2026-08-30T08:39:29.467469+00:00.
