← All IntegrationsIntegration

Analytics for Hono

Hono is the ultrafast web framework built for the edge — Cloudflare Workers, Deno Deploy, Bun, and Node.js. BetterMeter's middleware tracks every API request across all runtimes with the same integration code, giving you edge-level visibility into how your APIs are used.

Hono middleware setup

index.ts — Hono with BetterMeter on Cloudflare Workers
import { Hono } from "hono";
import { BetterMeter } from "@bettermeter/node";

const app = new Hono();
const bm = new BetterMeter({
  siteId: "my-edge-api",
  apiKey: "bm_live_abc123",
});

// BetterMeter middleware for Hono
app.use("*", async (c, next) => {
  const start = Date.now();
  await next();
  bm.trackApi({
    method: c.req.method,
    endpoint: c.req.routePath || c.req.path,
    statusCode: c.res.status,
    durationMs: Date.now() - start,
  });
});

app.get("/api/products", (c) => {
  return c.json({ products: [] });
});

export default app;

Multi-runtime support

Hono runs on every major JavaScript runtime. BetterMeter's Node SDK uses the standard fetch API internally, so it works identically across all of them — no runtime-specific configuration needed.

Cloudflare Workers
Edge compute, 300+ PoPs
Deno Deploy
Global serverless
Bun
High-perf runtime
Node.js
Traditional servers
AWS Lambda
Serverless functions
Vercel Edge
Edge runtime

Why edge APIs need analytics

Edge APIs serve traffic from hundreds of locations worldwide. Without analytics, you can't see which endpoints get the most traffic, which regions have the highest latency, or whether AI agents are consuming your API differently than human users. BetterMeter gives you that visibility with a single middleware function — same code whether you deploy to Cloudflare, Deno, or Bun.