Free Cloudflare Workers Cheat Sheet Online — Wrangler CLI, KV, D1, R2, Queues & Cron Triggers Reference
Cloudflare Workers run your code at the edge — on Cloudflare's global network of 330+ data centers in 120+ countries. Zero cold starts, zero server management, and your code executes as close to the user as physically possible. Our free interactive Cloudflare Workers Cheat Sheet gives you instant access to 120 wrangler CLI commands, Workers API snippets, KV/D1/R2/Queues operations, and edge deployment patterns across 10 categories, with real-time search, one-click copy, and an Edge Network Pulse aesthetic. No signup. No server. 100% client-side.
Why Cloudflare Workers Defines Modern Edge Computing
Cloudflare Workers has redefined what "serverless" means. Instead of deploying to a single region and paying for idle capacity, Workers run on every Cloudflare edge node simultaneously. A request from Tokyo hits the Tokyo edge. A request from London hits the London edge. No orchestration, no scaling configuration — just write a fetch() handler and deploy globally in under 10 seconds with npx wrangler deploy.
The Workers ecosystem has grown far beyond simple HTTP proxies. KV provides eventually-consistent key-value storage with read-optimized performance. D1 delivers SQLite-compatible relational database with automatic backups and point-in-time recovery. R2 offers S3-compatible object storage with zero egress fees — the feature that made bandwidth costs disappear. Queues decouple producers from consumers with at-least-once delivery. Durable Objects provide strongly consistent state, in-memory performance, and WebSocket coordination. Cron Triggers replace external schedulers. Our cheat sheet organizes this entire platform into 10 focused categories with every command, API, and pattern you need.
Wrangler CLI Fundamentals — The Developer's Command Center
Wrangler is the official CLI for Cloudflare Workers — the tool you use to create, develop, test, and deploy Workers. The Wrangler CLI Fundamentals category covers the complete command set: npx wrangler init (scaffold a new Worker project with TypeScript, wrangler.toml, and package.json), npx wrangler dev (local development server with live reload on localhost:8787), npx wrangler dev --remote (develop locally but connect to real KV, D1, R2, and Queues on the edge — no mocking needed), npx wrangler deploy (build and ship to Cloudflare's global network), npx wrangler tail (stream live production logs), npx wrangler whoami (confirm which account you're deploying to), and npx wrangler deploy --dry-run (validate without deploying). Every command includes the most-used flags and the scenario it solves.
Worker Configuration — The wrangler.toml Blueprint
Every Worker is configured through wrangler.toml. Our Worker Configuration category documents the essential settings: name (the Worker's identity, used for the workers.dev subdomain), main (entry point, default src/index.ts), compatibility_date (locks the runtime API version — newer dates enable newer APIs), compatibility_flags (feature flags like nodejs_compat for Node.js built-in modules), routes (custom domain patterns that trigger the Worker), workers_dev (enable/disable the preview subdomain), the [build] section for custom build commands and upload format configuration, and [env.production] / [env.staging] for environment-specific overrides. Understanding wrangler.toml prevents deployment misconfigurations and ensures every environment gets the right bindings, routes, and variables.
KV — Key-Value Store at the Edge
Workers KV is a globally distributed key-value store optimized for read-heavy workloads. Values are cached at every edge location, making reads extremely fast. Our KV category covers the complete API: creating namespaces with wrangler kv:namespace create, storing values with env.MY_KV.put(key, value, { expirationTtl, metadata }) (TTL-based expiration and arbitrary metadata), retrieving values with env.MY_KV.get(key) and getWithMetadata(key) (value + metadata in one call), deleting keys, listing keys with prefix filters and cursor-based pagination, and CLI operations for seeding data and inspecting namespaces. KV is eventually consistent — writes propagate globally within 60 seconds, making it ideal for configuration, routing data, user sessions, and static assets.
D1 — SQL Database at the Edge
D1 is Cloudflare's serverless SQL database, built on SQLite. Every D1 database is globally replicated for read access, with writes handled at a primary location. Our D1 category covers the full workflow: creating databases with wrangler d1 create, running SQL from files or inline commands with wrangler d1 execute, migrating schemas with wrangler d1 migrations create and migrations apply, parameterized queries with env.DB.prepare().bind().all() for SELECT and .run() for INSERT/UPDATE/DELETE, fetching single rows with .first(), batching multiple statements in a transaction with env.DB.batch() (all-or-nothing, up to 100 statements), and local development with --local flag for offline testing against a local SQLite copy. D1 supports indexes, foreign keys, and most SQLite SQL features — making it suitable for relational data that needs transactional consistency at the edge.
R2 — Object Storage Without Egress Fees
R2 is Cloudflare's S3-compatible object storage with a killer feature: zero egress fees. You pay only for storage and write operations — reading data is free. Our R2 category covers bucket creation, uploading objects with custom HTTP metadata (content-type, cache-control, content-disposition), downloading objects as text/JSON/stream, conditional GET with ETag matching, range requests for partial downloads (saving bandwidth for large files), listing objects with prefix filters and pagination, generating presigned public URLs for temporary sharing, and head requests for metadata without downloading. R2 integrates with Workers via the r2_buckets binding — env.MY_BUCKET.put(), .get(), .delete(), .list(), .head(). Use R2 for user uploads, static assets, logs, backups, and any data that needs to be stored durably and served globally.
Queues — Reliable Asynchronous Messaging
Cloudflare Queues provide at-least-once message delivery between Workers. Producers send messages; consumers receive batches and process them. Our Queues category covers: creating queues, sending single messages with env.MY_QUEUE.send(), sending batches of up to 100 messages with sendBatch() (much faster for high throughput), the consumer handler pattern (export default { async queue(batch, env) { ... } }), acknowledging successful processing with msg.ack(), retrying failed messages with msg.retry({ delaySeconds }), configuring max_retries and retry_delay with exponential backoff, and routing exhausted messages to a Dead Letter Queue for inspection. Queues decouple services — the producer doesn't wait for the consumer, and the consumer can process at its own pace with built-in retry logic.
Cron Triggers — Scheduled Workers Without a Scheduler
Cloudflare Workers can run on a schedule using cron triggers — no external cron service, no scheduled Lambda, no Kubernetes CronJob required. Our Cron Triggers category covers: defining schedules in wrangler.toml with the [triggers] crons array, implementing the scheduled(event, env, ctx) handler, reading event.cron to determine which trigger fired (when a Worker has multiple schedules), using event.scheduledTime (Unix ms timestamp), extending execution with ctx.waitUntil(asyncTask), and creating patterns for every frequency: every 5 minutes (*/5 * * * *), hourly (0 * * * *), daily at midnight (0 0 * * *), weekly on Sunday (0 2 * * 0), monthly on the 1st (0 9 1 * *), and Saturday at 23:45 UTC (45 23 * * 6). All times are UTC. Cron Workers are perfect for data cleanup, sending digest emails, generating reports, refreshing caches, and polling external APIs.
Service Bindings & Durable Objects — Direct Inter-Worker Communication
Service Bindings enable one Worker to call another directly — no HTTP, no DNS, no public internet. env.UPSTREAM.fetch(request) routes the request internally through Cloudflare's edge network with minimal latency. Our Bindings category also covers Durable Objects — Cloudflare's solution for strongly consistent state with in-memory performance. Each DO instance has its own storage API (this.state.storage.put/get/delete), supports WebSocket connections for real-time coordination, can set alarms for future execution (this.state.storage.setAlarm() with an alarm() handler), and uses idFromName() for deterministic routing or newUniqueId() for unique instances. DOs are ideal for collaborative editing, game rooms, rate limiters, session state, and any scenario requiring strong consistency without an external database.
Environment Variables & Secrets — Secure Configuration
Workers access configuration through plaintext vars and encrypted secrets. Our Environment & Secrets category covers: defining variables in wrangler.toml ([vars] API_URL = "https://api.example.com"), adding encrypted secrets with wrangler secret put API_KEY (prompts for value, encrypted at rest, never visible in dashboard), scoping secrets to environments (--env production), listing and deleting secrets, and accessing everything uniformly via env.VARIABLE_NAME in Worker code. Environment-specific configuration blocks keep production and staging values separate. Resource bindings (KV namespaces, D1 databases, R2 buckets, Queues) use their own binding syntax in wrangler.toml but are accessed the same way — env.MY_BINDING.
Advanced & Production Patterns — Workers at Scale
Production Workers use advanced patterns for reliability and performance. Our Advanced & Production category covers: the Cache API (caches.default) for edge caching with cache keys, tags, and TTLs, geolocation via request.cf.country (country, region, city, timezone, latitude/longitude, ASN, and edge colo code), Tail Workers for centralized logging (a dedicated Worker that receives execution logs from another Worker), TypeScript Env interface for type-safe bindings, path-based routing without a framework, fire-and-forget patterns with ctx.waitUntil() for non-blocking analytics and queuing, custom cache behavior on outbound fetch with cf.cacheTtl, cacheEverything, and cacheTags, Worker versioning (wrangler versions upload/list) and instant rollback (wrangler rollback), and Smart Placement (automatic routing to the optimal edge location based on backend latency).
The Edge Network Pulse — Aesthetic Design
Cloudflare Workers run code on the edge of the internet — a global network of data centers that processes requests as close to users as physically possible. Our Cloudflare Workers Cheat Sheet embraces The Edge Network Pulse aesthetic: a deep midnight indigo background (#060d18) with a faint fiber-optic grid — horizontal, vertical, and diagonal lines at barely-visible opacity — evoking a global network operations center monitoring traffic across continents. Forty-five data packet particles (small glowing cyan and orange dots) drift upward like packets traveling through fiber-optic cables, each at randomized size, speed, and delay.
Eight edge node indicators — orange-glowing dots scattered at strategic positions across the page — pulse with a slow, independent rhythm, representing Cloudflare's global data center locations coming online and processing traffic. The top-edge pulse bar animates with a cyan-to-orange gradient, mimicking a network heartbeat monitor. Chakra Petch — a geometric, technical sans-serif inspired by Thai letterforms — brings a distinctive engineered feel to the headings, unlike any other DevToolkit cheat sheet. Lexend provides clean, readable body text designed for accessibility. JetBrains Mono serves code snippets with monospace precision. The color palette maps to the Workers ecosystem: Fiber Cyan (#3bccf0, Wrangler CLI), Worker Orange (#f38020, Configuration), KV Green (#6bdd9a, Key-Value Store), D1 Violet (#a78bfa, SQL Database), R2 Amber (#f59e0b, Object Storage), Queue Pink (#ec4899, Queues), Cron Orange (#f97316, Cron Triggers), Binding Purple (#8b5cf6, Service Bindings & DO), Env Emerald (#10b981, Environment & Secrets), and Advanced Steel (#94a3b8, Production). This is not another dark-mode terminal reference; it's a deliberate, crafted space that makes edge computing feel like commanding a global network.
How This Cheat Sheet Fits Into Your Workflow
The Cloudflare Workers Cheat Sheet is part of the DevToolkit suite of free developer reference tools. It complements our Docker Compose Cheat Sheet (container orchestration for local development and staging), our DevOps Commands Cheat Sheet (CI/CD pipelines and infrastructure automation), our GitHub Actions CI/CD Cheat Sheet (automated deployment workflows), our Terraform Commands Cheat Sheet (infrastructure as code), our Linux Commands Cheat Sheet (the operating system fundamentals), and our Cron Job Expressions Cheat Sheet (scheduling reference for cron triggers). Together with Cloudflare Workers, they form a complete serverless-and-infrastructure reference cluster for full-stack developers building on the edge.
The workflow is simple: press Ctrl+K to focus the search bar, type what you need (a wrangler command, a KV API, a D1 query pattern, a cron expression), and the matching entries appear instantly. Click any card to copy its command or code snippet to your clipboard. Filter by category to narrow the view. Everything runs in your browser — no server requests, no signup, no tracking. Bookmark it, reference it while writing Workers, and stop toggling between Cloudflare Docs tabs.
Related Cheat Sheets
- Docker Compose Cheat Sheet — docker-compose.yml Commands & Configuration
- DevOps Commands Cheat Sheet — CI/CD & Infrastructure Automation
- GitHub Actions CI/CD Cheat Sheet — Workflow Automation
- Terraform Commands Cheat Sheet — Infrastructure as Code
- Linux Commands Cheat Sheet — 120+ Essential Terminal Commands
- Cron Job Expressions Cheat Sheet — Scheduling & Crontab Reference
- Docker Commands Cheat Sheet — Container Management Reference
- Kubernetes Commands Cheat Sheet — kubectl & Helm Reference