templates
CLAUDE.md2.1k starsChanged 11 months agoMITView on GitHub
This is the Cloudflare Workers Templates repository containing a collection of starter templates for building full-stack applications on the Cloudflare Workers platform. The repository is structured as a monorepo with: Each template follows a consistent structure: The repository includes a sophisticated CLI tool that: Key CLI commands used internally: Uses Turbo for coordinated builds across templates: Templates are high-quality, tangible use-case driven examples of applications built using Cloudflare Workers. They should be practical applications demonstrating technology, not sandboxed environments. Templates…
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about cloudflare/templates
- cloudflare/workers-sdk“Vite plugin has race condition with HMR - `A hanging Promise was canceled.`”GitHub · Jun 6, 2025 · 13 reactions
- cloudflare/workers-sdk“Container builds incompatible with podman”GitHub · Jun 26, 2025 · 12 reactions
- cloudflare/workerd“Switch to hard tabs for indentation”GitHub · Sep 27, 2022 · 7 reactions
- cloudflare/ai-utils“Switch to hard tabs for indentation”GitHub · Jun 27, 2024 · 3 reactions
- tursodatabase/libsql-client-ts“Cloudflare worker error with opennextjs-cloudflare”GitHub · Mar 18, 2025 · 2 reactions
The biggest 5 of 5 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-visibility-template/AGENTS.mdAGENTS.md
- ai-brand-visibility-template/AGENTS.mdAGENTS.md
- x402-proxy-template/AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 125
Frontend Component: Must have visual UI that clearly demonstrates functionality
- Distinctive: line 138
Worker Binding: Every template must use at least one Worker binding
- Distinctive: line 139
API Router: Use Hono unless project specifically needs different router
- Very specific: line 145
Must use wrangler.json or wrangler.jsonc format (not .toml)
- Distinctive: line 154
Latest Versions: Use latest Wrangler and compatibility date
- Distinctive: line 156
Workers Assets: Use Workers Assets for frontend instead of Pages
- Distinctive: line 158
No Experimental Features: Use stable, current best practices
- Very specific: line 188
Before making changes: Run pnpm run check to ensure clean state
- Very specific: line 189
After making changes: Run pnpm run fix to auto-format and lint
- Very specific: line 190
Before committing: Ensure pnpm run test passes
- Very specific: line 191
For new templates: Follow the template requirements checklist in CONTRIBUTING.md
- Very specific: line 197
Generate lockfile: Run pnpm run fix:lockfiles to create package-lock.json
- Very specific: line 201
Validation: Run pnpm run check:templates to ensure compliance
- Very specific: line 213
When working with templates, always use the provided CLI commands rather than manual processes to ensure consistency and compliance with …
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is the Cloudflare Workers Templates repository containing a collection of starter templates for building full-stack applications on the Cloudflare Workers platform. The repository is structured as a monorepo with:
- Individual template directories (each ending in
-template) - Custom CLI tool (
cli/) for template management and validation - Turbo build system for managing multiple projects
- Playwright E2E tests for template validation
Essential Commands
Development Commands
# Check all templates and code quality
pnpm run check
# Fix formatting and linting issues automatically
pnpm run fix
# Run all tests (includes template validation)
pnpm run test
# Run Playwright E2E tests
pnpm run test:e2e
# Run CLI tests specifically
pnpm run test:cliTemplate Management Commands
# Lint all templates for compliance
pnpm run check:templates
# Fix template issues automatically
pnpm run fix:templates
# Generate npm lockfiles for all templates
pnpm run fix:lockfiles
# Validate live demo links
pnpm run validate-live-demo-links
# Validate Deploy to Cloudflare buttons
pnpm run validate-d2c-buttonsDeployment Commands
# Deploy all templates
pnpm run deploy
# Deploy live demos
pnpm run deploy-live-demos
# Upload templates to Cloudflare Templates API
pnpm run uploadArchitecture Overview
Template Structure
Each template follows a consistent structure:
package.jsonwith required Cloudflare metadatawrangler.jsonorwrangler.jsonc(not.toml)README.mdwith Deploy to Cloudflare button- TypeScript configuration
- Worker source code typically in
src/
Custom CLI (cli/)
The repository includes a sophisticated CLI tool that:
- Validates template configuration and structure
- Uploads templates to Cloudflare's Templates API
- Deploys live demos for each template
- Manages dependencies across all templates
- Enforces consistent standards via linting
Key CLI commands used internally:
templates lint- Validate template compliancetemplates upload- Upload to Templates APItemplates deploy-live-demos- Deploy previews
Build System
Uses Turbo for coordinated builds across templates:
- Parallel building of multiple templates
- Caching for improved performance
- Coordinated TypeScript compilation
Template Requirements and Best Practices
What Are Templates?
Templates are high-quality, tangible use-case driven examples of applications built using Cloudflare Workers. They should be practical applications demonstrating technology, not sandboxed environments.
Package.json Requirements
Templates must include:
nameending in-template(matching directory)description(one-line summary, keep brief)deployscript for Wrangler deploymentcloudflaremetadata object with:label(Title Case name for dashboard display)products(max 3 Cloudflare products, focus on unique ones)categories(from: "starter", "storage", "ai")preview_image_url(16:9 aspect ratio, provided by Growth team)publish: true(only if template should appear in dashboard)
Visual and Content Requirements
- Frontend Component: Must have visual UI that clearly demonstrates functionality
- Preview Image: Required 16:9 aspect ratio screenshot (minimum 500px width)
- README.md: Must include:
- Deploy to Cloudflare button
- Getting started section with local development instructions
- Dashboard content section wrapped in
<!-- dash-content-start -->and<!-- dash-content-end --> - Screenshot of live application
- Description of products used with documentation links
Technical Requirements
- Package-lock.json: Required for 80% faster module resolution
- Tests: Mandatory minimum of 5 tests using vitest
- Worker Binding: Every template must use at least one Worker binding
- API Router: Use Hono unless project specifically needs different router
- Top-level Environment: Bindings must be top-level for Deploy to Cloudflare compatibility
- Single Worker: Cannot be monorepo, must be single Worker application
Wrangler Configuration
- Must use
wrangler.jsonorwrangler.jsoncformat (not.toml) - Latest compatibility date
- Observability and Smart Placement enabled by default
- Source maps enabled for development
Code Standards and Best Practices
- TypeScript: Required for all templates
- Framework Recommendations: React + Vite, Next.js, React Router v7, or Astro
- Latest Versions: Use latest Wrangler and compatibility date
- Comments: Include educational comments explaining Cloudflare-specific features
- Workers Assets: Use Workers Assets for frontend instead of Pages
- Naming: Focus on use case, not underlying tech (e.g., "Astro AI Chat Bot" not "DO Template")
- No Experimental Features: Use stable, current best practices
Secrets and Environment Variables
- List all required secrets in README.md
- Include where users can find appropriate values
- Show missing configuration errors in deployed application UI
- Environment variables requiring user updates must be documented
Testing Strategy
Templates are validated through:
- Static analysis via custom CLI linting
- Build validation ensuring all templates compile
- E2E tests via Playwright
- Live demo validation ensuring deployed templates work
- Unit tests: Minimum 5 tests required using vitest-pool-workers package
Important Files
templates.json- Template registry with package hashesturbo.json- Build configurationplaywright.config.ts- E2E test configurationpnpm-workspace.yaml- Workspace configuration
Development Workflow
General Development
- Before making changes: Run
pnpm run checkto ensure clean state - After making changes: Run
pnpm run fixto auto-format and lint - Before committing: Ensure
pnpm run testpasses - For new templates: Follow the template requirements checklist in CONTRIBUTING.md
Template Creation Workflow
- Create directory: Name must end with
-template - Package.json setup: Include all required Cloudflare metadata
- Generate lockfile: Run
pnpm run fix:lockfilesto create package-lock.json - Add tests: Minimum 5 tests using vitest
- README content: Include Deploy to Cloudflare button and dashboard content sections
- Preview image: Provide 16:9 screenshot for Growth team to upload
- Validation: Run
pnpm run check:templatesto ensure compliance
CLI Tool Architecture
The custom CLI (cli/src/) handles:
- Template discovery and validation
- Cloudflare API integration
- GitHub integration for PR workflows
- Dependency management across templates
- Automated deployment processes
When working with templates, always use the provided CLI commands rather than manual processes to ensure consistency and compliance with repository standards.
Template Contribution FAQ
What makes a good template?
- Demonstrates practical use case, not just technology showcase
- Uses at least one Worker binding (D1, KV, R2, Durable Objects, etc.)
- Has clear visual UI that shows what the template does
- Follows Workers best practices with stable, non-experimental features
- Includes comprehensive tests and documentation
Which frameworks are recommended?
- React + Vite
- Next.js
- React Router v7 (new Remix)
- Astro
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

