This site is not affiliated with or endorsed by Cloudflare, Inc. It showcases deployable experiments across most Cloudflare products.

Experiment Documentation Guide

How to write and maintain Fumadocs pages for each Cloudflare Experiment worker

Every worker under apps/experiments/<name>/ should have a matching docs page at /experiments/<name>. This guide explains structure, conventions, and the automation available to contributors and agents.

Where docs live

ArtifactPath
MDX pageapps/docs/content/docs/experiments/<name>.mdx
Sidebar orderapps/docs/content/docs/meta.json
Docs appapps/docs/ (Fumadocs + Next.js)
Worker sourceapps/experiments/<name>/
Root indexREADME.md experiments table (new experiments only)

Docs are not generated automatically on deploy. When you add or change an experiment, update its MDX page in the same PR (or immediately after).

SEO, tags, and AI discovery

Edit title, description, tags, and bindings in each experiment's MDX frontmatter. Keep apps/docs/lib/experiment-docs-meta.ts in sync when you change tags or bindings. Optional reference catalog: apps/docs/data/experiment-seo.json.

Tag guidelines:

  1. Primary category first - one of ai, scraping, browser, network, edge, storage, stateful, containers, email, security (used by docs search chips).
  2. Product / binding tags - e.g. workers-ai, durable-objects, vectorize, browser-rendering.
  3. Discoverability aliases - names people or agents actually search for when the Cloudflare product is obscure (e.g. Clef → jev, systemone, decision-model; ML-KEM → kyber, post-quantum).

Descriptions should be ~120–160 characters and mention the searchable alias plus the Cloudflare capability. Intros can expand on that for humans and LLM crawlers (/llms.txt, /llms-full.txt, per-page markdown).

Quick start: new experiment

Scaffold the MDX file

From the repository root:

node apps/docs/scripts/scaffold-experiment-doc.mjs my-experiment

This creates apps/docs/content/docs/experiments/my-experiment.mdx with frontmatter, deploy button, and TODO markers derived from src/index.ts and wrangler.json.

Fill in content from source code

