How it works
Every demo here is a real, working proof-of-concept on Cloudflare's actual platform. Not slideware. The whole site runs on Cloudflare Pages + Pages Functions; each bounty below is one primitive doing one job at the edge.
Scale-to-zero serverless: idle costs nothing. No Workers Paid plan required — the only recurring cost is the domain. (The Campfire voice is the one paid model, Deepgram Aura-2, and it's pre-baked to static audio so there's $0 per-use spend.)
Turnstile
Invisible verification
How it works
One script tag in your form, one check on your server. No infrastructure to run.
Add it to your site
~10 lines · no infrastructure<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer></script>
<div class="cf-turnstile" data-sitekey="YOUR_SITEKEY"></div>const r = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
method: 'POST',
body: new URLSearchParams({ secret: env.TURNSTILE_SECRET, response: token }),
}).then((res) => res.json());
if (!r.success) return new Response('Blocked', { status: 403 });Official Cloudflare docs
Workers
AI-crawler control
How it works
Identify AI crawlers at the edge and decide per-caller: allow, charge, or block.
Add it to your site
1 dashboard toggle, or ~15 linesSecurity → Bots → "Block AI bots" / "Pay per crawl"
One toggle. Cloudflare maintains the crawler signatures for you.const ua = request.headers.get('user-agent') || '';
const bot = classifyAiCrawler(ua); // GPTBot, ClaudeBot, CCBot, PerplexityBot…
if (bot?.policy === 'block') return new Response('Forbidden', { status: 403 });
if (bot?.policy === 'license') return new Response('Payment required', { status: 402 });
return fetch(request); // humans pass straight throughOfficial Cloudflare docs
D1
Data residency
How it works
Route each write to the data store in the visitor's own jurisdiction, decided at the edge.
Add it to your site
~20 lines + 2 D1 bindingsconst country = request.cf.country; // free, at the edge
const eu = ['DE', 'FR', 'IE', 'NL' /* …EEA */];
const db = eu.includes(country) ? env.RESIDENCY_EU : env.RESIDENCY_US;
await db.prepare('INSERT INTO records (data) VALUES (?)').bind(payload).run();"d1_databases": [
{ "binding": "RESIDENCY_EU", "database_name": "app-eu" }, // created --location weur
{ "binding": "RESIDENCY_US", "database_name": "app-us" } // --location enam
]Official Cloudflare docs
AI Search (AutoRAG)
Grounded trust assistant
How it works
Point AI Search at your docs; it answers with citations, or refuses when the answer is not there.
Add it to your site
dashboard setup + ~15 linesAI → AI Search → New
Data source: your R2 bucket or uploaded docs
Cloudflare chunks, embeds, and indexes them for you.const res = await env.AI.autorag('your-instance').aiSearch({
query: question,
});
return Response.json({ answer: res.response, citations: res.data });Official Cloudflare docs
Workers AI · pre-baked static
Campfire joke bot
How it works
A joke bot whose voice runs on Cloudflare. Generated once with Workers AI, then served as static audio for $0 per use.
Add it to your site
pre-baked → $0 per useconst r = await env.AI.run('@cf/meta/llama-3.3-70b-instruct-fp8-fast', {
messages: [{ role: 'system', content: COWBOY_PROMPT }, { role: 'user', content: 'Tell me a joke.' }],
});const audio = await env.AI.run('@cf/deepgram/aura-2-en', { text, speaker: 'zeus' });
// baked to /cowboy/jokes/<id>-zeus-<line>.mp3 -> served static, no per-use spendOfficial Cloudflare docs
D1
Defend the Edge leaderboard
How it works
A global leaderboard on D1: every submit is one atomic insert, with hashed-IP rate limiting at the edge.
Add it to your site
D1 · no read-modify-write raceawait env.LEADERBOARD_DB
.prepare('INSERT INTO leaderboard_scores (name, score, ip_hash, ts) VALUES (?, ?, ?, ?)')
.bind(name, score, ipHash, ts).run();const ipHash = await sha256(request.headers.get('CF-Connecting-IP')); // never store raw IP
const recent = await db.prepare('SELECT COUNT(*) c FROM leaderboard_scores WHERE ip_hash=? AND ts>?')
.bind(ipHash, Date.now() - 60_000).first();
if (recent.c >= 8) return json({ ok: false, error: 'rate limited' }, 429);Official Cloudflare docs