Clarify attrs for internals, Pydantic for API boundary only

This commit is contained in:
Kevin Turcios 2026-04-21 21:13:04 -05:00
parent c978a9d2a9
commit 2221de0a71

View file

@ -101,7 +101,8 @@ Package-specific conventions (attrs patterns, type annotations, testing) are in
`packages/codeflash-api/` is a ground-up FastAPI rewrite of the Django aiservice from `codeflash-internal/django/aiservice/`. The Django version is the reference implementation — port logic faithfully, don't reimplement from scratch.
Key design decisions:
- FastAPI with async throughout, Pydantic v2 models at every boundary
- FastAPI with async throughout
- Pydantic v2 for request/response schemas only (API boundary). attrs for all internal domain models — same as the rest of the repo
- No Django ORM — use async SQLAlchemy or raw asyncpg for Postgres
- Middleware chain as FastAPI dependencies: auth → rate limit → usage tracking
- Every module must have comprehensive unit tests, including error paths and edge cases