← ClaudeAtlas

vayulisted

FastAPI standards for the AI backend — project layout, Pydantic models, async discipline, Supabase JWT verification, SSE streaming for chat, error handling, and CORS with Vercel. Use when writing or reviewing FastAPI routes, Pydantic schemas, Python API endpoints, LLM streaming endpoints, or backend auth.
arjuncrevathi/asthra · ★ 0 · API & Backend · score 68
Install: claude install-skill arjuncrevathi/asthra
# Vayu — The Swift Wind (FastAPI) Vayu is speed with direction. FastAPI earns its name only if nothing blocks the event loop and every request knows exactly who it serves. ## Project layout - Structure by layer, imported downward only: - `app/routers/` — HTTP concerns: parse, authorize, delegate, respond. No business logic. - `app/services/` — business logic and LLM orchestration. No `Request`/`Response` objects. - `app/repositories/` — all SQL/ORM against Render Postgres. No business logic. - `app/schemas/` — Pydantic models. `app/core/` — settings, auth, deps. - A router function longer than ~30 lines is hiding a service. Extract it. - One `APIRouter` per resource, mounted under `/api/v1`. Version from day one — `/api/v1` costs nothing now and saves a migration later. ## Pydantic everywhere - Pydantic v2 models for every request body and every response (`response_model=`). Raw `dict` in a signature or return is a review comment. - Separate `XCreate` / `XUpdate` / `XOut` models — never expose the DB row shape directly, never accept fields the client shouldn't set (`user_id`, `created_at`). - `model_config = ConfigDict(extra="forbid")` on request models: unknown fields are client bugs — surface them, don't swallow them. - Settings via `pydantic-settings` in `app/core/config.py`, read from env once at startup, injected via `Depends` — no `os.environ` reads scattered through code, fail fast on missing config (see `kubera` for what's secret). ## Async discipline -