@fastrack/di
v0.1.0
Published
Inversify-style dependency injection for Fastrack: constructor injection only, singleton scope by default, explicit bindings via `ContainerModule`. DI never auto-registers routes; Fastify plugins stay responsible for HTTP boundaries.
Readme
@fastrack/di
Inversify-style dependency injection for Fastrack: constructor injection only, singleton scope by default, explicit bindings via ContainerModule. DI never auto-registers routes; Fastify plugins stay responsible for HTTP boundaries.
See docs/architecture.md.
Install
pnpm add @fastrack/diUsage
import { createContainer, bind } from "@fastrack/di";
import { MyService } from "./my-service.js";
const container = createContainer();
container.load(
bind(MyService).toSelf().inSingletonScope()
);
const service = container.get(MyService);Rules
- Constructor injection only.
- Singleton scope default.
- Explicit bindings via ContainerModule; no auto-registration of routes.
