Hono
Cloudflare Workers / Bun / Deno / Node 18+

Flowmails + Hono

Hono's middleware composition pairs nicely with the SDK — wrap a `/send` route, plug the SDK in, ship. Works on every runtime Hono supports.

Step 1

Install the SDK

installbash
pnpm add @flowmails/flowmails-sdk hono

Step 2

Send your first message

sendtypescript
// src/index.ts
import { Hono } from "hono";
import { Flowmails } from "@flowmails/flowmails-sdk";

interface Env {
  FLOWMAILS_API_KEY: string;
}

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

app.post("/send", async (c) => {
  const fm = new Flowmails({ apiKey: c.env.FLOWMAILS_API_KEY });
  const body = await c.req.json();
  const result = await fm.send({
    from: "hello@yourdomain.com",
    to: body.to,
    subject: "Welcome",
    text: body.text,
  });
  return c.json({ id: result.id });
});

export default app;

Prerequisites

What you need first

  • Hono 4+ for full runtime support
  • FLOWMAILS_API_KEY bound to the runtime environment

Runtime notes

Things to know on Hono

If you bind a single SDK instance to a Hono middleware, it reuses the underlying `fetch` agent across requests — slightly cheaper than per-request instantiation.

Other integrations

All Flowmails integrations