Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c264674
feat(cloudflare): run non-interactively in Workers Builds and check i…
TheAlexLichter Nov 26, 2026
c1436b7
feat(cloudflare): report deploys to WRANGLER_OUTPUT_FILE_PATH
TheAlexLichter Nov 26, 2026
a8b9252
feat(cloudflare): preflight API token permissions before building
TheAlexLichter Nov 26, 2026
f53dc92
feat(cloudflare): record the Builds commit and branch in the version …
TheAlexLichter Nov 26, 2026
da380b3
docs: deploy with Workers Builds
TheAlexLichter Nov 26, 2026
a359b2e
fix(void): scrub and fence the cf CLI Worker-name override
TheAlexLichter Nov 26, 2026
a75c44e
feat(void): report the Workers Builds Worker tag
TheAlexLichter Nov 26, 2026
14cd499
docs: match the Workers Builds dashboard labels
TheAlexLichter Nov 26, 2026
d0ec825
docs: update Workers Builds API token permissions
TheAlexLichter Nov 26, 2026
fc77dd1
docs: list email permissions for every Workers Builds token
TheAlexLichter Nov 26, 2026
965381e
fix: name the email token permissions Cloudflare checks; clarify Work…
TheAlexLichter Nov 26, 2026
ebba115
feat: replace the Workers Builds placeholder Worker on the first deploy
TheAlexLichter Nov 26, 2026
e76c320
docs: explain the Workers Builds placeholder and existing Workers
TheAlexLichter Nov 26, 2026
bff5ec8
docs: describe the workers.dev subdomain lookup and Workers Builds in…
TheAlexLichter Nov 28, 2026
870cafa
fix: harden Workers Builds placeholder adoption
TheAlexLichter Nov 28, 2026
bfc9395
fix: reject a rollback to the dashboard template version as a Workers…
TheAlexLichter Nov 28, 2026
7df56c6
fix: name the missing token permission when Workers Builds cannot rea…
TheAlexLichter Nov 28, 2026
aeda7fe
test: cover a Workers Builds --preview deploy; qualify production-onl…
TheAlexLichter Dec 2, 2026
f74039a
fix(cloudflare): apply migrations before publishing over the Workers …
TheAlexLichter Dec 2, 2026
8735e0c
fix: ask for a retry when the Workers Builds placeholder check cannot…
TheAlexLichter Dec 2, 2026
7afe217
docs: name void.lock.json and the checked products in the Workers Bui…
TheAlexLichter Dec 2, 2026
7775190
docs: point multi-app repositories to one Workers Builds connection p…
TheAlexLichter Dec 4, 2026
d345328
Merge remote-tracking branch 'origin/main' into HEAD
cpojer Dec 5, 2026
fe853ed
Pin the Builds account and verify production routes before claiming a…
cpojer Dec 5, 2026
a36bcd1
Require the Builds token before deploying a tagged Worker.
cpojer Dec 5, 2026
fb55e9d
Merge branch 'main' into feat/workers-builds-support
cpojer Dec 5, 2026
1ef36c1
fix: point a missing Workers Builds token to its API token setting; d…
TheAlexLichter Dec 5, 2026
f435a95
Merge remote-tracking branch 'origin/main' into feat/workers-builds-s…
TheAlexLichter Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ If your platform supports managed GitHub builds, the GitHub App can deploy on pu

If CI runs typechecking before deploy, run `void prepare` after installing dependencies to generate the `.void/` types.

## Deploy with Workers Builds {#workers-builds}

