Skip to main content
Wyrly keeps framework integration thin. The core package owns tokens, providers, containers, scopes, validation, and graph inspection. Adapters create request scopes and expose them in framework-native ways.

Next.js App Router

Install:
Use withDI for Route Handlers:
The Next.js adapter also provides helpers for Server Actions and Server Components.

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.
For GraphQL on Fastify, combine with @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.
This is useful for DataLoader instances, request context, authentication state, and disposable resources.

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 on Request, Response, or framework context objects.