Ir al contenido

ADR-002-a — Backend Development Stack

Accepted

The backend runs inside Docker in both development and production. Versions must be pinned to guarantee reproducibility between both environments.

All backend dependencies are pinned to a semver range and managed via uv. pip is not used directly. Versions are declared in pyproject.toml (requires-python, dependencies) and locked to guarantee identical behavior across development and production Docker images. Commands run inside the container or via uv run.

ComponentPinned versionNotes
Python>=3.13requires-python in pyproject.toml
Django>=5.2,<6.0LTS. Async-capable.
Django REST Framework>=3.15,<4.0JSON-only, page-based pagination
djangorestframework-simplejwt>=5.3,<6.0JWT for local dev; Cognito in prod
psycopg>=3.2,<4.0psycopg3 (binary). Not psycopg2.
uvicorn>=0.30,<1.0ASGI server with --reload in dev
django-fsm-2>=3.0,<4.0FSM for Employee lifecycle
django-cors-headers>=4.4,<5.0CORS for local dev (localhost:4200)
python-dotenv>=1.0,<2.0.env file loading
django-csp>=4.0,<5.0Content Security Policy headers
whitenoise>=6.8,<7.0Static file serving in production
PostgreSQL16-alpinePinned Docker image

Dev extras are excluded from the production image. pytest-django, pytest-cov, django-extensions, and ipython are installed only in the development/CI environment and are not included in the prod Docker image.

  • django-fsm-2 is a maintained fork of django-fsm; the API is identical but with Django 5+ support.
  • Versions without an upper bound (pytest-*) are left uncapped per YAGNI — they only matter in CI and do not affect the prod image.
  • Production uses the same Docker image (see [[adr-003-a-backend-prod-stack|ADR-003-a]]); the difference is DJANGO_SETTINGS_MODULE and the environment variables injected by App Runner.