Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/c3/patterns.md
1# C3 Usage Patterns23## Quick Workflows45```bash6# TypeScript API Worker7npm create cloudflare@latest my-api -- --type=hello-world --lang=ts --deploy89# Next.js on Pages10npm create cloudflare@latest my-app -- --type=web-app --framework=next --platform=pages --ts --deploy1112# Astro static site13npm create cloudflare@latest my-blog -- --type=web-app --framework=astro --platform=pages --ts14```1516## CI/CD (GitHub Actions)1718```yaml19- name: Deploy20run: npm run deploy21env:22CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}23CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}24```2526**Non-interactive requires:**27```bash28--type=<value> # Required29--no-git # Recommended (CI already in git)30--no-deploy # Deploy separately with secrets31--framework=<value> # For web-app32--ts / --no-ts # Required33```3435## Monorepo3637C3 detects workspace config (`package.json` workspaces or `pnpm-workspace.yaml`).3839```bash40cd packages/41npm create cloudflare@latest my-worker -- --type=hello-world --lang=ts --no-deploy42```4344## Custom Templates4546```bash47# GitHub repo48npm create cloudflare@latest -- --template=username/repo49npm create cloudflare@latest -- --template=cloudflare/templates/worker-openapi5051# Local path52npm create cloudflare@latest my-app -- --template=../my-template53```5455**Template requires `c3.config.json`:**56```json57{58"name": "my-template",59"category": "hello-world",60"copies": [{ "path": "src/" }, { "path": "wrangler.jsonc" }],61"transforms": [{ "path": "package.json", "jsonc": { "name": "{{projectName}}" }}]62}63```6465## Existing Projects6667```bash68# Add Cloudflare to existing Worker69npm create cloudflare@latest . -- --type=pre-existing --existing-script=./dist/index.js7071# Add to existing framework app72npm create cloudflare@latest . -- --type=web-app --framework=next --platform=pages --ts73```7475## Post-Creation Checklist76771. Review `wrangler.jsonc` - set `compatibility_date`, verify `name`782. Create bindings: `wrangler kv namespace create`, `wrangler d1 create`, `wrangler r2 bucket create`793. Generate types: `npm run cf-typegen`804. Test: `npm run dev`815. Deploy: `npm run deploy`826. Set secrets: `wrangler secret put SECRET_NAME`83