MCP-native for Cursor, Claude Code, and Windsurf
Integration · Cloudflare Workers

Posthawk on
Cloudflare.

A one-click Deploy to Cloudflare template gets you a working Worker on Cloudflare's global edge network — one fetch handler, two secrets, sub-second response from anywhere in the world. No containers, no cold starts, no separate dashboard.

~2 minutes from click to first email · Free for 3,000 emails / month
What you ship

One fetch handler,
global delivery.

Cloudflare Workers are just an exported fetch handler. The Posthawk SDK is fetch-based with zero Node-only dependencies, so it slots in without any compatibility flags.

Need a queue or a cron? Add a queue or scheduled handler alongside fetch. The README covers both.

src/index.ts
// src/index.ts
import { Posthawk } from 'posthawk';

interface Env {
  POSTHAWK_API_KEY: string;
  POSTHAWK_FROM_EMAIL: string;
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    if (request.method !== 'POST') {
      return new Response('POST { email, name } as JSON.', { status: 200 });
    }

    const { email, name } = await request.json();
    const posthawk = new Posthawk(env.POSTHAWK_API_KEY);

    const { data, error } = await posthawk.emails.send({
      from: env.POSTHAWK_FROM_EMAIL,
      to: email,
      subject: `Welcome, ${name}!`,
      html: `<h1>Hey ${name}</h1><p>Sent from the edge.</p>`,
    });

    if (error) return Response.json({ error }, { status: 400 });
    return Response.json({ id: data.id });
  },
} satisfies ExportedHandler<Env>;
How it works

From button to
global edge.

01

Click Deploy to Cloudflare

Cloudflare forks the posthawk-dev/cloudflare-workers-starter template, walks you through a setup screen, and deploys the Worker to its global edge network.

02

Set the two secrets

Run wrangler secret put POSTHAWK_API_KEY and POSTHAWK_FROM_EMAIL — or set them in the dashboard under Settings → Variables and Secrets. No env files in production.

03

POST to your Worker URL

You get a *.workers.dev URL. POST { email, name } as JSON and Posthawk sends the welcome email. Zero cold start, sub-second response.

Zero cold starts

Cloudflare Workers run in V8 isolates, not containers. No warm-up time — your endpoint is ready at the edge nearest the caller, always.

Global edge network

Your Worker runs on 300+ Cloudflare locations. The HTTP roundtrip from browser to edge is single-digit milliseconds, anywhere in the world.

wrangler-native

wrangler dev gives you hot reload locally, wrangler deploy ships to production. Observability + tail logging built in via wrangler.jsonc.

Stable error envelope

The SDK unwraps every response into { data, error }. Surface error.requestId from your Worker so callers can quote it in support requests.

Ship a Worker that sends email in 2 minutes.

Click the button. Set two secrets. POST JSON. Done.

Cookie Preferences

I use analytics cookies to understand how you use the site and improve your experience. Privacy Policy