Compdi
Zero-overhead, compile-time dependency injection for TypeScript.
Compdi rewrites typed macro calls during your build. The generated code directly constructs and wires your dependencies, so your application ships without a runtime container, decorator metadata, or string tokens.
Why Compdi?
- Compile-time erasure — macro calls become ordinary JavaScript before runtime.
- Type-safe dependencies — constructor and factory parameters drive TypeScript inference.
- No metadata runtime — no
reflect-metadata, parameter decorators, or container lookup. - Explicit lifecycles — singleton, transient, scoped, and application teardown APIs.
- Build-tool support — Vite, Rollup, Rolldown, Rspack, and esbuild.
Install
pnpm add compdi
npm install compdi
yarn add compdi
Continue with the quick start to wire your first dependency graph.