← Back to all posts

How We Built a 4,165-Page Affiliate Engine on a $0 Cloudflare Stack

Published September 26, 2026

⏱️ 3 min read

The short version: 4,165 indexable pages, FTC-compliant redirects, per-link Amazon attribution, edge-cached worldwide, nightly automation — and a monthly infrastructure bill of exactly $0. This is the architecture, honestly told, including what we got wrong.

The stack

Everything runs on Cloudflare's free tier: Workers render pages live, KV caches at the edge (6-hour TTLs), D1 stores products and clusters, Pages hosts the static shell (hub, sitemap, robots.txt), and Cron Triggers run the nightly pipeline. No server, no VPS, no database bill.

The pipeline

Content flows one direction: harvest → cluster → publish → attribute. Product data is harvested and seeded into D1, the generator builds comparison clusters (a category × an angle × a size), pages render on-demand from the cluster spec, and every outbound click carries attribution before it hits Amazon.

The architectural decision that unlocked scale

We started with 21,000 static files — and hit the 20,000-file Pages limit. The fix was counterintuitive: stop pre-generating pages. A Worker now renders every comparison page from its slug pattern ({category}-{angle}-top{n}) plus D1 data, caches the HTML in KV, and serves subsequent requests from the edge. Cold render: ~220ms. Warm: ~70ms. The same code path serves any future cluster we invent, so adding 300 new categories requires zero redeploys.

Attribution: the part most affiliates skip

Every outbound link is cloaked under /out/, appends our Associates tag, and — the piece almost nobody uses — an ascsubtag encoding which page and which ASIN produced the click. Amazon's unified self-service report then shows per-page EPC. Kill pages that click but don't convert; double down on pages that do. You cannot optimize what you can't attribute.

Compliance is a template, not an afterthought

FTC disclosure, the required Amazon Associate statement, and rel="sponsored" attributes ship in the page template, so every page is compliant by construction. A disclosure bolted on later is a disclosure that's already late.

What we got wrong

Honest ledger: we shipped thin pages before rich ones (fix: per-angle H1s, rationales, ItemList JSON-LD, internal link graphs); we indexed more than we should have (fix: soft-pruned angles behind X-Robots-Tag: noindex); and same-zone Workers fetches surprised us — subrequests to your own domain bypass your routes and hit origin, which is why our site grader needed an origin map. Every one of these is now a checklist item.

Diagnose your own site

We built a free 100-point Affiliate Site Grader that runs the exact checks from this architecture — monetization, FTC compliance, technical SEO, structured data, speed, security, crawlability — on your live site in about ten seconds. No signup. If you want the full build pattern as a product, the Zero-Overhead Affiliate Playbook walk-through is on the launch list.

#AmazonAssociate — As an Amazon Associate I earn from qualifying purchases. Full disclosure →