bun-cloudflare-workers

Build and deploy Cloudflare Workers applications using Bun and Wrangler.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-cloudflare-workers-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-cloudflare-workers
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-cloudflare-workers
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-cloudflare-workers-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires wrangler, @cloudflare/workers-types, hono, miniflare, and includes references (resource) components.

What problem does it solve? Developers building edge applications on Cloudflare Workers with Bun need correct project scaffolding, wrangler configuration, and knowledge of which APIs work in the V8 Workers runtime versus Bun-specific APIs, and mistakes here cause deployment failures and runtime errors. ## Core Features & Use Cases - Project Scaffolding & Configuration: Set up package.json scripts, wrangler.toml bindings, and Bun-based dev and deploy workflows. - Workers Runtime Patterns: Implement fetch handlers, Hono routing, KV storage, D1 databases, Durable Objects, R2 buckets, and cron triggers. - Testing & Production Builds: Test workers with bun:test and Miniflare, then bundle with Bun.build targeting browser APIs before deploying with wrangler. - Use Case: A developer wants to ship a JSON API backed by D1 and KV on Cloudflare's edge network; this Skill provides the wrangler.toml bindings, typed Env interfaces, and deploy commands to get it running. ## Quick Start Ask the assistant to scaffold a new Cloudflare Workers project with Bun, configure wrangler.toml with KV and D1 bindings, and deploy it.

Frequently Asked Questions about bun-cloudflare-workers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Cloudflare Worker using Bun?

Create a project with bunx create-cloudflare, install dependencies with bun install, then run wrangler deploy via the deploy script in package.json. Bun handles TypeScript during local development while wrangler publishes the worker.

How to use KV and D1 bindings in a Cloudflare Worker?

Declare kv_namespaces and d1_databases bindings in wrangler.toml, then access them through the env parameter in your fetch handler. Use env.KV.get/put for key-value storage and env.DB.prepare().bind().run() for SQL queries.

Can I use Bun APIs like Bun.file or Bun.serve in Cloudflare Workers?

No, Cloudflare Workers run on the V8 runtime with Web APIs only. Use fetch, Request, Response, URL, crypto, and TextEncoder; Bun-specific APIs like Bun.file, Bun.serve, bun:sqlite, fs, and child_process are unavailable.

Why does my Cloudflare Worker fail with script too large or CPU time exceeded errors?

Script too large means the bundle exceeds the 10MB limit, so optimize with minification and smaller dependencies. CPU time exceeded indicates long-running execution, which should be optimized or moved to queues.

How do I test Cloudflare Workers locally with Bun?

Use bun:test with a mocked fetch handler for unit tests, or use Miniflare to simulate the Workers runtime with KV namespaces locally. Run bun run dev to start wrangler dev for live development.