Cloudflare Hyperdrive

Reylo on Postgres and MySQL through Hyperdrive

Reylo runs in a Worker on Postgres and MySQL through Hyperdrive, Cloudflare's connection pool. Everything on the Postgres and MySQL pages holds through it. Set up the Vite plugin as on Cloudflare D1.

Postgrespg or postgres.js, with the binding's connection string, and Drizzle over pg
MySQLmysql2 or mariadb, with the binding's host, port, user, password and database
The type check readsYour development database, through direct_url, never Hyperdrive
Node's APIspg, postgres.js, mysql2 and mariadb need a compatibility date from 2026-08-04 on, or the nodejs_compat flag

Postgres

worker.ts
import { Client } from "pg";
import getUser from "./get_user.sql";

export default {
  async fetch(request: Request, env: { HYPERDRIVE: Hyperdrive }, ctx: ExecutionContext) {
    const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
    await client.connect();
    const user = await getUser.run(client, { id: 1 });
    ctx.waitUntil(client.end());
    return Response.json(user);
  },
};

MySQL

Hyperdrive refuses prepared statements, so Reylo runs mysql2 there through query(), with each value written into the statement (mysql2). Reylo runs mariadb without prepared statements wherever it runs (mariadb).

Released under the MIT License. Copyright © 2026 Colin McDonnell.

On this page