Skip to content

Database runtimes

The ORM and database runtime are fixed when a project is created and recorded in .a2c/starter.json. They are generated as source-code choices, not environment toggles.

  • Drizzle is the production default. It supports PostgreSQL through Hyperdrive and the EdgePG developer preview.
  • Kysely is available as a developer preview for PostgreSQL through Hyperdrive. It generates typed table contracts and versioned SQL migrations.
  • Prisma is available as a developer preview for PostgreSQL through Hyperdrive. It generates a Prisma schema, Prisma migrations, and the Cloudflare-compatible PrismaPg adapter.

All three variants implement the same tenant, authentication, billing, project, and storage repository contracts. ORM selection is intentionally not hot-switchable after creation because schemas, migrations, generated types, and query code differ.

postgres-external is the production default and supports Drizzle, Kysely, and Prisma. The deployment operator creates or reuses a Hyperdrive configuration and the application reads env.HYPERDRIVE.connectionString. The source PostgreSQL URL is used only to configure Hyperdrive and is not stored in generated client code.

For local development, set CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE to a non-production PostgreSQL URL before running npm run dev. Wrangler supplies that URL through the same env.HYPERDRIVE.connectionString contract, so no application-only database branch is required.

edgepg binds the application Worker to a managed EdgePG Worker using the EDGEPG service binding. It currently requires Drizzle, whose PostgreSQL proxy driver sends parameterized statements to /v1/query; the internal token remains a Worker Secret. Migrations use the managed /v1/batch transaction boundary.

EdgePG remains a developer-preview runtime. Use it only after its target reports ready, bind the database resource to the Preview environment, and validate the generated Preview before promotion.

Database target switching is a reviewed deployment operation, not an application environment toggle. A target can only be switched when it is compatible with the generated ORM and migrations; the deployment gate verifies that constraint before updating the binding.