[Workers Builds](https://developers.cloudflare.com/workers/ci-cd/builds/) deploys your Cloudflare app when you push to GitHub or GitLab, without a workflow file. Connect the repository to your Worker in the Cloudflare dashboard, then use these build settings:

| Setting | Value |
| -------------- | --------------------------------------- |
| Build command | Leave empty |
| Deploy command | `npx void deploy --platform cloudflare` |

The Worker name in Workers Builds must match the name Void deploys. For several apps in one repository, connect each app's Worker with that app's folder as its root directory. The API token that Workers Builds creates includes the permissions most Void apps need. Older or custom tokens, and apps that use email, need [extra permissions](../integrations/cloudflare.md#api-token-permissions). See [Deploying with Workers Builds](../integrations/cloudflare.md#workers-builds) for token permissions, variables, and branch settings.

## Deploy to a team platform

Use the API URL from your administrator. In a new or unlinked app:
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/email/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Use a mail subdomain to keep existing mail on `acme.com` with its current provid

### Setup {#setup-1}

Sign in with `void cloudflare login`, or use a `CLOUDFLARE_API_TOKEN` with **Zone Read** and **Email Sending Edit** in addition to deploy permissions. Apps with `email/` handlers also need **Email Routing Edit**. If your browser session lacks email permissions, log out and sign in again. Global API Keys aren't supported.
Sign in with `void cloudflare login`, or use a `CLOUDFLARE_API_TOKEN` with **Zone Read** and **Email Sending Edit** in addition to deploy permissions. Apps with `email/` handlers also need **Zone Settings Edit**, **Email Routing Rules Edit**, and **Email Routing Account Rules Read**. If your browser session lacks email permissions, log out and sign in again. Global API Keys aren't supported.

Run `void deploy --platform cloudflare`. Void shows the domain, routing, sending, DNS, and handler addresses it would configure. Accept to set up email and deploy. Later deploys reuse the setup. If you decline the initial setup, the app deploys without email.

Expand Down
61 changes: 52 additions & 9 deletions docs/integrations/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ Apps using email need `email.from` in `void.config.ts`. Void reviews the domain'

Set these CI secrets and variables as needed:

| Name | When needed |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CLOUDFLARE_API_TOKEN` | Required. Workers Admin for the first deploy, or Workers Editor to deploy to an existing Worker. |
| `CLOUDFLARE_ACCOUNT_ID` | When the token can access several accounts. |
| `DATABASE_URL` | PostgreSQL and MySQL provisioning and migrations. |
| `CLOUDFLARE_WORKERS_SUBDOMAIN` | When workers.dev is enabled and the version has no preview URL. Use `my-team` or `my-team.workers.dev`. An account subdomain does not create a readiness URL when `workers_dev` is false. |
| `CF_ACCESS_CLIENT_ID`, `CF_ACCESS_CLIENT_SECRET` | When Cloudflare Access protects the readiness URL. |
| `CF_ACCESS_READINESS_ORIGIN` | When Access protects a route or Custom Domain and `workers_dev` is `false`. See [Cloudflare Access](#cloudflare-access). |
| Name | When needed |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CLOUDFLARE_API_TOKEN` | Required. Workers Admin for the first deploy, or Workers Editor to deploy to an existing Worker. |
| `CLOUDFLARE_ACCOUNT_ID` | When the token can access several accounts. |
| `DATABASE_URL` | PostgreSQL and MySQL provisioning and migrations. |
| `CLOUDFLARE_WORKERS_SUBDOMAIN` | When workers.dev is enabled, the version has no preview URL, and Void cannot look up the account subdomain. Use `my-team` or `my-team.workers.dev`. An account subdomain does not create a readiness URL when `workers_dev` is false. |
| `CF_ACCESS_CLIENT_ID`, `CF_ACCESS_CLIENT_SECRET` | When Cloudflare Access protects the readiness URL. |
| `CF_ACCESS_READINESS_ORIGIN` | When Access protects a route or Custom Domain and `workers_dev` is `false`. See [Cloudflare Access](#cloudflare-access). |

Grant **Workers → Admin** for the account when Void creates the Worker. For subsequent deploys, **Workers → Editor** is enough for the Worker itself. Add **Workers Routes Write** for each zone where the deploy adds, updates, or removes a route or Custom Domain. Grant access to any resources Void reads or provisions, such as D1 or KV. See [Cloudflare Workers roles and permissions](https://developers.cloudflare.com/workers/authorization/workers/).

For email, run `void email setup --platform cloudflare` locally, commit `void.lock.json`, and pass `--require-email` in CI. The token also needs Zone Read and Email Sending Edit, plus Email Routing Edit for apps with `email/` handlers.
For email, run `void email setup --platform cloudflare` locally, commit `void.lock.json`, and pass `--require-email` in CI. The token also needs Zone Read and Email Sending Edit. Apps with `email/` handlers also need Zone Settings Edit, Email Routing Rules Edit, and Email Routing Account Rules Read.

#### Cloudflare Access

Expand Down Expand Up @@ -246,6 +246,49 @@ jobs:

Add the same `--dir` and `--spa` flags as your production deploy. Using npm, Yarn or Bun? Use the setup steps that `void init --github` writes. If an earlier job builds the site, download its output and add `--skip-build`. Preview URLs are public; see [`void deploy --preview`](../reference/cli/deploy.md#void-deploy-preview) for the JSON output, naming rules and limits.

### Deploying with Workers Builds {#workers-builds}

[Workers Builds](https://developers.cloudflare.com/workers/ci-cd/builds/) runs `void deploy` on every push to your production branch. In the Cloudflare dashboard, go to **Workers & Pages**, then create a Worker from your repository or open an existing Worker and connect it under **Settings** > **Build**. Use these build settings:

| Setting | Value |
| -------------- | ------------------------------------------------- |
| Build command | Leave empty. `void deploy` builds the app. |
| Deploy command | `npx void deploy --platform cloudflare` |
| Root directory | The app folder, if it is not the repository root. |

The Worker name in Workers Builds must match the name Void deploys: `cloudflare.name` in `void.config.ts` or `void.lock.json`, or your `package.json` name. If `void.config.ts` or `void.lock.json` sets `cloudflare.account_id`, it must be the account that runs the build. Void stops before building when either differs and names the setting to change. For a repository with several Void apps, connect the repository to each app's Worker and set each Worker's root directory to that app's folder.

In Workers Builds, Void deploys without prompts or a browser sign-in. It uses the build's API token and account. After a successful deploy, Workers Builds links the build to the Worker version it deployed, and the version message records the commit and branch.

When you create a Worker from your repository, Cloudflare first deploys a placeholder Worker. The first build with Void replaces it. To connect an existing Worker that Void has not deployed, first add its current `routes`, `workers_dev`, and `preview_urls` to `cloudflare` in `void.config.ts`. Otherwise Void stops before it runs migrations or deploys, so the Worker keeps its routes and visibility.

#### API token permissions

The API token that Workers Builds creates includes the permissions most Void apps need, such as D1, Queues, Hyperdrive, Workers KV Storage, and Workers R2 Storage. For apps that use [email](../guide/email/domains.md#your-own-cloudflare-account), add **Zone Read** and **Email Sending Edit**, plus **Zone Settings Edit** for apps with `email/` handlers.

A token keeps its permissions when Workers Builds changes the permissions of new tokens. If you connected your Worker to Workers Builds earlier, or chose your own token, add the permissions your app needs:

| Your app uses | Permission |
| ----------------------------------- | ------------------------------------------------------------- |
| `db/` with D1, the default database | D1 Edit |
| Queues | Queues Edit |
| PostgreSQL or MySQL via Hyperdrive | Hyperdrive Edit |
| `email/` handlers | Email Routing Rules Edit and Email Routing Account Rules Read |

Edit the token in **My Profile** > **API Tokens**, or choose a different token in your Worker under **Settings** > **Build** > **API token**. Before building, Void checks that the token can use the D1, Queues, Hyperdrive, Workers KV, and R2 resources your app needs, and names any missing permission.

To deploy with another token, add a build secret named `CLOUDFLARE_API_TOKEN` under **Settings** > **Build** > **Build variables and secrets**. It replaces the build's token. A `CLOUDFLARE_ACCOUNT_ID` build variable replaces the build's account the same way.

#### Variables and branches

Add `DATABASE_URL` and public `VITE_*` values under **Settings** > **Build** > **Build variables and secrets**. Set server secrets with `void secret put`; they persist across deploys.

Commit `void.lock.json` when it changes locally. Workers Builds does not save files changed during a build, so on later builds Void finds the resources it created by name.

Email setup asks for confirmation, which a build cannot give. For an app that uses [email](../guide/email/domains.md#your-own-cloudflare-account), run `void email setup --platform cloudflare` once in your terminal and commit `void.lock.json`. Otherwise Void deploys without email. To fail the build instead, add `--require-email` to the deploy command.

Use `npx void deploy --platform cloudflare` only as the production deploy command. Without `--preview`, `void deploy` deploys to production, so running it for another branch would replace your production Worker. Void does not support Workers Builds preview builds yet: clear **Enable Preview Builds** under **Settings** > **Build** > **Branch control**.

### Databases and secrets

For PostgreSQL and MySQL, supply `DATABASE_URL` to the deploy process. Void uses it for Hyperdrive and migrations without writing it to config. MySQL schema changes can partially apply before an error; see [failed MySQL migrations](../guide/database/mysql.md#failed-migrations).
Expand Down
26 changes: 13 additions & 13 deletions docs/reference/cli/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ void deploy --platform cloudflare
void deploy --platform cloudflare --require-email # fail instead of deploying without email
```

Void signs you in through your browser when needed and saves the selected account. In CI, set `CLOUDFLARE_API_TOKEN` and, if the token can access several accounts, `CLOUDFLARE_ACCOUNT_ID`.

| Option or setting | Cloudflare behavior |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dir`, `--spa` | Deploy static output through a small Worker and Workers Assets |
| `--skip-build` | Reuse existing static, SPA, or SSG output; unavailable for Worker apps |
| `--skip-migrations` | Skip database migrations; existing PostgreSQL/MySQL Hyperdrive bindings do not require `DATABASE_URL` just to skip SQL |
| `--project` | Unavailable; the Worker and account come from `void.config.ts` and `void.lock.json` |
| Named environments | Unavailable; use the top-level `cloudflare` config |
| `CLOUDFLARE_WORKERS_SUBDOMAIN` | Needed in fresh CI when a workers.dev Worker has no preview URL; cached locally after a deploy. It does not apply when `workers_dev` is false |
| `CF_ACCESS_READINESS_ORIGIN` | Lets Access credentials reach the readiness check on a route or Custom Domain, for example `https://app.example.com` |
| `--require-email` | Fail instead of deploying without email when the email step cannot run, as in CI |
| `DATABASE_URL` | Required in the deploy environment for PostgreSQL or MySQL provisioning and migrations |
Void signs you in through your browser when needed and saves the selected account. In CI, set `CLOUDFLARE_API_TOKEN` and, if the token can access several accounts, `CLOUDFLARE_ACCOUNT_ID`. In [Workers Builds](../../guide/deployment.md#workers-builds), Void uses the build's token and account and never prompts.

| Option or setting | Cloudflare behavior |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dir`, `--spa` | Deploy static output through a small Worker and Workers Assets |
| `--skip-build` | Reuse existing static, SPA, or SSG output; unavailable for Worker apps |
| `--skip-migrations` | Skip database migrations; existing PostgreSQL/MySQL Hyperdrive bindings do not require `DATABASE_URL` just to skip SQL |
| `--project` | Unavailable; the Worker and account come from `void.config.ts` and `void.lock.json` |
| Named environments | Unavailable; use the top-level `cloudflare` config |
| `CLOUDFLARE_WORKERS_SUBDOMAIN` | Account workers.dev subdomain for the readiness check, when Void cannot look it up and the version has no preview URL. It does not apply when `workers_dev` is false |
| `CF_ACCESS_READINESS_ORIGIN` | Lets Access credentials reach the readiness check on a route or Custom Domain, for example `https://app.example.com` |
| `--require-email` | Fail instead of deploying without email when the email step cannot run, as in CI |
| `DATABASE_URL` | Required in the deploy environment for PostgreSQL or MySQL provisioning and migrations |

After `--skip-migrations`, direct Cloudflare deployment history shows the applied migration state as unknown. Rolling back code doesn't reverse database changes.

Expand Down
2 changes: 2 additions & 0 deletions packages/deploy-cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export {
export {
activateCloudflareVersion,
STALE_VERSION_HISTORY_DELAYS_MS,
canPreserveCloudflareTraffic,
deployCloudflareVersionTriggers,
deployCloudflareVersionTraffic,
encodeCloudflareVersionMessage,
Expand All @@ -58,6 +59,7 @@ export {
type CloudflareVersionActivation,
type CloudflareVersionActivationOptions,
type CloudflareVersionMetadata,
type CloudflareVersionSource,
type CloudflareWorkersDevSubdomainLookup,
} from './version.ts';
export {
Expand Down
Loading