@nwire/container
v0.7.1
Published
Nwire — DI container contract + InMemory default. Production adapters land as @nwire/container-awilix.
Readme
@nwire/container
DI seam — the four-method
Containerinterface every Nwire package composes through.
What it is
A small Container interface (resolve / has / register / createScope) plus an in-memory default. Every other Nwire package depends only on this, so you can bring your own DI (plain object, Awilix, tsyringe) without rewriting the framework.
Install
pnpm add @nwire/containerWithin nwire-app
For developers using this package as part of the Nwire stack. Plugins register on the container during boot; handlers resolve via ctx.resolve("key"). Swap the implementation by passing a different Container to createApp.
import { createApp } from "@nwire/forge";
import { AwilixNwireContainer } from "@nwire/container-awilix";
const container = new AwilixNwireContainer();
container.register("db", () => new PrismaClient());
const app = createApp("learnflow", { modules, container });API
Container— interface every adapter implements.InMemoryContainer—Map-backed default; good for tests and small wires.rootContainer— a pre-built blankInMemoryContainerframework layers compose with.
