An Astro site with the default static output is a folder of HTML files, and a folder of files can’t receive a POST. So the usual advice is to sign up for a hosted form service. On Cloudflare you don’t have to. A few dozen lines of TypeScript can receive the form on your own domain, check it, and email it to you, on the free plan.
This guide covers the two ways to run that code next to an Astro site on Cloudflare, then builds the simpler one step by step: a form that works with JavaScript turned off, gets better with it on, drops bots with a honeypot, and validates everything on the server.
The original, canonical version of this guide lives on the Formharbor site: Astro contact form on Cloudflare, without a form backend .
Two ways to run the handler
Static Astro plus a Pages Function. Astro stays fully static, with no adapter. You add a functions/api/contact.ts file at the project root, and Cloudflare Pages serves it as /api/contact on the same domain.…