Read these files (source of truth):

  1. src/index.ts - name, description, usage
  2. src/routes/*.ts - endpoints, validation, jsonError codes
  3. src/types/ - response shapes
  4. wrangler.json - bindings
  5. README.md - examples (verify against code)

Replace every TODO in the MDX file.

Add to sidebar navigation

Edit apps/docs/content/docs/meta.json and add "experiments/my-experiment" under the correct category (see Categories below).

Note it on What's New

Add a short dated bullet to What's New (newest first) when shipping a new experiment or a user-facing API/docs change.

Rotate "New" badges from What's New

Use the latest What's New section as the source of truth:

  1. Add status: new to the frontmatter of each new experiment page in that batch
  2. Remove status: new from older experiment pages that are no longer in the latest batch
  3. Keep apps/docs/lib/home-content.ts in sync (featuredExperiments and category entries; homepage shows at most maxFeaturedNewBadges)

Badges are manual - they are not derived from ship date.

Update root README (new experiments only)

Add a row to the experiments table in the root README.md with name, description, and deploy link.

Verify the docs build

cd apps/docs && npm run build

Open http://localhost:3000/experiments/my-experiment after npm run dev -- --filter=docs.

Page structure

Required frontmatter

---
title: "Human Readable Name"
description: "One sentence for SEO and page header (≤ ~160 characters)"
# Only for experiments in the latest What's New batch:
# status: new
---

Use the same description as GET / returns in src/index.ts when possible. Add status: new only while the experiment is in the current What's New cohort, then remove it when the next batch ships.

Required sections

  1. Intro - What the worker does and which Cloudflare product it showcases
  2. API Endpoint(s) - One ### METHOD /path block per public route
  3. Parameters - Document each query/body field
  4. Example request - curl against https://your-worker.workers.dev
  5. Response fields - Type + description for each JSON key
  6. Example response - Valid JSON
  7. Error responses - { error, code } shape with real codes from routes
  8. Use cases - 3–5 bullets
  9. Deployment - <Steps> with deploy button + test command
  10. Local development - install, npm run dev, local curl on port 8787
  11. Cloudflare features used - Bullets with links to developer docs

Optional sections

Add when they help readers:

SectionWhen
<Callout type="warning">Experimental workers, AI cost/limits
FeaturesMultiple capabilities beyond one endpoint
Implementation detailsAI pipelines, multi-step fetch/parse flows
ConfigurationBindings, secrets, D1 schema SQL
LimitationsTimeouts, size caps, local vs production differences
Use in your projectSmall pasteable src/lib/ core (see below)
Next steps<Cards> to related experiments or Cloudflare docs

Use in your project

For experiments with a small, self-contained core (helpers in src/lib/, few or no bindings), add a paste recipe between Limitations and Deployment using <UseInYourProject>:

## Use in your project

<UseInYourProject
  experiment="whereami"
  platform={["request.cf"]}
  files={["src/lib/cf.ts", "examples/usage.ts"]}
/>

The component loads each path in files from apps/experiments/<name>/ at build time and renders filename tabs. Put wire-up snippets in examples/usage.ts (docs-only; keep it out of wrangler main). Do not paste source into MDX - edit the real files so docs stay in sync.

Pilots: Crypto Hash, Where Am I?, Edge Cache.

Skip this section when the useful unit is the whole Worker (many bindings, Durable Objects, multi-route apps). Deploy remains the primary path.

Reference examples

MDX conventions

Parameter documentation

Use bold name + type + description (Fumadocs prose style):

**`url`** `string` (required)

The target URL to check. Must use `http://` or `https://`.

Do not use Mintlify components (ParamField, Icon, etc.).

Deploy button

Always use the monorepo path apps/experiments/<name>:

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/shrinathsnayak/cloudflare-experiments/tree/main/apps/experiments/is-it-down)

Available MDX components

Registered in apps/docs/components/mdx.tsx:

  • Callout - notes and warnings
  • Steps / Step - numbered procedures
  • Cards / Card - related links
  • Accordions / Accordion - collapsible detail
  • UseInYourProject - paste recipe checklist (deps, bindings, files, snippets)
  • File / Files / Folder - folder trees

External images (e.g. deploy button SVG) use plain <img> / markdown image syntax.

Categories

Add new pages under the matching separator in meta.json:

SeparatorUse for
---AI & Machine Learning---Workers AI, LLM summarization, AI proxies, RAG, Agents
---Web Scraping & Parsing---HTML fetch/parse, metadata, llms.txt, feeds, structured data
---Browser Rendering---Browser Rendering / Puppeteer binding
---Network & Monitoring---DNS, uptime, redirects, geolocation, request.cf, probes
---Edge Platform---Cache, crypto, auth helpers, flags, Secrets Store, Tail, Realtime
---Compute & Isolation---Containers, Sandbox SDK, Dynamic Workers (Loader), Workers for Platforms
---Storage & Data---R2, D1, KV, Vectorize, Hyperdrive, Pipelines
---Stateful & Async---Durable Objects, Cron, Queues, Workflows, Email, Analytics Engine

If an experiment spans categories, pick the primary capability shown in its README and issue proposal.

Updating existing docs

When changing an experiment:

  1. Diff routes, types, wrangler.json, and README
  2. Update only the affected MDX sections (API, errors, config, deployment notes)
  3. Keep curl examples in sync with path and query names
  4. Run npm run build in apps/docs

Do not remove documented error codes that still exist in code, and do not document routes that were deleted.

Accuracy checklist

Before merging:

  • Every endpoint in docs exists in src/routes/ or src/index.ts
  • Error code strings match jsonError(c, message, "CODE") in source
  • Response JSON matches TypeScript types
  • Binding setup matches wrangler.json and src/types/env.d.ts
  • Page entry exists in meta.json
  • New experiment or notable user-facing change listed on What's New
  • status: new only on the latest What's New cohort (older badges cleared; home-content.ts matched)
  • Deploy URL uses apps/experiments/<name>
  • apps/docs build passes

Agent / Cursor skill

The experiment-docs skill (.cursor/skills/experiment-docs/SKILL.md) instructs Cursor agents to:

  • Run the scaffold script
  • Follow the template at .cursor/skills/experiment-docs/template.mdx
  • Update meta.json, README, and What's New
  • Rotate status: new badges from the latest What's New batch
  • Verify the docs build

Invoke it when adding or updating experiment documentation.

On this page