← Back to all projects

How this site is built and deployed

A static site on Azure Static Web Apps, with every piece of infrastructure in Terraform, deployments federated through OIDC and a running cost of zero.

Deployment of this site Visitors look the domain up in Cloudflare DNS and connect to Azure Static Web Apps directly over HTTPS; Cloudflare only redirects www to the apex. Pull requests run GitHub Actions, which signs in to Azure through OIDC as a managed identity and deploys a preview, or production on merge. Terraform, applied after a reviewed plan, manages Azure and Cloudflare. SERVING Visitor browser Cloudflare DNS, www → apex redirect Azure Static Web Apps Free plan, own certificate DNS HTTPS, direct to Azure DELIVERY Pull request GitHub GitHub Actions build, lint, link check Managed identity read app, fetch deploy token OIDC preview per PR, production on merge INFRASTRUCTURE Terraform reviewed plan, apply Azure app, identity, role, budget Cloudflare DNS records, redirect Deployment of this site Visitors look the domain up in Cloudflare DNS and connect to Azure Static Web Apps directly over HTTPS; Cloudflare only redirects www to the apex. Pull requests run GitHub Actions, which signs in to Azure through OIDC as a managed identity and deploys a preview, or production on merge. Terraform, applied after a reviewed plan, manages Azure and Cloudflare. SERVING Visitor browser Cloudflare DNS, www → apex DNS Azure Static Web Apps Free plan, own certificate HTTPS DELIVERY Pull request GitHub GitHub Actions build, lint, link check OIDC Managed identity read app, fetch deploy token Azure Static Web Apps preview per PR, production on merge INFRASTRUCTURE Terraform reviewed plan, apply Azure app, identity, budget Cloudflare DNS, redirect
Three paths: how a visit is served, how a change is delivered, and how the infrastructure itself is managed.

Context

This site is my portfolio, and also a small, complete example of how I build platforms: the same practices I use at work, sized for one static site.

Constraints

  • Close to zero running cost. The domain is the only recurring expense.
  • No stored cloud credentials anywhere.
  • Every change goes through a pull request with a preview before it reaches production.
  • Maintainable by one person.

Why not…

  • Kubernetes or containers? A static site has nothing to run. A cluster would add cost and upkeep without serving a single page better.
  • A deployment token stored in GitHub? It would be a long-lived secret. The workflow signs in through OIDC and fetches the token only at run time.
  • Cloudflare’s proxy in front? Spanish ISPs block shared Cloudflare addresses on football match days, and the proxy’s WAF could be bypassed through the app’s own hostname anyway. For static files, being reachable matters more.

Solution

  • Astro builds the site into plain HTML from Markdown. No server, no database.
  • Azure Static Web Apps (Free plan) hosts it, with managed certificates and a preview environment for each pull request.
  • Cloudflare is the registrar and DNS. The domain points straight at Azure; Cloudflare only redirects www to it.
  • GitHub Actions builds, lints and checks links on every pull request, then deploys. It signs in to Azure through OIDC federation as a managed identity whose only permission is to read the app and its deployment token.
  • Terraform manages everything in Azure and Cloudflare. Each change is a reviewed plan before it is applied.

Outcome

  • Running cost: 0 € a month. A budget alerts on the first cent.
  • No stored Azure credentials. The one stored secret is a Cloudflare token scoped to this zone, because Cloudflare offers no federation.
  • Every change is a pull request with its own preview environment.