advanced-alchemy-fastapi

Installation
SKILL.md

FastAPI

Execution Workflow

  1. Configure SQLAlchemyAsyncConfig and attach AdvancedAlchemy to the FastAPI app.
  2. Build request-scoped session dependencies with Depends(alchemy.provide_session()).
  3. Provide services through async generators and Service.new(session=...) context managers.
  4. Keep routers thin and return service-converted schema objects or paginated schema collections.
  5. Register routers only after the service and dependency layer is coherent.

Implementation Rules

  • Use Annotated plus Depends for session and service injection to keep signatures explicit.
  • Set commit_mode intentionally; do not rely on implicit transaction assumptions.
  • Keep response_model aligned with the schema returned by to_schema().
  • Avoid passing ORM instances directly through FastAPI responses.

Example Pattern

Related skills

More from alti3/litestar-skills

Installs
5
GitHub Stars
5
First Seen
Mar 9, 2026