Next.js App Router
Install:withDI for Route Handlers:
Express
Use the Express adapter to create one scope per request and access it from the request object.Hono
Use the Hono adapter for edge-friendly request scopes.Fastify
@wyrly/fastify provides diPlugin for Fastify 5 (one scope per request, auto dispose on response
finish / close). Peer: fastify ^5. The plugin uses fastify-plugin so hooks apply to routes
on the root instance.
@wyrly/apollo or @wyrly/yoga.
Fresh
Use@wyrly/fresh for Fresh 2.x applications. The package is published on JSR.
GraphQL
Use@wyrly/graphql when each GraphQL request should own a DI scope and request-local loaders.
GraphQL Yoga
@wyrly/yoga provides yogaDIPlugin and yogaContext for GraphQL Yoga 5 (one scope per
request, auto dispose on onResponse). Peer: graphql-yoga ^5.
Apollo Server
@wyrly/apollo provides apolloDIPlugin for Apollo Server 4+ (one scope per operation, auto
dispose in willSendResponse). Peers: @apollo/server ^4, graphql ^16.
Pick the adapter at the edge
Keep framework adapters in the outer layer of your application. Domain objects and use cases should depend on ports and value objects, not onRequest, Response, or framework context objects.