Skip to main content

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.toml full 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

FeatureCloudflare WorkersCodehooks
Webhook backend setupWorkers + D1/KV + Queues + Cron, wired via wrangler.toml bindingsSingle platform, one deploy
Deploymentwrangler deploy (seconds)coho deploy (~5 seconds)
Cold startsNone — V8 isolates (~0 ms)None
Global edge latencyYes — runs in 300+ locationsRegional
DatabaseD1 (SQLite — SQL schema + migrations) or KV (eventually consistent)Built-in NoSQL document database + key-value store
Queues / workersQueues (separate product, needs a consumer Worker)Built-in queues and workers
Cron jobsCron Triggers (5 per account on free)Built-in, simple cron syntax
Object storageR2 (zero egress fees)Built-in file storage
Pricing modelPer-product metering (requests + CPU-ms + D1 rows + queue ops…)Flat-rate, unlimited compute
Configurationwrangler.toml + per-resource bindingsZero config
Webhook signaturesManual via Web Crypto APIrequest.rawBody built in + templates
AI agent supportAgents 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)

PlanPriceAPI CallsDatabaseCompute
DevelopmentFree60/min150 MBIncluded
Pro$19/mo3,600/min15 GBUnlimited
Team$99/mo6,000/min25 GBUnlimited

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 handlingrequest.rawBody for signatures, plus provider templates (Stripe, Shopify, GitHub, Discord, Twilio, and more)
  • A backend your AI agent can build CLI-firstcoho deploy from 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?
Not for global latency — and we won't pretend otherwise. Cloudflare Workers run at the edge in 300+ locations with near-zero cold starts, so for users spread worldwide, Cloudflare is faster. Codehooks runs regionally and optimizes for a different thing: getting a complete webhook backend — database, queues, cron — live in one deploy without assembling separate products. Choose Cloudflare if global edge latency is your priority; choose Codehooks if integrated simplicity is.
Do Codehooks endpoints have cold starts?
No — and neither do Cloudflare Workers. Cold starts aren't a differentiator here. Both platforms respond immediately, which matters for webhook reliability where senders may time out and retry. This is one area where Cloudflare and Codehooks are equally strong.
Can Cloudflare handle more scale than Codehooks?
At very high request volume, yes — Cloudflare's edge network and low per-unit pricing are hard to beat. Codehooks targets typical webhook, API, and automation workloads with flat-rate pricing and unlimited compute. If you're processing billions of requests a month, Cloudflare's economics win; if you want predictable costs and zero assembly for a normal webhook backend, Codehooks is simpler.
What's the difference between Cloudflare D1 and the Codehooks database?
D1 is serverless SQLite — a real SQL database, but you bind it in 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?
KV is eventually consistent — writes can take up to 60 seconds to propagate — and the free tier allows only 1,000 writes/day. That makes it a poor fit for transactional webhook state, which is why Cloudflare points you to D1 or Durable Objects for that. Codehooks' built-in document database is immediately consistent and has no per-write daily cap on paid plans.
Does Cloudflare support AI agents and MCP?
Yes — Cloudflare has an official Agents SDK and lets you build and host remote MCP servers on Workers. It's a credible agent platform, and we won't claim otherwise. The Codehooks difference is packaging: because it's CLI-first and all-in-one, an agent can build a *complete* webhook backend — routes, database, queues, cron — in a single coho deploy, without wiring up separate products.
How do webhook signatures work on each platform?
On Cloudflare you read the raw body with 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?
Absolutely. A common setup is keeping Cloudflare for DNS, CDN, edge caching, and R2 storage, while running your webhook and API backend on Codehooks. You can point a Cloudflare-managed custom domain at your Codehooks endpoints and get the best of both.

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

See how Codehooks compares to other backends for webhook handling:

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.