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/static-assets/README.md
1# Cloudflare Static Assets Skill Reference23Expert guidance for deploying and configuring static assets with Cloudflare Workers. This skill covers configuration patterns, routing architectures, asset binding usage, and best practices for SPAs, SSG sites, and full-stack applications.45## Quick Start67```jsonc8// wrangler.jsonc9{10"name": "my-app",11"main": "src/index.ts",12"compatibility_date": "2025-01-01",13"assets": {14"directory": "./dist"15}16}17```1819```typescript20// src/index.ts21export default {22async fetch(request: Request, env: Env): Promise<Response> {23return env.ASSETS.fetch(request);24}25};26```2728Deploy: `wrangler deploy`2930## When to Use Workers Static Assets vs Pages3132| Factor | Workers Static Assets | Cloudflare Pages |33|--------|----------------------|------------------|34| **Use case** | Hybrid apps (static + dynamic API) | Static sites, SSG |35| **Worker control** | Full control over routing | Limited (Functions) |36| **Configuration** | Code-first, flexible | Git-based, opinionated |37| **Dynamic routing** | Worker-first patterns | Functions (_functions/) |38| **Best for** | Full-stack apps, SPAs with APIs | Jamstack, static docs |3940**Decision tree:**4142- Need custom routing logic? → Workers Static Assets43- Pure static site or SSG? → Pages44- API routes + SPA? → Workers Static Assets45- Framework (Next, Nuxt, Remix)? → Pages4647## Reading Order48491. **configuration.md** - Setup, wrangler.jsonc options, routing patterns502. **api.md** - ASSETS binding API, request/response handling513. **patterns.md** - Common patterns (SPA, API routes, auth, A/B testing)524. **gotchas.md** - Limits, errors, performance tips5354## In This Reference5556- **[configuration.md](configuration.md)** - Setup, deployment, configuration57- **[api.md](api.md)** - API endpoints, methods, interfaces58- **[patterns.md](patterns.md)** - Common patterns, use cases, examples59- **[gotchas.md](gotchas.md)** - Troubleshooting, best practices, limitations6061## See Also6263- [Cloudflare Workers Docs](https://developers.cloudflare.com/workers/)64- [Static Assets Docs](https://developers.cloudflare.com/workers/static-assets/)65- [Cloudflare Pages](https://developers.cloudflare.com/pages/)66