Python 2,984 FILES 8 FINDINGS

HOW FASTAPI
ACTUALLY WORKS

Modern Python web framework for building APIs. Conventions, patterns, and architecture extracted from the fastapi/fastapi repository by sourcebook.

QUICK_REF:
Routing: FastAPI endpoints Validation: Pydantic BaseModel Testing: pytest.

WHAT_MATTERS

  • Uses FastAPI endpoints for routing — follow this pattern, don't add REST routes directly

KEY_FINDINGS

FastAPI project. Use Pydantic models for request/response schemas, not raw dicts.

HIGH

Uses SQLAlchemy/SQLModel for ORM. Database sessions must be properly closed (use dependency injection).

HIGH

Uses pytest. Test files should be named `test_*.py` or `*_test.py`.

HIGH

Tests live in a separate test/ directory, mirroring src/ structure. New tests go there, not next to source files.

HIGH

API endpoints use FastAPI endpoints. Follow this pattern for new routes.

HIGH
96 files use FastAPI endpoints

Use Pydantic BaseModel for data classes. This is the project's standard validation approach.

HIGH
36 files use Pydantic

Tests use pytest.

HIGH
32 test files

Route definitions live in: fastapi, fastapi/security, fastapi/openapi. Add new endpoints here.

HIGH
3 route directories
GENERATED IN ~3 SECONDS WITH

npx sourcebook init

VIEW ON GITHUB star

RELATED_REPOS