Skip to content

docs: add FastAPI integration lifecycle sequence diagrams - #128

Open
tmchow wants to merge 1 commit into
maldoinc:masterfrom
tmchow:osc/120-fastapi-sequence-diagrams
Open

docs: add FastAPI integration lifecycle sequence diagrams#128
tmchow wants to merge 1 commit into
maldoinc:masterfrom
tmchow:osc/120-fastapi-sequence-diagrams

Conversation

@tmchow

@tmchow tmchow commented Apr 6, 2026

Copy link
Copy Markdown

Summary

Adds two mermaid sequence diagrams to the FastAPI integration docs page, covering the app lifecycle and per-request lifecycle.

Fixes #120

Why this matters

Issue #120 identified that the FastAPI integration page lacked visual documentation of what happens under the hood. The setup() call wires together lifespan management, route injection, and container teardown, but the existing docs only show the Quick Start code. These diagrams trace the actual call flow through wireup/integration/fastapi.py so users can see how container creation, route injection, scope handling, and cleanup connect.

Changes

Added a ## Lifecycle section to docs/pages/integrations/fastapi/index.md between Quick Start and Detailed Guides:

  • App Lifecycle diagram: create_async_container -> setup() -> lifespan enter (route injection, class-based handler instantiation) -> app runs -> lifespan exit (container.close())
  • Per-Request Lifecycle diagram: request arrival -> injection wrapper intercepts -> request scope created -> Injected[T] resolved -> handler called -> scope exits -> response returned

Both diagrams render via the existing mermaid fence configured in mkdocs.yml (line 143-146).

Testing

  • Verified mermaid is configured as a custom fence in docs/mkdocs.yml
  • Diagram participants and flow match the actual source in wireup/integration/fastapi.py

Add mermaid sequence diagrams to the FastAPI integration page showing:

1. App lifecycle: container creation, setup, route injection, and teardown
2. Per-request lifecycle: scope creation, dependency resolution, handler
   execution, and cleanup

Closes maldoinc#120
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.

Fastapi Integration docs sequence diagram

1 participant