Skip to content

feat(cloud): deploy against your own Postgres, with optional Hyperdrive - #2

Open
jahands wants to merge 1 commit into
v2from
cloud-external-postgres
Open

jahands wants to merge 1 commit into
v2from
cloud-external-postgres

Conversation

@jahands

@jahands jahands commented Nov 11, 2026

Copy link
Copy Markdown

Deploying Cloud to your own Cloudflare account required PlanetScale: the stack creates the database itself. Now you can point it at a Postgres database you already run, and choose whether to put Hyperdrive in front of it.

  • CLOUD_DATABASE_URL: the deploy migrates this database as the URL's user, uses it as DatabaseUrl, and creates no PlanetScale resources.
  • CLOUD_DATABASE_HYPERDRIVE=true: also creates the DatabaseConnection Hyperdrive config, capped by CLOUD_DATABASE_CONNECTION_LIMIT. Without it, consumers connect directly, as Neon test stages do.
  • Without CLOUD_DATABASE_URL, nothing changes.

The deployed Worker makes the same choice because Alchemy binds the settings a Worker reads at deploy into its env, as it does for TEST_STAGE_DATABASE_PROVIDER.

Proved by bun run check and an offline stack evaluation (resources declared, nothing applied):

  • Hyperdrive off: only the migration job is declared, and the Workers get DatabaseUrl.
  • Hyperdrive on: the migration job and Hyperdrive config are declared, and the Workers get the binding.
  • PlanetScale: unchanged.
  • A simulated Worker picks the same route as the deploy in each mode.
  • Not deployed to a real Cloudflare account.

Replaces #1.

none

Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code; reviewed by GPT-6.1 Sol in Codex.

🤖 Generated with Claude Code

…Hyperdrive

CLOUD_DATABASE_URL replaces the PlanetScale database, roles and credentials
with a database the deployer runs; the deploy migrates it as that URL's user.
CLOUD_DATABASE_HYPERDRIVE=true puts a Hyperdrive configuration in front of it.
Otherwise every consumer connects to the URL directly, as Neon test stages do.

The deployed Worker reads both settings through Config, which Alchemy binds
into each Worker that reads them at plan time. Without CLOUD_DATABASE_URL,
production provisions PlanetScale behind Hyperdrive as before.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 34 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 60 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: a015fae1-f46c-447f-acf2-69eb5958fe2c
Commits

Reviewing files that changed from the base of the PR and between 7070515 and 98d228b.

Files selected for processing: 3

  • .changeset/cloud-external-postgres.md
  • DEVELOPMENT.md
  • apps/hosted/cloud/src/infrastructure/database.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@blacksmith-staging

blacksmith-staging Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Matches External Postgres replaces PlanetScale

Before, the URL was ignored and PlanetScale was declared. After, only the migration job is declared, and it gets the URL. Api and McpServer get it as DatabaseUrl once migrations finish. The stack was evaluated offline and nothing was applied.

Merge-base

Before: PlanetScale still declared

This PR 98d228b4

After: external URL wired

Also checked · 5 match · 1 not run

Blocked Live deploy to Cloudflare · Blocked
Matches Optional Hyperdrive in front
Matches Deployed Workers pick the same route
Matches Migration job runs on your database
Matches PlanetScale path unchanged
Matches Hyperdrive with incomplete URL

Important

Blocked on missing secrets

  • Live deploy to Cloudflare: A live deploy needs a Cloudflare account token and ID, plus a Postgres URL that Cloudflare can reach. The sandbox has none of these.

Proof on 98d228b4 · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant