> hypequery

Fetch Runtime Integration

Mount hypequery inside Hono, Cloudflare Workers, Bun, or any Fetch-based runtime using the fetch adapter.

Fetch Runtime Integration

This guide assumes you already have:

  • a typed db client
  • an analytics/queries.ts file exporting api
  • at least one routed query

If not, start with Manual Installation or Quick Start.

We've simplified the serve API in v0.2. If you're looking for the older builder-first API, see Migrate from v0.1.x Serve API and v0.1.x Serve API.

Use this pattern in Hono, Cloudflare Workers, Deno, Bun, Remix, and similar runtimes:

import { Hono } from 'hono';
import { api } from './analytics/queries.js';
import { createFetchHandler } from '@hypequery/serve';

const app = new Hono();
const hypequery = createFetchHandler(api.handler);

app.all('/api/analytics/*', (c) => hypequery(c.req.raw));

Notes

  • Keep the mounted prefix aligned with the basePath used in initServe().
  • Use api.run(...) when you want in-process execution instead of HTTP.
  • Export the handler directly in runtimes that do not need an extra router layer.

On this page