Cloudflare Workers Alternative: The Complete Backend for Webhooks
Why Developers Look for a Cloudflare Workers Alternative
Cloudflare Workers is an excellent edge platform — near-zero cold starts, a global network, and a generous free tier. But Workers is compute. The moment your webhook handler needs to store an event, process it asynchronously, and run a scheduled cleanup, you're no longer using one product — you're assembling four, each with its own binding, billing meter, and quirks.
Many developers look for a Cloudflare Workers alternative when they realize a simple webhook backend means wiring together:
- Workers for the HTTP handler
- D1 (SQLite) for storage — with your own schema and migrations — or KV, which is eventually consistent and capped at 1,000 writes/day on the free tier
- Queues for async processing — which needs a second Worker as the consumer
- Cron Triggers for scheduled jobs
- A
wrangler.tomlfull of bindings tying it all together
It works, and at scale it's cheap. But for getting a webhook backend live, it's a lot of moving parts. Codehooks takes the opposite approach: the database, queues, workers, and cron are already there, behind every endpoint.
Codehooks: The Complete Backend for Webhooks
Codehooks gives you a real NoSQL database, key-value store, worker queues, and cron behind every route — so you can receive, store, process, and deliver webhooks from a single coho deploy. There are no products to provision and no bindings to declare. You import one library and everything is available:
import { app, Datastore } from 'codehooks-js';
// Database, routes, queues, jobs, key-value store — all available.
Key Differences
| Feature | Cloudflare Workers | Codehooks |
|---|---|---|
| Webhook backend setup | Workers + D1/KV + Queues + Cron, wired via wrangler.toml bindings | Single platform, one deploy |
| Deployment | wrangler deploy (seconds) | coho deploy (~5 seconds) |
| Cold starts | None — V8 isolates (~0 ms) | None |
| Global edge latency | Yes — runs in 300+ locations | Regional |
| Database | D1 (SQLite — SQL schema + migrations) or KV (eventually consistent) | Built-in NoSQL document database + key-value store |
| Queues / workers | Queues (separate product, needs a consumer Worker) | Built-in queues and workers |
| Cron jobs | Cron Triggers (5 per account on free) | Built-in, simple cron syntax |
| Object storage | R2 (zero egress fees) | Built-in file storage |
| Pricing model | Per-product metering (requests + CPU-ms + D1 rows + queue ops…) | Flat-rate, unlimited compute |
| Configuration | wrangler.toml + per-resource bindings | Zero config |
| Webhook signatures | Manual via Web Crypto API | request.rawBody built in + templates |
| AI agent support | Agents SDK + MCP (official) | CLI-first, MCP, Claude Code plugin |
Cloudflare wins on edge performance and scale (more on that below). Codehooks wins on assembly cost — how much you wire together before a webhook backend is live.
The Assembly Problem
To handle a single workflow — receive a Stripe webhook, store it, process it asynchronously, and clean up old records nightly — Cloudflare asks you to compose several products:
Cloudflare (4 products + a multi-Worker layout, tied together in wrangler.toml)
Codehooks (1 platform, 1 deploy)
Each Cloudflare product is bound explicitly in wrangler.toml, billed on its own meter, and behaves differently (D1 needs migrations; KV is eventually consistent; a Queue needs a separate consumer Worker). On Codehooks, the database, queue, and cron are primitives in the same project — nothing to provision or wire.
Pricing: Cloudflare Workers vs Codehooks
We'll be straight about this: Cloudflare is often cheaper, both at entry and at high scale. Workers Paid is $5/month, the free tiers are generous (100K requests/day on Workers, 5M row reads/day on D1), and the per-unit overage rates are very low. If raw cost at scale is your top priority, Cloudflare is hard to beat.
What you trade for that is predictability. A Cloudflare webhook backend's bill is the sum of several meters:
- Workers Paid: $5/mo — 10M requests + 30M CPU-ms included, then $0.30/M requests and $0.02/M CPU-ms
- D1: rows read/written + storage — e.g. $1.00 per million rows written beyond the included 50M/mo
- Queues: ~$0.40 per million operations (each 64 KB read/write/delete counts as an operation)
- KV / R2 / Durable Objects: each metered separately again if you use them
Codehooks Pricing (Flat-rate)
| Plan | Price | API Calls | Database | Compute |
|---|---|---|---|---|
| Development | Free | 60/min | 150 MB | Included |
| Pro | $19/mo | 3,600/min | 15 GB | Unlimited |
| Team | $99/mo | 6,000/min | 25 GB | Unlimited |
With Codehooks, the database, queues, workers, and cron are included — one number, no per-row or per-operation metering, unlimited compute. You may pay a bit more than a minimal Cloudflare setup at low volume, but you always know exactly what the bill is.
Code Comparison: Stripe Webhook Handler
Cloudflare Workers Implementation
A Worker that verifies a Stripe signature and stores the event needs Web Crypto (there's no Node crypto module), a D1 binding, and a wrangler.toml:
// src/index.js — Cloudflare Worker
import Stripe from 'stripe';
export default {
async fetch(request, env) {
const stripe = new Stripe(env.STRIPE_SECRET_KEY);
const sig = request.headers.get('stripe-signature');
// Must read the RAW body before any JSON parse, or the signature won't match
const body = await request.text();
let event;
try {
event = await stripe.webhooks.constructEventAsync(
body,
sig,
env.STRIPE_WEBHOOK_SECRET
);
} catch (err) {
return new Response(`Webhook Error: ${err.message}`, { status: 400 });
}
if (event.type === 'payment_intent.succeeded') {
const pi = event.data.object;
// D1 must be bound in wrangler.toml, and the table created via migrations
await env.DB.prepare(
'INSERT INTO payments (stripe_id, amount, status, created_at) VALUES (?, ?, ?, ?)'
).bind(pi.id, pi.amount, 'succeeded', new Date().toISOString()).run();
}
return Response.json({ received: true });
},
};
Plus the binding configuration:
# wrangler.toml
name = "stripe-webhook"
main = "src/index.js"
[[d1_databases]]
binding = "DB"
database_name = "payments"
database_id = "<your-d1-database-id>"
…and a migration to create the payments table before any of it works. Deploy with wrangler deploy.
Codehooks Implementation
// index.js — Codehooks
import { app, Datastore } from 'codehooks-js';
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
// Bypass JWT auth for the webhook endpoint
app.auth('/stripe-webhook', (req, res, next) => next());
app.post('/stripe-webhook', async (req, res) => {
const sig = req.headers['stripe-signature'];
try {
const event = stripe.webhooks.constructEvent(
req.rawBody,
sig,
process.env.STRIPE_WEBHOOK_SECRET
);
if (event.type === 'payment_intent.succeeded') {
const conn = await Datastore.open();
await conn.insertOne('payments', {
stripeId: event.data.object.id,
amount: event.data.object.amount,
status: 'succeeded',
createdAt: new Date().toISOString(),
});
}
res.json({ received: true });
} catch (err) {
res.status(400).json({ error: `Webhook Error: ${err.message}` });
}
});
export default app.init();
No bindings file, no migration, no separate database to provision. req.rawBody is available for signature verification out of the box. Deploy with coho deploy (~5 seconds), or start from a template:
coho create mystripehandler --template webhook-stripe-minimal
coho deploy
Adding Async Processing and a Scheduled Job
On Cloudflare, async work means a Queue (producer binding + a second consumer Worker) and the daily cleanup means a Cron Trigger entry in wrangler.toml. On Codehooks, both are primitives in the same file:
import { app, Datastore } from 'codehooks-js';
// Background worker — enqueue with conn.enqueue('processPayment', {...})
app.worker('processPayment', async (req, res) => {
const { stripeId } = req.body.payload;
// ...process the payment event
res.end();
});
// Daily cleanup at midnight — no separate trigger to configure
app.job('0 0 * * *', async (req, res) => {
const conn = await Datastore.open();
const cutoff = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
await conn.removeMany('events', { createdAt: { $lt: cutoff.toISOString() } });
res.end();
});
export default app.init();
When to Choose Each Platform
Keep Cloudflare Workers When You Need:
Cloudflare is genuinely excellent, and for several workloads it's the better choice:
- Global edge latency — code runs in 300+ locations close to users; a regional backend can't match that
- Very high scale — Cloudflare's per-unit pricing and network are hard to beat at high request volume
- Zero-egress object storage — R2 charges no data-transfer fees, a real advantage for media-heavy apps
- Stateful edge coordination — Durable Objects for strongly consistent, real-time coordination
- An existing Cloudflare footprint — you already run DNS, CDN, or Pages there
- Edge-native AI agents — Cloudflare's Agents SDK and remote MCP servers are a serious, official platform
Choose Codehooks When You Need:
- A webhook backend live in one deploy — no Workers + D1 + Queues + Cron assembly
- A database, queues, and cron behind every endpoint — built in, zero config, nothing to provision or bind
- A document database — NoSQL with familiar queries, instead of SQLite schemas/migrations or eventually-consistent KV
- Predictable, flat-rate pricing — one number with unlimited compute, not a sum of per-request, per-row, and per-operation meters
- Built-in webhook handling —
request.rawBodyfor signatures, plus provider templates (Stripe, Shopify, GitHub, Discord, Twilio, and more) - A backend your AI agent can build CLI-first —
coho deployfrom the terminal, or via the Claude Code plugin and MCP server
The two aren't mutually exclusive — plenty of teams keep Cloudflare for DNS, CDN, and edge caching and run their webhook backend on Codehooks.
Cloudflare Workers Alternative FAQ
Common questions about Cloudflare Workers vs Codehooks for webhook backends
Is Codehooks faster or lower-latency than Cloudflare Workers?
Do Codehooks endpoints have cold starts?
Can Cloudflare handle more scale than Codehooks?
What's the difference between Cloudflare D1 and the Codehooks database?
wrangler.toml, define a schema, and run migrations, and it's billed on rows read/written. Codehooks includes a NoSQL document database (plus a key-value store) behind every endpoint with no provisioning, no schema migrations, and no per-row billing. D1 is the better fit for relational, SQL-heavy data; Codehooks is simpler for storing and querying webhook payloads.Why not just use Workers KV for webhook storage?
Does Cloudflare support AI agents and MCP?
coho deploy, without wiring up separate products.How do webhook signatures work on each platform?
request.text() and verify it with the Web Crypto API (there's no Node crypto module), being careful to verify the raw bytes before parsing JSON. Codehooks exposes request.rawBody directly and ships provider templates with signature verification already wired in, so there's less to get wrong.Can I use Cloudflare and Codehooks together?
Conclusion
Choose Codehooks over Cloudflare Workers when:
- You're building a webhook backend and want it live in one deploy
- You'd rather not assemble Workers + D1 + Queues + Cron and wire them in
wrangler.toml - You want a document database, queues, and cron included behind every endpoint
- You prefer one predictable flat rate over several usage meters
- You want built-in webhook signature handling and provider templates
Keep Cloudflare Workers when:
- Global edge latency for a worldwide audience is critical
- You're operating at very high scale where per-unit pricing dominates
- You need zero-egress object storage (R2) or stateful edge coordination (Durable Objects)
- You're already invested in the Cloudflare ecosystem
Cloudflare Workers is a world-class edge compute platform. Codehooks isn't trying to replace the edge — it's the complete backend for webhooks for developers who want the database, queues, and cron already there, deployed in seconds, with one predictable bill.
Ready to try Codehooks? Deploy your first webhook handler in under a minute:
npm install -g codehooks
coho create mystripehandler --template webhook-stripe-minimal
coho deploy
Related comparisons
See how Codehooks compares to other backends for webhook handling:
- Firebase alternative for webhooks — a complete webhook backend vs Cloud Functions + Firestore
- Supabase vs Codehooks pricing — flat-rate unlimited compute vs metered functions
- Supabase vs Codehooks technical comparison — CLI-first webhook backend vs dashboard-first Postgres
- AWS Lambda alternative for webhooks — one platform vs Lambda + API Gateway + DynamoDB
Building with an AI agent? See the AI Agent Setup guide for the Claude Code plugin, coho prompt, and MCP server — so your agent can build and deploy the webhook handler for you.