cloudflare-workers-frameworks
Framework integration for Cloudflare Workers. Use when building with Hono, Remix, Next.js, Astro, SvelteKit, Qwik, or Nuxt on Workers. Covers routing, SSR, static assets, and edge deployment.
- 0
- Installs
- —
- Rating
- —
- Success rate
- 12
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 25430a9d616e8d6b… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Workers Frameworks Integration
Build full-stack applications on Cloudflare Workers using modern frameworks.
Quick Start: Choose Your Framework
| Framework | Best For | SSR | Static | Workers Native |
|---|---|---|---|---|
| Hono | APIs, lightweight apps | ✅ | ✅ | ✅ Native |
| Remix | Full-stack apps | ✅ | ✅ | ✅ Adapter |
| Next.js | React apps | ✅ | ✅ | ⚠️ OpenNext |
| Astro | Content sites | ✅ | ✅ | ✅ Adapter |
| SvelteKit | Svelte apps | ✅ | ✅ | ✅ Adapter |
| Qwik | Resumable apps | ✅ | ✅ | ✅ Adapter |
| Nuxt | Vue apps | ✅ | ✅ | ✅ Nitro |
Framework Decision Tree
Need an API only?
└─ Yes → Hono (fastest, smallest)
└─ No → Building a full app?
└─ React → Next.js (OpenNext) or Remix
└─ Vue → Nuxt
└─ Svelte → SvelteKit
└─ Content-heavy → Astro
└─ Max performance → Qwik
Top 10 Framework Errors
| Error | Framework | Cause | Solution |
|---|---|---|---|
No matching export "default" | All | Wrong export format | Use export default app not module.exports |
Worker exceeded CPU limit | Next.js | Heavy SSR | Use ISR, reduce bundle size |
Cannot read properties of undefined (reading 'env') | Remix | Missing context | Pass context to loader/action |
globalThis is not defined | All | Node.js globals | Use nodejs_compat flag |
Dynamic require not supported | All | CJS in ESM | Convert to ESM imports |
Response body is locked | All | Body already read | Clone response before reading |
Bindings not available | All | Missing wrangler config | Add bindings to wrangler.jsonc |
404 on static assets | All | Wrong assets config | Configure assets in wrangler.jsonc |
Hydration mismatch | React/Vue | Server/client differ | Ensure consistent rendering |
Maximum call stack exceeded | All | Circular imports | Refactor module structure |
Hono Quick Start (Recommended)
// src/index.ts
import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { logger } from 'hono/logger';
interface Env {
DB: D1Database;
KV: KVNamespace;
}
const app = new Hono<{ Bindings: Env }>();
// Middleware
app.use('*', logger());
app.use('/api/*', cors());
// Routes
app.get('/', (c) => c.text('Hello Workers!'));
app.get('/api/users', async (c) => {
const { results } = await c.env.DB.prepare('SELECT * FROM users').all();
return c.json(results);
});
app.post('/api/users', async (c) => {
const { name, email } = await c.req.json();
await c.env.DB.prepare('INSERT INTO users (name, email) VALUES (?, ?)')
.bind(name, email)
.run();
return c.json({ success: true }, 201);
});
export default app;
// wrangler.jsonc
{
"name": "my-app",
"main": "src/index.ts",
"compatibility_date": "2024-12-01",
"compatibility_flags": ["nodejs_compat"],
"d1_databases": [
{ "binding": "DB", "database_name": "my-db", "database_id": "xxx" }
]
}
Static Assets Configuration
// wrangler.jsonc - Serving static files
{
"name": "my-app",
"main": "src/index.ts",
"assets": {
"directory": "./public",
"binding": "ASSETS"
}
}
// Serve static with fallback to app
import { Hono } from 'hono';
const app = new Hono<{ Bindings: { ASSETS: Fetcher } }>();
// API routes
app.get('/api/*', apiHandler);
// Static assets fallback
app.get('*', async (c) => {
return c.env.ASSETS.fetch(c.req.raw);
});
export default app;
When to Load References
Load the specific framework reference when user:
| Reference | Load When |
|---|---|
references/hono.md | Building APIs, microservices, or lightweight apps |
references/remix.md | Full-stack React with loaders/actions |
references/nextjs.md | Next.js App Router on Workers via OpenNext |
references/astro.md | Content sites, blogs, docs, marketing pages |
references/sveltekit.md | Svelte applications on Workers |
references/qwik.md | Resumable apps, instant loading |
references/nuxt.md | Vue 3 applications with Nitro |
Common Patterns Across Frameworks
Environment Bindings Access
// Hono
app.get('/', (c) => c.env.DB.prepare('...'));
// Remix
export async function loader({ context }) {
return context.cloudflare.env.DB.prepare('...');
}
// Astro
const db = Astro.locals.runtime.env.DB;
// SvelteKit
export async function load({ platform }) {
return platform.env.DB.prepare('...');
}
// Nuxt
const { cloudflare } = useRuntimeConfig();
// Or via nitro: event.context.cloudflare.env.DB
Error Handling Pattern
// Universal error boundary pattern
app.onError((err, c) => {
console.error(`[${c.req.path}] ${err.message}`);
if (err instanceof HTTPException) {
return err.getResponse();
}
return c.json(
{ error: 'Internal Server Error' },
500
);
});
Performance Tips
- Bundle Size: Keep under 1MB compressed
- Cold Starts: Minimize top-level code
- Streaming: Use streaming SSR when available
- Caching: Leverage Cache API and CDN
- Code Splitting: Dynamic imports for routes
See Also
workers-performance- Optimization techniquesworkers-runtime-apis- Workers APIs referencecloudflare-worker-base- Basic Workers setup
Files
12- SKILL.md
dfbc8089105.6 KB - references/astro.md
1072258d7e8.7 KB - references/hono.md
f77da2ffea14.8 KB - references/nextjs.md
f8b850ce3710.2 KB - references/nuxt.md
879c6c76739.8 KB - references/qwik.md
4af504af3e10.3 KB - references/remix.md
d0c096fcf613.3 KB - references/sveltekit.md
42865a41ce10.4 KB - templates/hono-app.ts
f29ce6a0017.2 KB - templates/nextjs-route.ts
1c90bf72c010.3 KB - templates/nuxt-server.ts
b9dee4090e14.1 KB - templates/sveltekit-route.ts
988750c5bb10.7 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from secondsky/claude-skills8
[TODO: Write comprehensive description in third-person. Start with "This skill provides..." or "This skill should be used when..."] [TODO: Add "Use when" scenarios - specific situations where Claude should use this skill] [TODO: Add keywords - technologies, use cases, error messages that should tr
100+ animated React components (Aceternity UI) for Next.js with Tailwind. Use for hero sections, parallax, 3D effects, or encountering animation, shadcn CLI integration errors.
Secure API authentication with JWT, OAuth 2.0, API keys. Use for authentication systems, third-party integrations, service-to-service communication, or encountering token management, security headers, auth flow errors.
Creates comprehensive API changelogs documenting breaking changes, deprecations, and migration strategies for API consumers. Use when managing API versions, communicating breaking changes, or creating upgrade guides.
Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact. Use when testing microservices communication, preventing breaking changes, or validating OpenAPI specifications.
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
Builds flexible API filtering and sorting systems with query parameter parsing, validation, and security. Use when implementing search endpoints, building data grids, or creating dynamic query APIs.
Related devops skillsscan passed
Kubernetes workload patterns, resource management, RBAC, probes, autoscaling, ConfigMap/Secret handling, and kubectl debugging for production-grade deployments. Use when writing or reviewing Kubernetes manifests, or debugging probes, RBAC, autoscaling, or resource limits.
Deploys and configures classic Firebase Hosting for static websites, single-page apps (SPAs), and microservices. Use when deploying static sites/SPAs, setting up custom domains, configuring firebase.json hosting settings (redirects, rewrites, headers, multi-site), or managing preview channels. Don't
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Sets up AWS Resilience Hub v2 from scratch: creates resilience policies with SLO targets, registers systems and user journeys, onboards services with input sources, and runs a first failure mode assessment. Applies when the user wants to get started with Resilience Hub v2, create a policy, onboard a