Skip to content

docs: add InferDI (dependency injection) example#879

Merged
yusukebe merged 3 commits into
honojs:mainfrom
maxrendel:docs/add-inferdi-guide
Jun 30, 2026
Merged

docs: add InferDI (dependency injection) example#879
yusukebe merged 3 commits into
honojs:mainfrom
maxrendel:docs/add-inferdi-guide

Conversation

@maxrendel

Copy link
Copy Markdown
Contributor

What

Adds a new example — InferDI (Dependency Injection) — under
Examples → 3rd-party Middleware, with a matching sidebar link.

The guide walks through using InferDI's official @inferdi/hono
request-scope middleware in a Hono app:

  • building a typed DI container with singleton / scoped / transient lifetimes
  • wiring inferdiHono and typing the context via InferdiHonoEnv
  • hydrating the per-request scope with setupScope
  • resolving services in handlers through c.var.di
  • the middleware options table and streaming (skipInferdiDispose)

Why

Implements the proposal agreed in #869.

Notes

  • All code samples are checked against the published @inferdi/hono API.
  • Formatted with the repo's Prettier config.

Closes #869

Comment thread examples/inferdi.md Outdated
Comment thread examples/inferdi.md Outdated
@maxrendel maxrendel requested a review from yusukebe June 30, 2026 09:33

@yusukebe yusukebe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe

Copy link
Copy Markdown
Member

Thank you @maxrendel !

@yusukebe yusukebe merged commit 2c885e9 into honojs:main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: proposal to add a dedicated "Dependency Injection" guide featuring InferDI

2 participants