Self-hosted · CFFlowmails
Runtime v0.1
Bun
Bun 1.1+
Flowmails + Bun
Bun ships its own fetch implementation, and the SDK uses the runtime-native fetch (no Node polyfill). Server-side rendering and standalone HTTP servers both work.
Step 1
Install the SDK
installbash
bun add @flowmails/flowmails-sdkStep 2
Send your first message
sendtypescript
// server.ts
import { Flowmails } from "@flowmails/flowmails-sdk";
const fm = new Flowmails({ apiKey: process.env.FLOWMAILS_API_KEY! });
Bun.serve({
port: 3000,
async fetch(request) {
if (request.method === "POST") {
const body = await request.json();
const result = await fm.send({
from: "hello@yourdomain.com",
to: body.to,
subject: "Welcome",
text: body.text,
});
return Response.json({ id: result.id });
}
return new Response("Use POST", { status: 405 });
},
});Prerequisites
What you need first
- Bun 1.1+
- FLOWMAILS_API_KEY in the environment
Runtime notes
Things to know on Bun
Bun's `fetch` is faster than Node's for outbound calls; expect ~10–15% lower p99 on the Flowmails SDK's send path.
If you hit a `WebAssembly.instantiate` issue on older Bun versions, pin to 1.1+.
Other integrations