How bauca/pythonapiazurequickstart works
Project type and purpose
• This is a Python-based backend API template using FastAPI. It is focused on providing:
• A starter API implementation (under src/backend/api/main_api.py)
• Local development via Poetry and Docker‐Compose
• Automated CI/CD pipelines to build, test, publish coverage, push a Docker image, and deploy to Azure Web App
File structure
• Top level:
• deploy/ – everything related to infrastructure and CI/CD YAMLs
• src/backend/ – the Python API code, its Poetry project file, and tests
• Under src/backend:
• api/ – FastAPI entrypoint
• tests/unit & tests/integration – pytest test suites
• pyproject.toml – Poetry configuration
• Under deploy:
• docker/ – Dockerfile and docker-compose.yml for local/CI builds
• build_pipeline.yml & infrastructure_pipeline.yml – Azure DevOps pipeline definitions
• README.md – infra setup instructions
Extract insights from the README
• Stack: Python 3.10, FastAPI, Poetry, Pytest, Docker, Docker-Compose, Azure DevOps (CI/CD), Docker Hub, Azure Web App
• Workflow:
• Developer clones repo → installs deps → writes code/tests
• Pushing code to Git triggers Azure DevOps pipeline
• Pipeline runs build, unit & integration tests, collects coverage
• On success, pipeline builds Docker image → pushes to Docker Hub
• Azure Web App auto-pulls the new image → deploys
a. Main components:
• Developer workstation (Poetry, Docker-Compose)
• Git repository (e.g., GitHub or Azure Repos)
• Azure DevOps CI/CD pipelines
• Docker Hub (container registry)
• Azure Web App (container host)
• Client (API consumer)
b. Relationships & interactions:
• Developer → Git repo (push)
• Git repo → Azure DevOps (pipeline trigger)
• Pipeline → src/backend code (runs build & tests)
• Pipeline → Docker Hub (push image)
• Docker Hub → Azure Web App (auto-deploy)
• Client → Azure Web App (HTTP calls to FastAPI endpoints)
c. Architectural patterns & principles:
• Separation of concerns: code vs. infra vs. pipelines
• Containerization: Docker image as single deployable unit
• Immutable deployments in Azure Web App via container pull
• CI/CD pipeline as code (YAML in deploy/)
d. Key technologies & frameworks:
• FastAPI for HTTP server
• Pytest for unit & integration tests
• Poetry for dependency & packaging
• Docker & Docker-Compose for containerization & local dev
• Azure DevOps pipelines for CI/CD
• Docker Hub as container registry
• Azure Web App for hosting the container
Elements
• Blue for developer & local
• Green for CI/CD
• Orange for registry
• Purple for cloud runtime