Overview
Astro prerenders about 330 pages; a small Cloudflare Worker only handles Stripe checkout, the payment webhook and signed PDF downloads from private storage. Lighthouse scores 100 for SEO and best practices.
Context
An online shop for a nutritionist’s PDF guides, plus an archive of more than 320 Instagram posts turned into fast, indexable pages.
Architecture
- Static-first: Astro prerenders every page (about 330) at build time. Cloudflare serves them from the edge, with no server and no database query per visit.
- Only three routes run code on demand, in a Cloudflare Worker: checkout, the Stripe webhook and the download.
- Content is edited in Sanity and read once at build time, with TypeScript types generated from the schema.
- Photos and videos live in Cloudflare R2: about 7,400 objects (originals plus WebP variants), with no egress fees.
Payments and delivery
- Stripe Checkout, with the webhook signature verified on every call.
- Resend emails the buyer a signed (HMAC) download link that stays valid for 30 days.
- The Worker streams the PDF from a private R2 bucket. There are no public file URLs, and no customer data is stored.
Content pipeline
- An idempotent Instagram importer: deterministic ids mean a re-run never duplicates posts or overwrites edited text.
- AI agents transcribed the text inside images for 160+ posts, which made them indexable. Posts that are too short get
noindexautomatically.
Results
- Lighthouse on mobile: 87 to 97 for performance, 95 for accessibility, 100 for best practices and 100 for SEO.
- An AVIF hero image of 57 KB on mobile, inlined CSS and subsetted fonts.
- A Markdown version of every page, plus
llms.txt, for AI agents. - Static pages are free to serve, so traffic spikes cost nothing.

