Deploy PlanetScale Postgres and MySQL Straight from Cloudflare!
Hey everyone, it's Shii-chan! Today Cloudflare and PlanetScale got a whole lot cozier, and it makes working with databases even easier, so I'm excited to share it!
Cloudflare Blog
What was announced?
This one comes from the Cloudflare Blog. Cloudflare and PlanetScale are expanding their partnership so you can create PlanetScale databases directly from the Cloudflare dashboard and API.
It covers PlanetScale Postgres and MySQL. And starting next month, you'll be able to bill new databases straight to your Cloudflare account, so both self-serve and enterprise customers get one consolidated bill. The nice part: credits from the startup program and your committed spend can be applied to PlanetScale databases too!
The story so far
You could already reach external databases from Cloudflare Workers, but the contracts and billing lived apart — PlanetScale on one side, Cloudflare on the other. The big change here is that provisioning and payment now happen inside the Cloudflare experience.
What changes
The best part is not having to bounce between tools. From the Cloudflare dashboard you spin up a database in a few clicks, wire it to Workers, and keep billing in one place.
Good news for Postgres fans, too. The original post puts it this way:
Postgres has risen in developer popularity with its rich tooling ecosystem (ORMs, GUIs, etc) and extensions like pgvector for building vector search in AI-driven applications.
So the rich tooling — ORMs, GUIs — plus extensions like pgvector for vector search in AI apps all carry over onto Cloudflare.
Dive Deep
The connector is Hyperdrive, Cloudflare's database connectivity service that handles connection pooling and query caching for you. To use it, add a binding to your Worker's wrangler.jsonc:
{
"hyperdrive": [
{
"binding": "DATABASE",
"id": "AUTO_GENERATED_ID"
}
]
}
Then query with a standard Postgres client (the example uses the pg library); the connection string comes from the binding.
import { Client } from "pg";
const client = new Client({
connectionString: env.DATABASE.connectionString
});
await client.connect();
const result = await client.query("SELECT * FROM pg_tables");
Want it faster? Use Workers placement hints to sit your Worker near the primary database — that can cut latency to single-digit milliseconds.
{
"placement": {
"region": "aws:us-east-1"
}
}
On price, a single-node PlanetScale Postgres starts at $5/month. Features like query insights, branching for safe deploys, and detailed usage/cost breakdowns are all included in standard PlanetScale pricing.
Wrap-up
- Provision PlanetScale Postgres and MySQL directly from the Cloudflare dashboard and API
- Starting next month, bill to your Cloudflare account and apply startup credits
- Connect via Hyperdrive — just add a binding to
wrangler.jsonc - Placement hints near the primary can reach single-digit-millisecond latency
- Single-node Postgres starts at $5/month
Perfect for anyone building on Workers who wants a proper relational database, and for teams that want contracts and billing consolidated on Cloudflare — keep an eye out for next month's release!