Phase 01: Core Infrastructure & Security - 5 plans in 3 waves - 3 parallel (Wave 1-2), 1 sequential (Wave 3) - Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.1 KiB
| phase | plan | type | wave | depends_on | files_modified | autonomous | must_haves | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-core-infrastructure-security | 01 | execute | 1 |
|
true |
|
Purpose: Create the foundational Python project that all subsequent infrastructure builds upon. Output: A runnable FastAPI application with proper project structure, dependency management via uv, and environment-based configuration.
<execution_context> @/home/mikkel/.claude/get-shit-done/workflows/execute-plan.md @/home/mikkel/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/phases/01-core-infrastructure-security/01-RESEARCH.md (Standard Stack section, Architecture Patterns section) Task 1: Initialize Python project with uv and dependencies pyproject.toml, .env.example Create pyproject.toml with: - Project name: debate-backend - Python version: >=3.12 - Dependencies from research standard stack: - fastapi[all]>=0.128.0 - uvicorn[standard]>=0.30.0 - sqlalchemy[asyncio]>=2.0.0 - asyncpg<0.29.0 - alembic - pydantic>=2.12.0 - pydantic-settings - slowapi - fastapi-csrf-protect - python-multipart - Dev dependencies: - pytest - pytest-asyncio - pytest-cov - httpx - ruff - mypyConfigure ruff in pyproject.toml:
- line-length = 88
- target-version = "py312"
- select = ["E", "F", "I", "N", "W", "UP"]
Create .env.example with documented environment variables:
- DATABASE_URL (postgresql+asyncpg://...)
- SECRET_KEY (for JWT/CSRF)
- ENVIRONMENT (development/production)
- DEBUG (true/false)
- ALLOWED_HOSTS (comma-separated)
- ALLOWED_ORIGINS (comma-separated, for CORS)
Initialize project with uv: uv venv && uv pip install -e ".[dev]"
Run: cd /home/mikkel/repos/debate && uv pip list | grep -E "(fastapi|uvicorn|sqlalchemy|pydantic)"
Expected: All core dependencies listed with correct versions.
pyproject.toml exists with all specified dependencies, virtual environment created, packages installed.
backend/app/core/config.py:
- Use pydantic-settings BaseSettings
- Load: database_url, secret_key, environment, debug, allowed_hosts, allowed_origins
- Parse allowed_hosts and allowed_origins as lists (comma-separated in env)
- Set sensible defaults for development
backend/app/main.py:
- Create FastAPI app with title="Debate API", version="1.0.0"
- Disable docs in production (docs_url=None if production)
- Include v1 router at /api/v1 prefix
- Add basic health endpoint at root /health (outside versioned API)
backend/app/api/v1/router.py:
- Create APIRouter
- Include health endpoint router with prefix="/health", tags=["health"]
backend/app/api/v1/endpoints/health.py:
- GET /health returns {"status": "healthy"}
- GET /health/ready for readiness check (will add DB check in next plan)
All init.py files should be empty (or contain only necessary imports).
Run: cd /home/mikkel/repos/debate && source .venv/bin/activate && uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 &
Wait 2 seconds, then: curl -s http://localhost:8000/health | grep -q healthy && echo "Health check passed"
Kill the server.
FastAPI application starts, health endpoint returns {"status": "healthy"}.
<success_criteria>
- FastAPI backend structure exists following research architecture
- All dependencies installed via uv
- Health endpoint responds at /health
- Configuration loads from environment (or .env file)
- ruff passes on all code </success_criteria>