THUSHAN

Cloud & Infrastructure

Engineering a Zero-to-Low-Cost Cloud Stack Using Cloudflare Pages, Edge Functions, and Supabase

Keeping production availability, dynamic CMS publishing, and automated CI/CD inside free-tier limits

By Thushan Rathnayaka · Published 2026-11-23 · Updated 2026-11-25

Low-cost Cloudflare and Supabase cloud stack

Summary: How to combine static Vite builds, edge request-time HTML injection, Supabase free tier, and batched GitHub Actions deployments without recurring server bills.

Design Constraints

An independent engineer or early venture needs high uptime, global CDN performance, real HTTPS, database-backed CMS updates, and clean SEO without paying for idle containers or over-triggering build quotas.

Stack Decisions

  • Static CDN + Selective Edge Functions (_routes.json): Exclude /assets/*, /img/*, /css/*, /js/*, /fonts/* from function invocation so edge compute runs only on HTML/API/XML routes.
  • Runtime Content Separation: Code/UI changes deploy via GitHub → Cloudflare Pages; content updates publish immediately through Admin → Supabase without triggering unnecessary rebuilds.
  • Cache Discipline: Fingerprinted Vite assets get max-age=31536000, immutable, while dynamic HTML pages use max-age=0, must-revalidate so edits propagate cleanly.
  • Automated Pre-Deploy Checks: Running secret scanning, verify-dist, and wrangler pages dev route smoke tests in CI catches regressions before production.

Topics: Cloudflare · Supabase · Free Tier · Web Performance · Architecture

Supporting References & Sources