Backend Development

Backend development guide for eval_752.

Tech Stack

  • FastAPI 0.115 - Web framework
  • SQLAlchemy - ORM
  • Alembic - Database migrations
  • Celery - Async task queue
  • LiteLLM - LLM provider integration
  • Pydantic v2 - Validation
  • structlog - Structured logging

Project Structure

backend/src/eval_752/
├── app/           # FastAPI routes, dependencies
├── core/          # Config, logging, security
├── domain/        # Business models
├── infra/         # Database, external clients
├── services/      # Business logic
├── workers/       # Celery tasks
└── security/      # Encryption, API keys

Development Setup

cd backend
uv sync --extra dev
uv run uvicorn eval_752.app.main:app --reload

Quality Standards

Linting: ruff

uvx ruff check
uvx ruff format

Type Checking: mypy strict

uv run mypy --strict

Testing: pytest with 95% coverage

uv run pytest --cov --cov-fail-under=95

See Testing Guide for details.

Key Patterns

  • Business logic in services/, not routes
  • Dependency injection via FastAPI
  • Pydantic for validation
  • Structured logging with context
  • Async where beneficial
  • Locale negotiation via middleware plus translated API errors

For localization conventions, see Internationalization.

For complete setup, see Contributing Guide.