Hyperdrive accelerates your existing database connections by caching queries and managing connection pooling. Use the API to create and manage Hyperdrive configurations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/cloudflare-typescript/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Access the Hyperdrive API:Configurations
Manage Hyperdrive database configurations.Create a configuration
Create a new Hyperdrive configuration for a database.Your Cloudflare account ID
Name for the Hyperdrive configuration
Database origin configuration
Database hostname or IP address
Database port (e.g., 5432 for PostgreSQL, 3306 for MySQL)
Database name
Database username
Database scheme: ‘postgres’, ‘postgresql’, or ‘mysql’
Query caching configuration
Set to true to disable caching (default: false)
Maximum time in seconds to cache query results (default: 60)
Time in seconds to serve stale results while revalidating (default: 15)
The configuration ID
The configuration name
The database origin settings
ISO 8601 timestamp when the configuration was created
ISO 8601 timestamp when the configuration was last modified
List configurations
Retrieve all Hyperdrive configurations in your account.Your Cloudflare account ID
Get a configuration
Retrieve details about a specific Hyperdrive configuration.The configuration ID
Your Cloudflare account ID
Update a configuration
Update an existing Hyperdrive configuration.The configuration ID to update
Your Cloudflare account ID
Updated configuration name
Updated database origin settings
Updated caching settings
Delete a configuration
Delete a Hyperdrive configuration.The configuration ID to delete
Your Cloudflare account ID
Advanced configuration
Cloudflare Access protected databases
Connect to databases protected by Cloudflare Access:Cloudflare Access Client ID for authentication
Connection limits
Configure maximum connections:Maximum number of connections to the origin database (soft limit)
mTLS
Configure mutual TLS for secure connections:Mutual TLS configuration
CA certificate ID for verifying the database server
Client certificate ID for mTLS authentication
SSL mode: ‘require’, ‘verify-ca’, or ‘verify-full’
Using Hyperdrive in Workers
Bind a Hyperdrive configuration to your Worker:Best practices
- Caching: Enable caching for read-heavy workloads to reduce database load
- Connection pooling: Hyperdrive automatically manages connection pooling
- Security: Use mTLS for production databases
- Access control: Protect databases with Cloudflare Access for additional security
- Query optimization: Cache frequently accessed data with appropriate
max_agevalues - Stale-while-revalidate: Use this to serve cached results while fetching fresh data