Examples
Copy-paste starting points for common stacks. Same API underneath — pick your idiom.
Next.js Route Handler
import { NextResponse } from "next/server";
export async function POST(req: Request) {
// validate input, then POST to Calder with an
// Idempotency-Key derived from the recipient.
}Express middleware pattern
Send inside the request handler but never await delivery — Calder’s 202 returns in milliseconds, so awaiting the POST is safe. Put it after your database write, inside the same logical operation, keyed idempotently on the record id.
Hono (our own stack)
We run Hono in production, so this one is battle-tested by us daily: a tiny sendEmail() helper that takes your API key from env, attaches crypto.randomUUID() idempotency keys, and throws typed errors on non-2xx. See the Node.js quickstart for the exact call.
Remix action
Same shape as Next.js: validate with your schema library, POST to Calder in the action, return the email id to the client for status polling — or better, skip polling and listen for the webhook.