FastAPI Lifespan and app.state: Managing Process-Wide Resources
Use FastAPI's lifespan context manager to create and dispose shared clients or pools once at startup and shutdown, expose them via app.state, and keep request-scoped cleanup in dependencies with yield.