Hi all,
I want to share my recent experience migrating my static Hugo website away from Netlify over to Cloudflare Workers.
While Netlify served me well for a long time, the restrictive free-tier limits – particularly around forms – pushed me to look for a more resilient, self-controlled setup. Cloudflare’s modern Workers architecture (serving static assets with edge functions) turned out to be an ideal match, but moving away meant rebuilding Netlify’s built-in “magic” form handling from scratch.
I put together a complete step-by-step walkthrough covering how to replicate and enhance that setup:
-
Static Assets + Backend Logic: Serving Hugo static output while routing
/api/endpoints directly to a lightweight Worker usingwrangler.jsonc(run_worker_first). -
Spam Protection: Implementing Cloudflare Turnstile alongside honeypot fields to block scrapers and bots without intrusive captchas.
-
Submission Persistence: Backing up form entries directly to a serverless Cloudflare D1 (SQLite) database before dispatching.
-
Transactional Delivery: Routing emails via the Resend API with dynamic subjects, safe multi-destination routing, and automatic
reply-toheaders. -
Privacy-First Analytics: Dropping GA4 cookie banners in favour of Cloudflare Web Analytics injected seamlessly at the edge.
-
DNS & Routing Gotchas: Handling the apex/
wwwredirects cleanly via Redirect Rules and dummy IPs without running into HTTP 522 errors.
If you are running Hugo and considering a similar move, or simply want a robust, free-tier-friendly contact form backend without external third-party form builders, I hope this helps:
The Complete Guide to Migrating Hugo from Netlify to Cloudflare Workers
Feedback, thoughts, or questions on the implementation are more than welcome!