THUSHAN

Infrastructure & DevOps

Migrating a Full-Stack Portfolio from Netlify to Cloudflare Pages & Supabase

Preserving routes, SEO canonicals, and edge HTML rendering during a platform migration

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

Cloudflare Pages and Supabase portfolio architecture banner

Summary: Engineering notes on migrating a multi-entry Vite portfolio with dynamic project/activity pages from Netlify to Cloudflare Pages Functions and Supabase PostgreSQL.

Why the Migration Was Necessary

When a static hosting provider hits credit or build limits, an entire personal site can go offline with HTTP 503. Moving the active production platform to Cloudflare Pages paired with Cloudflare Pages Functions and Supabase PostgreSQL separates static CDN asset delivery from lightweight edge SSR.

Edge Routing Architecture

Rather than serving an empty <div id="root"></div> shell to crawlers on dynamic routes, Cloudflare Pages Functions under functions/ intercept HTML document routes:

  • / serves index.html enriched at the edge with live metadata and JSON-LD @graph markup.
  • /projects/:slug and /activities/:slug query Supabase REST directly over fetch(), inject page-specific <title>, <meta name="description">, canonical URLs, <noscript> fallbacks, and return true HTTP 404 when a slug does not exist or is unpublished.
  • /sitemap.xml and /robots.txt are generated dynamically so preview deployments (*.pages.dev) automatically carry X-Robots-Tag: noindex, nofollow and Disallow: /.

Avoiding Cloudflare 308 Redirect Loops

During migration, legacy Netlify _redirects rules caused infinite 308 loops on Cloudflare Pages. Enforcing a build-time verification check (scripts/ci/verify-dist.mjs) that forbids dist/_redirects and verifies canonical links on every build prevents regressions before deployment.

Preserving Legacy Search Signals

Once the paused legacy Netlify origin (thushanrathnayaka.netlify.app) is restored via support, an isolated migration/netlify-seo-redirect deployment is prepared to serve path-preserving HTTP 301 redirects to https://thushanrathnayaka.com/.

Topics: Cloudflare Pages · Supabase · Technical SEO · Migration · CI/CD

Supporting References & Sources