Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Building Edge API Infrastructure with Hono + Cloudflare Workers — Stack Selection in Custom Development 2026

Table of contents · 7 items

"We run a contact form API written in Express on Heroku, but the monthly running cost of several thousand yen concerns us," "We want to shave API latency down to milliseconds on our landing page"—in client development for corporate sites and small SaaS apps, demand for overhauling lightweight API foundations is surging.

Becoming the de facto standard in this space is the combination of Hono and Cloudflare Workers. With zero cold starts, distribution from 300 cities worldwide, and virtually zero cost for up to 10 million requests per month, it delivers both cost efficiency and high performance. In this article, we outline design guidelines for custom development projects replacing Express-based APIs with Hono + Workers.

Hono + Cloudflare Workers request flow diagram

Why Hono + Workers: Three Quantitative Benefits

Here is a comparison with an Express + container architecture, organized by metrics easy to explain in custom development estimates:

MetricExpress + Cloud Run / ECSHono + Cloudflare Workers
Cold startsHundreds of ms to several secondsVirtually zero
Monthly fixed costMinimum 1,000–3,000 yen / instanceFree up to 100,000 req/month
Global distributionSingle regionAutomatic distribution from 300+ cities
Deployment timeSeveral minutes (image build)Several seconds
RuntimeNode.jsV8 isolates (Web Standard APIs)

For workloads with under 10 million requests per month and under 30 seconds of CPU time—which encompasses most B2B APIs—it is not uncommon for running costs to drop to less than one-tenth.

Minimal Skeleton

Hono's function signatures can be understood in 30 minutes by anyone who has worked with Express.

import { Hono } from "hono";
import { cors } from "hono/cors";
import { logger } from "hono/logger";

type Env = { Bindings: { DB: D1Database; SECRET: string } };

const app = new Hono<Env>();

app.use("*", logger());
app.use("/api/*", cors({ origin: ["https://gleamhub.net"] }));

app.post("/api/contact", async (c) => {
  const body = await c.req.json();
  await c.env.DB.prepare(
    "INSERT INTO contacts (email, message) VALUES (?, ?)"
  ).bind(body.email, body.message).run();
  return c.json({ ok: true });
});

export default app;

With wrangler deploy, edge distribution begins in about five seconds.

Authentication: "Avoid Storing Sessions in Workers" Is the Golden Rule

Workers are fundamentally stateless. Trying to retain session IDs inside Workers will leave you stranded, so building with JWT + KV / D1 session stores is the standard pattern.

  • JWT verification — Handled entirely with hono/jwt middleware
  • Short-lived access tokens — 5 to 15 minutes; store refresh tokens in KV
  • OAuth integration — Running Auth.js on Workers is a stable pattern

As discussed in GitHub Code Security Risk Assessment Guide, secret management should be thoroughly enforced by injecting secrets automatically from CI using wrangler secret put, never hardcoding them in source code.

Database Integration: Three Options

When interacting with databases from Workers, the choices can be categorized into three options:

OptionStrengthsWeaknessesIdeal use cases
Cloudflare D1(SQLite)Same platform, minimal latencyWeaker schema evolution capabilitiesLanding page inquiries, form submissions
PostgreSQL via HyperdriveReuses existing RDS / NeonRequires connection pool designAPI extensions for existing SaaS
PlanetScale / TursoGlobally distributedCostMulti-region SaaS

If an existing PostgreSQL database is a prerequisite, pairing Hyperdrive with SaaS Multi-Tenant Architecture Implemented with PostgreSQL RLS is a proven architecture in custom development. Since Drizzle ORM officially supports the Workers runtime, combining it with Drizzle ORM Migration Guide is also a compelling option.

Observability: "Logs Alone Are Not Enough"

The first hurdle encountered when debugging Workers is the inability to easily follow logs. Ensure observability using the following three-part toolkit:

  1. Tail Workers — Real-time log forwarding to Datadog or Sentry
  2. Workers Analytics Engine — Aggregate high-frequency metrics using SQL-like queries
  3. OpenTelemetry SDK — Propagate trace IDs upstream and downstream to provide end-to-end visibility between edge and origin

In enterprise-scale deployments, connecting to the distributed tracing foundations introduced in our OpenTelemetry Migration Guide is an increasingly common pattern.

Cases Where You Shouldn't Build with Workers

Workers are not a silver bullet. Consider alternative architectures if your use case matches any of the following:

  • Heavy workloads requiring 30+ seconds of CPU time (PDF generation, large-scale image processing)
  • WebSocket servers requiring persistent connections (demands Durable Objects and careful design rather than standalone Workers)
  • Libraries dependent on local filesystems or specialized binaries (headless Chromium, native extensions, etc.)
  • Strict financial or healthcare workloads that include offline environments

A realistic solution is to use container execution platforms like Cloud Run or AWS App Runner alongside them. Please also refer to our AWS App Runner migration guide.

Conclusion — "Lightweight APIs on the edge, heavy processing in containers"

In 2026, client API infrastructure presupposes using the edge and containers appropriately for their strengths. Hono + Workers is already safe to call the primary candidate in areas requiring lightweight APIs, low costs, and global distribution.

At GleamHub, we provide hands-on support ranging from phased migrations from Express to designing auth and DB integration, as well as setting up observability. If you would like to discuss revamping your corporate website API or reducing SaaS latency, please reach out through our contact form.

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Concrete steps forward for your organization.

We organize your desired architecture, legacy systems, and operational requirements to formulate your next steps toward execution.

  • Desired architecture
  • Integration with existing environments
  • Operational requirements
Consult on development & operations initiatives

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles by email