How maartenvandiemen/todoitems works
Project type and purpose
• This is a demo ASP.NET Core 9 “minimal API” project (TodoItems.Api) that exposes HTTP endpoints to manage todo items.
• It uses Entity Framework Core migrations against an Azure SQL Database.
• Infrastructure‐as‐code is defined with Bicep files under the “Deployment” folder.
• CI/CD pipelines are implemented both in GitHub Actions and Azure DevOps to build (with and without Docker), run tests, and deploy to Azure (App Service, SQL, Key Vault, Application Insights).
File structure
• Top‐level solution (TodoItems.sln) references two key projects:
• TodoItems.Api – the API service
• TodoItems.Api.IntegrationTests – end‐to‐end tests that spin up a test environment and run against the API
• Deployment – contains Bicep templates for provisioning Azure resources (App Service, SQL, Key Vault, etc.)
• .github & .azuredevops – CI/CD definitions (build, test, deploy workflows) for GitHub Actions and Azure DevOps
• tests/test.http – Postman‐style HTTP requests for smoke/manual testing
Key README insights
• The API is containerizable (Dockerfile) but also runnable directly.
• Requires secrets (SA_PASSWORD, AZURE_SQL_USER, Azure service principal) stored as encrypted repository or variable‐group secrets.
• Separate pipelines for “nodocker” and “docker” builds, both culminating in deployment to Azure.
• CI triggers: commits to main branch, pull requests and manual environment deployments.
Main components
a. Client (Postman, browser, mobile app, or HTTP test suite) – issues HTTP requests to the API
b. TodoItems.Api – ASP.NET Core minimal API service
c. Azure SQL Database – persistent storage for todo items (EF Core migrations apply schema)
d. Azure App Service – hosts the API (with or without Docker container)
e. Azure Key Vault – stores SQL credentials and other secrets
f. Application Insights – telemetry and logging for the API
g. CI/CD Pipeline – GitHub Actions/Azure DevOps workflows that:
• Build & test the API
• Publish Docker image (optional)
• Deploy Bicep templates (Infrastructure as Code)
• Deploy the API to App Service
h. Integration Test Environment – ephemeral resources spun up by tests (local or in‐cloud)
Relationships and interactions
• Client → HTTP → App Service / API
• API → ADO.NET or EF Core → Azure SQL Database
• API → Key Vault SDK → retrieve credentials/secrets at runtime
• API → Application Insights SDK → send telemetry
• CI/CD Pipeline → Bicep CLI → provision/update Azure resources → deploy API image or code
• Integration Tests → spin up test instance of API & DB → execute HTTP calls → validate responses
Architectural patterns and principles
• Minimal API – single‐assembly, attribute‐light endpoints
• Layered separation: API layer vs. persistence layer (EF Core migrations in Migrations folder)
• Infrastructure as Code – declarative resource templates (Bicep) versioned alongside code
• CI/CD as code – YAML workflows under .github and .azuredevops
• Containerization – optional Docker image for production parity
Relevant technologies, frameworks, libraries
• .NET 9, ASP.NET Core minimal APIs
• Entity Framework Core (Migrations)
• Docker (optional)
• Azure Bicep (IaC)
• GitHub Actions & Azure DevOps pipelines
• Azure App Service, Azure SQL, Key Vault, Application Insights