Skip to content

Overview

Turn your existing regional database into a globally distributed database.

Available on Workers Paid plan

Hyperdrive is a service that accelerates queries you make to existing databases, making it faster to access your data from across the globe from Cloudflare Workers, irrespective of your users' location.

Hyperdrive supports any Postgres database, including those hosted on AWS, Google Cloud and Neon, as well as Postgres-compatible databases like CockroachDB and Timescale, with MySQL coming soon. You do not need to write new code or replace your favorite tools: Hyperdrive works with your existing code and tools you use.

Use Hyperdrive's connection string from your Cloudflare Workers application with your existing Postgres drivers and object-relational mapping (ORM) libraries:

import postgres from 'postgres';
export default {
async fetch(request, env, ctx): Promise<Response> {
// Hyperdrive provides a unique generated connection string to connect to
// your database via Hyperdrive that can be used with your existing tools
const sql = postgres(env.HYPERDRIVE.connectionString);
try {
// Sample SQL query
const results = await sql`SELECT * FROM pg_tables`;
// Close the client after the response is returned
ctx.waitUntil(sql.end());
return Response.json(results);
} catch (e) {
return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 });
}
},
} satisfies ExportedHandler<{ HYPERDRIVE: Hyperdrive }>;
Get started

Features

Connect your database

Connect Hyperdrive to your existing database and deploy a Worker that queries it.

PostgreSQL support

Hyperdrive allows you to connect to any PostgreSQL or PostgreSQL-compatible database.

Query Caching

Use Hyperdrive to cache the most popular queries executed against your database.


Workers

Build serverless applications and deploy instantly across the globe for exceptional performance, reliability, and scale.

Pages

Deploy dynamic front-end applications in record time.


More resources

Pricing

Learn about Hyperdrive's pricing.

Limits

Learn about Hyperdrive limits.

Storage options

Learn more about the storage and database options you can build on with Workers.

Developer Discord

Connect with the Workers community on Discord to ask questions, show what you are building, and discuss the platform with other developers.

@CloudflareDev

Follow @CloudflareDev on Twitter to learn about product announcements, and what is new in Cloudflare Developer Platform.