Type-safe dependency injection
Lightweight, modular, zero-overhead DI container & microservices ecosystem for TypeScript monorepos, Bun, Node.js, and Cloudflare Workers.
Documentation · Get Started · GitHub
Install: bun x @di-framework/cli init
Capabilities
- Core DI Container — Singleton & transient scope resolution, decorator-based lifecycle management, and compile-time type safety.
- HTTP & OpenAPI — Declarative HTTP controllers, parameter assertions, and automatic OpenAPI 3.0 schema generation.
- Auto GraphQL — Generates GraphQL schemas automatically from decorated TypeScript domain objects and resolver classes.
- Event Messaging — Bridge container events across Kafka, NATS, or in-memory buses with @Subscriber().
- Auth & WebAuthn — JWT sessions, OAuth2/OIDC, and WebAuthn passkey assertions.
- WebCrypto Sockets — Encrypted WebSocket, TCP, and UDP channels using ECDH & AES-GCM.
Specialized packages
- @di-framework/core — Singleton & transient scopes, decorator lifecycle, and compile-time type-safe resolution.
- @di-framework/cli — Scaffold projects, generate modules, and manage monorepo packages from the terminal.
- @di-framework/http — Declarative controllers, parameter assertions, and automatic OpenAPI 3.0 schemas.
- @di-framework/graphql — Auto-generate GraphQL schemas from decorated domain objects and resolvers.
- @di-framework/events — Bridge container events across Kafka, NATS, or in-memory buses with @Subscriber().
- @di-framework/auth — JWT sessions, OAuth2/OIDC providers, and WebAuthn passkey assertions.
- @di-framework/authz — Policy-based authorization guards that plug into the DI container lifecycle.
- @di-framework/config — Typed configuration loading with env overrides and validated runtime schemas.
- @di-framework/socket — Encrypted WebSocket, TCP, and UDP channels via ECDH & AES-GCM WebCrypto.
- @di-framework/rpc — Type-safe remote procedure calls between services with container-aware clients.
- @di-framework/ai — Injectable model providers, tooling hooks, and streaming inference helpers.
- @di-framework/ai-utils — Agent Skills (SKILL.md), jailed file tools, todos, and opt-in Write / Edit / Bash.
- @di-framework/repo — Repository pattern adapters for persistence with DI-managed unit-of-work scopes.