Skip to content

Application

Autodoc for the FastAPI app factory and its mount wiring. See Architecture for the narrative.

main

cms-api application factory.

Mounts these routers
  • health at /api (GET /api/status)
  • admin block at /admin/v1 (admin-gated via validate_admin)
  • public block at /public/v1 (open / read-only)
  • public v2 block at /public/v2 (worker API key, read-only)

Adds CORS and the lightweight rate-limit middleware. Run directly to boot uvicorn on :8080 for local development.

rate_limit_middleware(request, next_call) async

Apply the per-client rate limit to every HTTP request.

Source code in src/cms_api/main.py
@app.middleware("http")
async def rate_limit_middleware(request: Request, next_call):
    """Apply the per-client rate limit to every HTTP request."""
    return await limit_user(request=request, next_call=next_call)