The BosonMail SDK uses only web-standard globals:
fetch, FormData, Blob, and AbortController. It has no Node-specific imports, so it is expected to work in any runtime that provides these globals. BosonWare has not officially verified Cloudflare Workers support, so test before production.Prerequisites
- A Hono project on Node.js or Cloudflare Workers
- A BosonMail API key
- Node.js 18 or later (for the Node.js section)
Hono on Node.js
Install dependencies
Create the application
Useprocess.env for the API key and mount routes for sending and status checks.
src/index.ts
c.req.parseBody() returns File objects when the request is multipart/form-data. You can pass these directly to the SDK because File extends Blob.Hono on Cloudflare Workers
Environment bindings
On Workers, store the API key as a secret binding and access it viac.env.
src/index.ts
Secrets and local development
Upload your secret to Workers:.dev.vars:
.dev.vars
Optional: validation with Zod
You can add@hono/zod-validator for schema-based validation if you want stricter type checking.
Error response mapping
Return consistent HTTP status codes across both runtimes.Related
Sending emails
SDK reference for sendEmail and its options.
Email status
How to check delivery status with getEmailStatus.
Production best practices
Key management, retries, logging, and monitoring guidance.
Attachments
SDK reference for sending file attachments.