Skip to content
Writing
CloudflareHonoEdgeServerless

Cloudflare Workers & Hono at the Edge: Ultra-Low Latency Email Dispatch

Execute email dispatch within 5ms of your users globally by deploying lightweight Hono applications to Cloudflare Workers.

Tayyab MughalFounder & AI Chief1 min read

Why edge runtimes excel at transactional email

Cloudflare Workers run in 300+ cities worldwide with zero cold starts. By pairing the ultrafast Hono framework with SadaSend REST endpoints, webhook ingestion and email dispatch execute with sub-10ms latency.

Complete Edge Worker (src/index.ts)

Here is the complete Hono worker deployed to Cloudflare Workers.

TYPESCRIPT
import { Hono } from 'hono';

type Bindings = {
  SADASEND_API_KEY: string;
};

const app = new Hono<{ Bindings: Bindings }>();

app.post('/api/send-alert', async (c) => {
  const body = await c.req.json<{ recipient: string; title: string; details: string }>();

  const res = await fetch('https://api.sadasend.com/v1/emails', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${c.env.SADASEND_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      to: body.recipient,
      subject: `[Alert] ${body.title}`,
      text: body.details,
    }),
  });

  const data = await res.json();
  return c.json(data, res.status as any);
});

export default app;

Deployment in 30 Seconds

Deploy immediately with Wrangler: npx wrangler secret put SADASEND_API_KEY && npx wrangler deploy

Free plan

Building AI agents that send email?

Scoped API keys, per-key recipient allowlists, approval mode and a hosted MCP server with ten tools — on the free plan, without a card.