void 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/{account-cmd-CjyxcGkM.mjs → account-cmd-C84Ee8cO.mjs} +4 -4
- package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
- package/dist/application-routing-B7QEjqSR.mjs +27 -0
- package/dist/{auth-CZuiVsFh.mjs → auth-CCjt0hcq.mjs} +1 -1
- package/dist/{auth-DLNN0D3Z.mjs → auth-CSkdO2Bb.mjs} +4 -47
- package/dist/{auth-link-BLO4ptzo.mjs → auth-link-CioEg6uY.mjs} +4 -4
- package/dist/{auth-router-ZUg9MF_U.mjs → auth-router-BsR981d4.mjs} +4 -4
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-BxR5FROK.mjs → build-cmd-LzvNJORH.mjs} +17 -5
- package/dist/{cache-D0sWhgKI.mjs → cache-C4MvnrMH.mjs} +2 -2
- package/dist/{cancel-deploy-D4NUqFbi.mjs → cancel-deploy-abUxpP2n.mjs} +2 -2
- package/dist/{cf-build-output-BJ6yGEIS.mjs → cf-build-output-BPqOT964.mjs} +2 -1
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +80 -455
- package/dist/cli/{cf-compat.mjs → cloudflare-operation-process.mjs} +442 -421
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-Cu7jWiF1.mjs +2 -0
- package/dist/{client-BTZ3XkrB.mjs → client-RV8NVeB8.mjs} +140 -21
- package/dist/{cloudflare-auth-DQkqoMYa.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -38
- package/dist/{cloudflare-cmd-BKlfGHAy.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +5 -5
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-Ctmrw579.mjs → cloudflare-connect-B8uPZ4nx.mjs} +3 -3
- package/dist/{cloudflare-operations-BT6OWFBk.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
- package/dist/{cloudflare-operations-B9tzgjmf.mjs → cloudflare-operations-fxHb-byx.mjs} +116 -172
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-VavjpDnp.d.mts → config-BMHb8RCj.d.mts} +1 -0
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-Dg-WkW-C.mjs → connect-Bd4kJd9U.mjs} +5 -5
- package/dist/{create-project-DdoqwFLF.mjs → create-project-Boczwj5r.mjs} +1 -1
- package/dist/{create-project-l9J7pbtm.mjs → create-project-bMf6ffLZ.mjs} +2 -2
- package/dist/{db-gp2sCXyN.mjs → db-8uG64XLl.mjs} +21 -21
- package/dist/{delete-TTedbH6B.mjs → delete-NvbiyeJf.mjs} +2 -2
- package/dist/{deploy-CH-o2CaZ.mjs → deploy-DzAIwqNU.mjs} +908 -582
- package/dist/{deploy-B19L2Bra.mjs → deploy-bjXdFCtn.mjs} +1 -1
- package/dist/{domain-JRF59P_r.mjs → domain-y5Tvydvo.mjs} +3 -3
- package/dist/{email-Bo6G9LOZ.mjs → email-B3umsW75.mjs} +13 -28
- package/dist/{env-BYOrWQnv.mjs → env-BS6qYHDb.mjs} +4 -4
- package/dist/{env-public-BxU_0yTL.d.mts → env-public-BX_r8HR6.d.mts} +1 -1
- package/dist/{env-validation-BB4GkLxn.mjs → env-validation-BPn7vk-V.mjs} +18 -71
- package/dist/{env-validation-BXge7uyK.mjs → env-validation-DbTg7-ar.mjs} +1 -1
- package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
- package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
- package/dist/{gen-sCtlCOdA.mjs → gen-B580--vC.mjs} +2 -2
- package/dist/gen-BVaUUumi.mjs +2 -0
- package/dist/{github-cmd-0-7PexDq.mjs → github-cmd-v45BdfKX.mjs} +2 -2
- package/dist/{handler-HEcZsaij.d.mts → handler-CZ4nAylQ.d.mts} +1 -1
- package/dist/help-DofyZuY7.mjs +2 -0
- package/dist/{help-GKtwl07I.mjs → help-daGKjXGk.mjs} +229 -747
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +288 -1502
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-FZx3Elvz.mjs → init-Bvy7zrBo.mjs} +46 -15
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-BrQfb_CU.mjs → link-CDqqCjFl.mjs} +3 -3
- package/dist/{list-D44jmIAM.mjs → list-CZj0dzKY.mjs} +3 -3
- package/dist/{live-CKJlvlNp.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-Bg9OzEEO.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/login-DYt_An22.mjs +2 -0
- package/dist/{login-CAsAsQ-_.mjs → login-UZKFM_u7.mjs} +3 -3
- package/dist/{logs-BjKvFnVM.mjs → logs-CUZ6t9t3.mjs} +3 -3
- package/dist/migrate-8_2u55MD.mjs +2 -0
- package/dist/{migrate-BPITvDJN.mjs → migrate-DHul7PRV.mjs} +2 -1
- package/dist/{node-Dt7z256D.mjs → node-BkyRWRx8.mjs} +1 -1
- package/dist/operator-args-CLgKGlwU.mjs +690 -0
- package/dist/{operator-cmd-BK5CCiT9.mjs → operator-cmd-DBA6dl0m.mjs} +68 -22
- package/dist/pages/client.d.mts +34 -2
- package/dist/pages/client.mjs +59 -3
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +1 -1
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -308
- package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
- package/dist/plan-D1Q5rf-r.mjs +2 -0
- package/dist/plan-NPpwZ_kc.mjs +58 -0
- package/dist/platform-args-BJdRtlLq.mjs +506 -0
- package/dist/platform-args-D3RXyR6h.mjs +2 -0
- package/dist/{platform-auth-config-BlN8xTdD.mjs → platform-auth-config-B56E9YP1.mjs} +3 -3
- package/dist/{platform-auth-protection-7d5aV2Jg.mjs → platform-auth-protection-BDWO_aER.mjs} +2 -2
- package/dist/{platform-auth-recovery-Dxij8ZbR.mjs → platform-auth-recovery-1gg4CSRe.mjs} +3 -3
- package/dist/{platform-cmd-E0FuL212.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
- package/dist/{platform-cmd-B3hwKrFK.mjs → platform-cmd-DMcQStSc.mjs} +24 -3
- package/dist/{platform-domain-D6Xcy9ZX.mjs → platform-domain-BNkcz0OB.mjs} +2 -2
- package/dist/{platform-lifecycle-k0E0xoxx.mjs → platform-lifecycle-9OyBALhH.mjs} +327 -215
- package/dist/{platform-lifecycle-DMh_qrry.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
- package/dist/{platform-management-Brz_BDiT.mjs → platform-management-CjwLVQwN.mjs} +6 -3
- package/dist/{platform-management-DOtss0BN.mjs → platform-management-CnyTdcWX.mjs} +1 -1
- package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
- package/dist/{platform-recovery-BvtcXON5.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-C-6YZyyg.mjs → prepare-B5Mkic5u.mjs} +1 -1
- package/dist/{prepare-CRhJbVrG.mjs → prepare-DOsL0CC9.mjs} +4 -20
- package/dist/prepare-cgvDMtSb.mjs +2 -0
- package/dist/{project-cmd-BZLCqOqw.mjs → project-cmd-CNzrqvBv.mjs} +16 -16
- package/dist/{project-team-BvgM0WoX.mjs → project-team-DQOWPfQT.mjs} +2 -2
- package/dist/{project-token-l5DqK6Az.mjs → project-token-CTDYU0Cc.mjs} +2 -2
- package/dist/{project-zero-trust-v6Mvpp8y.mjs → project-zero-trust-BNAkW-_0.mjs} +2 -2
- package/dist/{protocol-BBa6cstI.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-Fr9pRqce.mjs → provision-C4ORE7G7.mjs} +1 -1
- package/dist/{provision-C4IGqkBf.mjs → provision-CJFgTZY8.mjs} +89 -198
- package/dist/{requests-DN-BbNiM.mjs → requests-MhxYnau8.mjs} +2 -2
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-D7rzSaZM.mjs → rollback-CJ6iSDoU.mjs} +3 -3
- package/dist/route-url-CG7U-cRN.mjs +15 -0
- package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
- package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
- package/dist/runtime/ai.d.mts +12 -8
- package/dist/runtime/ai.mjs +84 -17
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/durable.d.mts +3 -1
- package/dist/runtime/durable.mjs +4 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/kv.mjs +0 -1
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +2 -0
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +25 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/migration-handler.mjs +62 -42
- package/dist/runtime/route-url.d.mts +4 -0
- package/dist/runtime/route-url.mjs +2 -0
- package/dist/runtime/routing.d.mts +180 -0
- package/dist/runtime/routing.mjs +1082 -0
- package/dist/runtime/sandbox-container.d.mts +1 -1
- package/dist/runtime/sandbox-container.mjs +1 -1
- package/dist/runtime/sandbox.d.mts +3 -3
- package/dist/runtime/sandbox.mjs +75 -45
- package/dist/runtime/sse.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +4 -2
- package/dist/runtime/ws-server.mjs +27 -2
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/runtime/ws.mjs +8 -6
- package/dist/{sandbox-qpNBT8a3.d.mts → sandbox-XZAqzFlG.d.mts} +11 -8
- package/dist/{sandbox-container-DdNEBfCc.d.mts → sandbox-container-Bo0eiFKz.d.mts} +2 -1
- package/dist/{sandbox-container-4fdqLnyb.mjs → sandbox-container-C6ItmVuN.mjs} +4 -2
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-BOtOl_cb.mjs → secret-Dli5fP0B.mjs} +4 -4
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-DQF1vKyf.mjs → wrangler-7K-bW_DL.mjs} +8 -239
- package/dist/{ws-BoY7vQML.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +15 -8
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +50 -135
- package/skills/void/docs/guide/ai.md +94 -84
- package/skills/void/docs/guide/app-types.md +3 -32
- package/skills/void/docs/guide/auth.md +12 -116
- package/skills/void/docs/guide/database/d1.md +9 -54
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +5 -26
- package/skills/void/docs/guide/database.md +23 -75
- package/skills/void/docs/guide/deployment.md +27 -113
- package/skills/void/docs/guide/durable-state.md +43 -18
- package/skills/void/docs/guide/edge/headers.md +3 -47
- package/skills/void/docs/guide/edge/prerendering.md +5 -20
- package/skills/void/docs/guide/edge/redirects.md +11 -64
- package/skills/void/docs/guide/edge/revalidation.md +5 -18
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +22 -72
- package/skills/void/docs/guide/email/domains.md +112 -0
- package/skills/void/docs/guide/email/receiving.md +139 -0
- package/skills/void/docs/guide/email/sending.md +231 -0
- package/skills/void/docs/guide/email.md +13 -619
- package/skills/void/docs/guide/env-migration.md +11 -11
- package/skills/void/docs/guide/env-vars.md +9 -29
- package/skills/void/docs/guide/index.md +0 -15
- package/skills/void/docs/guide/jobs.md +3 -18
- package/skills/void/docs/guide/kv.md +5 -11
- package/skills/void/docs/guide/live.md +5 -56
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
- package/skills/void/docs/guide/pages-routing/head.md +10 -10
- package/skills/void/docs/guide/pages-routing/islands.md +6 -36
- package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
- package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
- package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
- package/skills/void/docs/guide/pages-routing/overview.md +7 -17
- package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -4
- package/skills/void/docs/guide/platform/administration/email.md +35 -8
- package/skills/void/docs/guide/platform/administration/operations.md +26 -4
- package/skills/void/docs/guide/platform/administration/plans.md +126 -0
- package/skills/void/docs/guide/platform/administration/projects.md +5 -2
- package/skills/void/docs/guide/platform/administration/zero-trust.md +23 -152
- package/skills/void/docs/guide/platform/development/runtime.md +3 -13
- package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
- package/skills/void/docs/guide/platform/installation/credentials.md +6 -4
- package/skills/void/docs/guide/platform/installation/domains.md +30 -2
- package/skills/void/docs/guide/platform/installation/first-deployment.md +2 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +20 -15
- package/skills/void/docs/guide/platform/installation/setup.md +9 -5
- package/skills/void/docs/guide/platform-administration.md +1 -0
- package/skills/void/docs/guide/queues.md +7 -9
- package/skills/void/docs/guide/quickstart.md +38 -37
- package/skills/void/docs/guide/remote-dev.md +4 -9
- package/skills/void/docs/guide/sandboxes.md +29 -21
- package/skills/void/docs/guide/server-routing.md +9 -72
- package/skills/void/docs/guide/sse.md +4 -18
- package/skills/void/docs/guide/ssg.md +3 -15
- package/skills/void/docs/guide/ssr.md +14 -62
- package/skills/void/docs/guide/storage.md +9 -4
- package/skills/void/docs/guide/type-safety.md +3 -14
- package/skills/void/docs/guide/typed-fetch.md +3 -7
- package/skills/void/docs/guide/websockets.md +68 -40
- package/skills/void/docs/integrations/agents.md +3 -3
- package/skills/void/docs/integrations/cloudflare.md +85 -316
- package/skills/void/docs/integrations/frameworks/analog.md +5 -64
- package/skills/void/docs/integrations/frameworks/astro.md +4 -73
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
- package/skills/void/docs/integrations/frameworks/overview.md +11 -54
- package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
- package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
- package/skills/void/docs/reference/api/auth.md +156 -0
- package/skills/void/docs/reference/api/client.md +87 -0
- package/skills/void/docs/reference/api/database.md +95 -0
- package/skills/void/docs/reference/api/durable.md +46 -0
- package/skills/void/docs/reference/api/env.md +50 -0
- package/skills/void/docs/reference/api/handlers.md +254 -0
- package/skills/void/docs/reference/api/pages.md +241 -0
- package/skills/void/docs/reference/api/plugin.md +39 -0
- package/skills/void/docs/reference/api/resources.md +109 -0
- package/skills/void/docs/reference/api/rewrites.md +76 -0
- package/skills/void/docs/reference/api/types.md +92 -0
- package/skills/void/docs/reference/api.md +56 -1218
- package/skills/void/docs/reference/cli/auth.md +88 -0
- package/skills/void/docs/reference/cli/database.md +128 -0
- package/skills/void/docs/reference/cli/deploy.md +85 -0
- package/skills/void/docs/reference/cli/domains.md +41 -0
- package/skills/void/docs/reference/cli/email.md +129 -0
- package/skills/void/docs/reference/cli/generate.md +116 -0
- package/skills/void/docs/reference/cli/github.md +189 -0
- package/skills/void/docs/reference/cli/platform-config.md +92 -0
- package/skills/void/docs/reference/cli/platform-email.md +81 -0
- package/skills/void/docs/reference/cli/platform-installation.md +127 -0
- package/skills/void/docs/reference/cli/platform-operations.md +90 -0
- package/skills/void/docs/reference/cli/platform-users.md +89 -0
- package/skills/void/docs/reference/cli/platform-zero-trust.md +45 -0
- package/skills/void/docs/reference/cli/platform.md +70 -0
- package/skills/void/docs/reference/cli/project.md +214 -0
- package/skills/void/docs/reference/cli/secrets.md +76 -0
- package/skills/void/docs/reference/cli/setup.md +70 -0
- package/skills/void/docs/reference/cli.md +32 -1682
- package/skills/void/docs/reference/config.md +12 -18
- package/skills/void/docs/reference/resource-inference.md +3 -58
- package/skills/void/docs/reference/structure.md +14 -41
- package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
- package/dist/client-Czz8o5jP.mjs +0 -2
- package/dist/gen-CNJ62MM7.mjs +0 -2
- package/dist/help-CmZzxUba.mjs +0 -2
- package/dist/login-CGcRKEoi.mjs +0 -2
- package/dist/migrate-CYfbKkXh.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-Bm3iq-u4.mjs +0 -2
- package/dist/validate-EKmJWxmy.mjs +0 -2
- /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
|
@@ -4,15 +4,11 @@ outline: deep
|
|
|
4
4
|
|
|
5
5
|
# Cloudflare
|
|
6
6
|
|
|
7
|
-
Void runs on Cloudflare Workers.
|
|
7
|
+
Void runs on Cloudflare Workers. It detects the resources your app uses, creates bindings, and deploys to your account.
|
|
8
8
|
|
|
9
9
|
## Bindings
|
|
10
10
|
|
|
11
|
-
Void
|
|
12
|
-
|
|
13
|
-
### Via Hono context (`c.env`)
|
|
14
|
-
|
|
15
|
-
In Void's default routing mode, route handlers and middleware receive a Hono `Context` object with bindings on `c.env`:
|
|
11
|
+
In Void routes and middleware, use `c.env`:
|
|
16
12
|
|
|
17
13
|
```ts
|
|
18
14
|
// routes/api/users.ts
|
|
@@ -20,58 +16,23 @@ import { defineHandler } from 'void';
|
|
|
20
16
|
|
|
21
17
|
export const GET = defineHandler(async (c) => {
|
|
22
18
|
const { results } = await c.env.DB.prepare('SELECT * FROM users').all();
|
|
23
|
-
return c.json(results);
|
|
19
|
+
return c.json({ users: results });
|
|
24
20
|
});
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
// routes/api/cache.ts
|
|
29
|
-
import { defineHandler } from 'void';
|
|
30
|
-
|
|
31
|
-
export const GET = defineHandler(async (c) => {
|
|
32
|
-
const value = await c.env.KV.get('key');
|
|
33
|
-
return c.json({ value });
|
|
34
|
-
});
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`CloudContext` provides the types for `c.env`, so you don't need to declare them yourself.
|
|
38
|
-
|
|
39
|
-
### Via `cloudflare:workers` import
|
|
40
|
-
|
|
41
|
-
When using framework mode (TanStack Start or React Router), the framework owns routing and you access bindings through the `cloudflare:workers` module instead:
|
|
42
|
-
|
|
43
|
-
::: warning ⚠️ Cloudflare env access in meta frameworks
|
|
44
|
-
Some frameworks, like Nuxt and SvelteKit, do not run in workerd during dev and therefore do not support directly importing from `cloudflare:workers`.
|
|
45
|
-
:::
|
|
23
|
+
TanStack Start and React Router can import bindings from `cloudflare:workers`:
|
|
46
24
|
|
|
47
25
|
```ts
|
|
48
26
|
import { env } from 'cloudflare:workers';
|
|
49
27
|
|
|
50
|
-
const
|
|
28
|
+
const { results } = await env.DB.prepare('SELECT * FROM users').all();
|
|
51
29
|
```
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
// src/routes/users.tsx (TanStack Start)
|
|
57
|
-
import { createFileRoute } from '@tanstack/react-router';
|
|
58
|
-
import { createServerFn } from '@tanstack/react-start';
|
|
59
|
-
import { env } from 'cloudflare:workers';
|
|
60
|
-
|
|
61
|
-
const getUsers = createServerFn().handler(async () => {
|
|
62
|
-
const { results } = await env.DB.prepare('SELECT * FROM users').all();
|
|
63
|
-
return results;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const Route = createFileRoute('/users')({
|
|
67
|
-
loader: () => getUsers(),
|
|
68
|
-
component: UsersPage,
|
|
69
|
-
});
|
|
70
|
-
```
|
|
31
|
+
Other frameworks use their own binding access. Follow your [framework's setup guide](./frameworks/overview.md).
|
|
71
32
|
|
|
72
33
|
### TypeScript setup
|
|
73
34
|
|
|
74
|
-
Add `
|
|
35
|
+
Add `void/env` to your TypeScript types:
|
|
75
36
|
|
|
76
37
|
```json
|
|
77
38
|
{
|
|
@@ -81,38 +42,24 @@ Add `"void/env"` to your tsconfig `types` to get typed bindings on `env`:
|
|
|
81
42
|
}
|
|
82
43
|
```
|
|
83
44
|
|
|
84
|
-
This
|
|
45
|
+
This provides binding types and Workers runtime types.
|
|
85
46
|
|
|
86
47
|
### Available bindings
|
|
87
48
|
|
|
88
|
-
| Binding |
|
|
89
|
-
| ---------------- |
|
|
90
|
-
| `DB` |
|
|
91
|
-
| `KV` |
|
|
92
|
-
| `STORAGE` |
|
|
93
|
-
| `AI` |
|
|
94
|
-
| `QUEUE_*` |
|
|
95
|
-
|
|
|
96
|
-
|
|
97
|
-
Bindings are [inferred automatically](../reference/resource-inference.md) by scanning your source files for import and access patterns. You can also set them explicitly in `void.config.ts`:
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
import { defineConfig } from 'void/config';
|
|
101
|
-
|
|
102
|
-
export default defineConfig({
|
|
103
|
-
inference: {
|
|
104
|
-
bindings: { db: true, kv: true, storage: false, ai: 'MY_AI' },
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
`db`, `kv`, `storage`, and `ai` accept a string to customize the binding name (for example, `"db": "MY_DB"` or `"ai": "MY_AI"`). `email` is a boolean feature switch.
|
|
49
|
+
| Binding | Resource | Use in your app |
|
|
50
|
+
| ---------------- | --------------- | --------------------------------- |
|
|
51
|
+
| `DB` | D1 | `c.env.DB` or `void/db` |
|
|
52
|
+
| `KV` | KV | `c.env.KV` or `void/kv` |
|
|
53
|
+
| `STORAGE` | R2 | `c.env.STORAGE` or `void/storage` |
|
|
54
|
+
| `AI` | Workers AI | `c.env.AI` or `void/ai` |
|
|
55
|
+
| `QUEUE_*` | Queues | `defineQueue()` or `void/queues` |
|
|
56
|
+
| Filename-derived | Durable Objects | A module in `durable-objects/` |
|
|
110
57
|
|
|
111
|
-
|
|
58
|
+
Use [binding configuration](../reference/resource-inference.md#explicit-binding-overrides) when you need to enable, disable, or rename an inferred binding.
|
|
112
59
|
|
|
113
|
-
|
|
60
|
+
## Cloudflare Configuration
|
|
114
61
|
|
|
115
|
-
|
|
62
|
+
Define Worker settings in `void.config.ts`:
|
|
116
63
|
|
|
117
64
|
```ts
|
|
118
65
|
import { defineConfig } from 'void/config';
|
|
@@ -122,91 +69,18 @@ export default defineConfig({
|
|
|
122
69
|
compatibility_date: '2026-02-24',
|
|
123
70
|
compatibility_flags: ['nodejs_compat'],
|
|
124
71
|
},
|
|
72
|
+
cloudflare: {
|
|
73
|
+
name: 'my-app',
|
|
74
|
+
services: [{ binding: 'API', service: 'my-api-worker' }],
|
|
75
|
+
},
|
|
125
76
|
});
|
|
126
77
|
```
|
|
127
78
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# .env
|
|
132
|
-
API_URL=https://api.example.com
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Binding arrays such as `d1_databases`, `kv_namespaces`, and `r2_buckets` belong in the `cloudflare` field. Void adds inferred bindings that are missing by name and preserves custom bindings with real resource IDs. See [Cloudflare Configuration](#cloudflare-configuration) for details.
|
|
136
|
-
|
|
137
|
-
For non-secret plain-text defaults, you can also set `worker.vars` in `void.config.ts`. Local `.env` values override `worker.vars` during development. Production builds reject any `worker.vars` name that is declared as a server key in `env.ts`; store those values remotely with `void secret put` instead.
|
|
138
|
-
|
|
139
|
-
## Cloudflare Configuration
|
|
140
|
-
|
|
141
|
-
Set Worker options in `void.config.ts`. Void combines its `cloudflare` settings with resource IDs in `void.lock.json` for development and deployment. `void init` and `void deploy` migrate root `wrangler.jsonc` or `wrangler.json` files from existing apps.
|
|
142
|
-
|
|
143
|
-
Commit `void.lock.json` when Void records resource IDs or Durable Object migration history.
|
|
144
|
-
|
|
145
|
-
### Void-only mode and Vite-based frameworks
|
|
146
|
-
|
|
147
|
-
In native Void apps, TanStack Start, and React Router, Void manages the Cloudflare Vite plugin. It merges inferred bindings with your `cloudflare` settings:
|
|
148
|
-
|
|
149
|
-
- An existing binding with the same name stays unchanged.
|
|
150
|
-
- Missing inferred bindings get local placeholder IDs for development. Deploy replaces them with provisioned IDs.
|
|
151
|
-
- Other `cloudflare` settings, such as routes, services, variables, and compatibility settings, pass through.
|
|
152
|
-
|
|
153
|
-
Void sets `main`, `triggers`, and `assets` from your project structure. It also records typed Durable Object bindings and migration history from `durable-objects/` in `void.lock.json`.
|
|
154
|
-
|
|
155
|
-
### Adapter-based frameworks (SvelteKit, Nuxt, Astro)
|
|
156
|
-
|
|
157
|
-
SvelteKit, Nuxt, and Astro build Workers through their own adapters. Void provides database types, migrations, and binding sync without replacing those adapters.
|
|
158
|
-
|
|
159
|
-
At dev startup, Void updates the framework's generated Cloudflare config:
|
|
160
|
-
|
|
161
|
-
- It adds missing bindings by name without changing existing ones.
|
|
162
|
-
- It copies `worker.compatibility_date`, when set, and adds the `nodejs_als` compatibility flag.
|
|
163
|
-
|
|
164
|
-
`void deploy --platform cloudflare` provisions production resources for inferred bindings.
|
|
165
|
-
|
|
166
|
-
### Merge precedence
|
|
167
|
-
|
|
168
|
-
| Source | Priority | What it controls |
|
|
169
|
-
| ------------------------------- | ----------------------------- | ------------------------------------------------------------------- |
|
|
170
|
-
| `void.config.ts` `cloudflare` | Highest for authored settings | Resource IDs, service bindings, routes, vars, environments |
|
|
171
|
-
| `void.config.ts` `worker` field | Highest for compat | `compatibility_date`, `compatibility_flags`, `vars` |
|
|
172
|
-
| Void inference | Fills gaps only | Adds placeholder bindings for inferred resources not in your config |
|
|
173
|
-
|
|
174
|
-
If no date is found in `void.config.ts` or the generated build config, Void records the latest known-good date and uses it for that run.
|
|
175
|
-
|
|
176
|
-
### Example
|
|
177
|
-
|
|
178
|
-
If your code uses `c.env.DB` and `c.env.KV`, and `cloudflare` only defines D1:
|
|
179
|
-
|
|
180
|
-
```ts
|
|
181
|
-
// Inside defineConfig({ ... })
|
|
182
|
-
cloudflare: {
|
|
183
|
-
name: 'my-app',
|
|
184
|
-
d1_databases: [{
|
|
185
|
-
binding: 'DB',
|
|
186
|
-
database_name: 'my-app-db',
|
|
187
|
-
database_id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
188
|
-
}],
|
|
189
|
-
services: [{ binding: 'API', service: 'my-api-worker' }],
|
|
190
|
-
},
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Void sees that `DB` is already configured and leaves it alone (including your real `database_id`), but adds a local placeholder for `KV` since it's missing. The `services` array passes through unchanged.
|
|
79
|
+
Put binding arrays, resource IDs, routes, and service bindings under `cloudflare`. Void preserves your configured bindings and adds missing inferred resources. The `worker` field takes precedence for compatibility settings and variables. See [Configuration](../reference/config.md).
|
|
194
80
|
|
|
195
|
-
|
|
81
|
+
Commit `void.lock.json` when Void records resource IDs or Durable Object migrations. Keep generated Cloudflare config out of Git. Frameworks that require an adapter config path use `.void-wrangler.jsonc`; their setup guides show the required options.
|
|
196
82
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
After `vite build`, the Cloudflare Vite plugin writes a merged `wrangler.json` to the `dist/` directory. This file contains:
|
|
200
|
-
|
|
201
|
-
- All `cloudflare` fields from `void.config.ts` (bindings with real IDs, routes, services, vars, environments)
|
|
202
|
-
- Any inferred bindings Void added (local placeholders during development; provisioned IDs during deploy)
|
|
203
|
-
- Fields set by Void (`main`, `assets`, `triggers`)
|
|
204
|
-
|
|
205
|
-
When you run `void deploy --platform cloudflare`, Void validates this generated `wrangler.json` and deploys it safely.
|
|
206
|
-
|
|
207
|
-
::: tip
|
|
208
|
-
When deploying to a Void platform, the `wrangler.json` in the build output is **skipped** because the platform manages Worker configuration through its own deploy manifest. The merge behavior described here applies to direct Cloudflare deployment.
|
|
209
|
-
:::
|
|
83
|
+
Declare environment variables in `env.ts`, put local values in `.env`, and set production server values with `void secret put`. See [Environment Variables](../guide/env-vars.md).
|
|
210
84
|
|
|
211
85
|
## Deploy to your own Cloudflare account
|
|
212
86
|
|
|
@@ -216,255 +90,150 @@ Choose Cloudflare during `void init`, then deploy:
|
|
|
216
90
|
void deploy
|
|
217
91
|
```
|
|
218
92
|
|
|
219
|
-
Void opens your browser to sign in
|
|
93
|
+
Void opens your browser to sign in and asks which account to use when you have several. If the browser doesn't open, follow the link and confirm the code printed in the terminal.
|
|
220
94
|
|
|
221
|
-
To
|
|
222
|
-
|
|
223
|
-
### One command: `void deploy --platform cloudflare`
|
|
224
|
-
|
|
225
|
-
You can also choose Cloudflare for a single deploy:
|
|
95
|
+
To set up deployment later, run `void connect --platform cloudflare`. To select Cloudflare for one deploy, run:
|
|
226
96
|
|
|
227
97
|
```sh
|
|
228
98
|
void deploy --platform cloudflare
|
|
229
99
|
```
|
|
230
100
|
|
|
231
|
-
|
|
101
|
+
Use `void cloudflare login`, `status`, and `logout` to manage your session.
|
|
232
102
|
|
|
233
103
|
### Deploy an existing Worker
|
|
234
104
|
|
|
235
|
-
|
|
105
|
+
For an existing Void app deployed directly to Cloudflare, keep its root `wrangler.jsonc` or `wrangler.json` and run:
|
|
236
106
|
|
|
237
107
|
```sh
|
|
238
108
|
void deploy
|
|
239
109
|
```
|
|
240
110
|
|
|
241
|
-
If
|
|
242
|
-
|
|
243
|
-
The first handoff preserves resource bindings, production variables, encrypted secrets, event handlers, and existing routes and schedules. It builds the app, checks the uploaded version's bindings and handler set, and verifies readiness before activating it. Void saves `keep_vars: true` in your config so later deployments retain dashboard-only variables too. The active version must also be the latest uploaded version; activate or remove an unpublished candidate in Cloudflare before retrying so secret inheritance has an unambiguous source.
|
|
111
|
+
If no destination is selected, Void offers to link the existing Worker. Accept to sign in and deploy. Void migrates the configuration to `void.config.ts` and `void.lock.json`, preserving bindings, variables, secrets, routes, and schedules. Commit both files.
|
|
244
112
|
|
|
245
|
-
Keep
|
|
113
|
+
Keep the first deployment focused on the existing app. Add resources, auth, migrations, or other runtime features after linking. If the Worker has a newer inactive upload, activate or remove it in Cloudflare before retrying.
|
|
246
114
|
|
|
247
|
-
|
|
115
|
+
Readiness checks need either an existing [version metadata binding](https://developers.cloudflare.com/workers/runtime-apis/bindings/version-metadata/) or access to [Version URLs](https://developers.cloudflare.com/workers/versions-and-deployments/version-urls/). Void stops before activation if neither is available.
|
|
248
116
|
|
|
249
|
-
|
|
250
|
-
- **No:** saves `routing.isr: false`. Pages render on each request, and later deployments keep ISR disabled until you change that setting.
|
|
117
|
+
Prerendered pages can require a new ISR cache. Void asks whether to enable it and saves the choice as `routing.isr`. Choose `false` to render those pages on each request instead. In CI, set that choice before deploying. Existing caches retain their IDs.
|
|
251
118
|
|
|
252
|
-
|
|
119
|
+
If linking reports a missing binding, use the existing Worker's binding name and resource ID in `cloudflare` and `inference.bindings`. Keep `.void/cloudflare-link.json` when retrying.
|
|
253
120
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
Declining the initial link-and-deploy prompt leaves the project unchanged. Explicit platform choices and existing project links take precedence. In CI, select the destination with `--platform cloudflare` and provide Cloudflare credentials.
|
|
257
|
-
|
|
258
|
-
Direct deployment uses the top-level `cloudflare` settings in `void.config.ts`; convert a `wrangler.toml` to JSON/JSONC before linking. Named environments need a separate Void project config. If previews are disabled, include the existing production hostname in your config so Void can check the candidate through it.
|
|
121
|
+
Before changing dashboard-managed triggers or visibility later, add the current `routes`, `workers_dev`, and `preview_urls` to your config. Convert `wrangler.toml` to JSON/JSONC before linking. Named environments need separate Void project configs.
|
|
259
122
|
|
|
260
123
|
### What happens during deploy
|
|
261
124
|
|
|
262
|
-
Void
|
|
263
|
-
|
|
264
|
-
1. Checks the app type, selected account, and Cloudflare credentials.
|
|
265
|
-
2. If the app uses email (`sendEmail()` or `email/` handlers), reads your zone's email state and, before any project code runs, asks once to set it up. See [Your own Cloudflare account](../guide/email.md#your-own-cloudflare-account) in the email guide.
|
|
266
|
-
3. Creates missing resources or reuses resources already in your account.
|
|
267
|
-
4. Builds the app and checks the generated Worker config, secrets, and migration history.
|
|
268
|
-
5. Preserves or creates the auth secret, verifies required server keys in encrypted remote storage, and applies pending migrations.
|
|
269
|
-
6. Uploads a Worker Version and checks that it is ready.
|
|
270
|
-
7. Sends traffic to the new version and applies routes, custom domains, cron schedules, queue consumers, and Email Routing rules.
|
|
271
|
-
|
|
272
|
-
The secret and migration checks need the built Worker, so they happen after provisioning and building. If a check fails, resources may already exist, but Void has not applied remote D1 migrations or uploaded the application Worker.
|
|
125
|
+
Void creates missing resources, builds the app, checks secrets and migrations, uploads the Worker, verifies readiness, and updates traffic and triggers. Resource IDs are saved in `void.lock.json`.
|
|
273
126
|
|
|
274
|
-
|
|
127
|
+
A failed build or validation can leave provisioned resources in your account. Run the first deploy from one machine at a time, then commit the lock file before deploying from other machines or CI.
|
|
275
128
|
|
|
276
|
-
|
|
129
|
+
Apps using email need `email.from` in `void.config.ts`. Void reviews the domain's setup before building and asks before changing it. See [Email](../guide/email/domains.md#your-own-cloudflare-account).
|
|
277
130
|
|
|
278
131
|
### Deploying from CI
|
|
279
132
|
|
|
280
|
-
Set
|
|
133
|
+
Set these CI secrets and variables as needed:
|
|
281
134
|
|
|
282
|
-
|
|
135
|
+
| Name | When needed |
|
|
136
|
+
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| `CLOUDFLARE_API_TOKEN` | Required. Workers Scripts: Edit, read access to bound resources, and edit access to products Void provisions. |
|
|
138
|
+
| `CLOUDFLARE_ACCOUNT_ID` | When the token can access several accounts. |
|
|
139
|
+
| `DATABASE_URL` | PostgreSQL and MySQL provisioning and migrations. |
|
|
140
|
+
| `CLOUDFLARE_WORKERS_SUBDOMAIN` | When the Worker has no version preview URL. Use `my-team` or `my-team.workers.dev`. |
|
|
141
|
+
| `CF_ACCESS_CLIENT_ID`, `CF_ACCESS_CLIENT_SECRET` | When Cloudflare Access protects the readiness URL. |
|
|
283
142
|
|
|
284
|
-
|
|
143
|
+
For email, run `void email setup --platform cloudflare` locally, commit `void.lock.json`, and pass `--require-email` in CI. The token also needs Email Routing Edit and Email Sending Edit.
|
|
285
144
|
|
|
286
145
|
#### Cloudflare Access
|
|
287
146
|
|
|
288
|
-
|
|
147
|
+
For local deployment to an Access-protected Worker, you can use a short-lived user session:
|
|
289
148
|
|
|
290
149
|
```sh
|
|
291
150
|
export CF_ACCESS_TOKEN="$(cloudflared access token --app=https://<worker>.<account>.workers.dev)"
|
|
292
151
|
```
|
|
293
152
|
|
|
294
|
-
Void
|
|
295
|
-
|
|
296
|
-
If Access blocks a version preview but allows the stable Worker hostname, Void checks the new version through that hostname using a version override. If Access still denies the request, Void leaves the upload inactive or restores the previous deployment. A required first-deploy bootstrap is an exception: that Worker is already active behind Access when the check runs.
|
|
153
|
+
Void uses Access credentials for readiness checks without saving them. If checks are denied, the deployment fails. A first-deploy bootstrap can already be active behind Access when this happens.
|
|
297
154
|
|
|
298
155
|
### Databases and secrets
|
|
299
156
|
|
|
300
|
-
PostgreSQL and MySQL
|
|
301
|
-
|
|
302
|
-
Creating a Hyperdrive config for the first time also requires `CLOUDFLARE_API_TOKEN` with Hyperdrive edit permission. Void needs the REST API to find existing configurations, and the current provisioning path can't use browser OAuth for that lookup. Alternatively, create the config in the Cloudflare dashboard and add its ID to the `cloudflare.hyperdrive` binding in `void.config.ts`. An app with an existing Hyperdrive binding can deploy through browser login.
|
|
303
|
-
|
|
304
|
-
For auth-enabled apps, run `void db generate` and commit the migrations. Void includes the production Better Auth schema, including renamed tables and plugin tables, and checks it against your migration history during deploy. D1 also gets an in-memory schema check before remote migration. A mismatch stops deployment and asks you to regenerate the SQL.
|
|
157
|
+
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.
|
|
305
158
|
|
|
306
|
-
|
|
159
|
+
Creating Hyperdrive requires an API token with Hyperdrive edit permission. Alternatively, create it in Cloudflare and add its ID to `cloudflare.hyperdrive`; an existing binding works with browser login.
|
|
307
160
|
|
|
308
|
-
|
|
161
|
+
Run `void db generate` and commit migrations before deploying schema changes. This includes Better Auth tables. Custom D1 migration directories, tables, and patterns are supported; deploy stops if the files to apply differ from the validated history.
|
|
309
162
|
|
|
310
|
-
|
|
311
|
-
If an earlier deployment leaves a newer inactive upload, Void pins later uploads to the active version's secret bindings. You do not need to recover the plaintext values from Cloudflare.
|
|
163
|
+
Set production server values with `void secret put <NAME>`. Void preserves existing remote secrets and creates `BETTER_AUTH_SECRET` when an auth app needs one. Local `.env` values are never deployed.
|
|
312
164
|
|
|
313
165
|
### Readiness and rollback
|
|
314
166
|
|
|
315
|
-
Void
|
|
167
|
+
Void normally verifies an uploaded version before sending it traffic. If readiness or trigger updates fail, it restores the previous deployment. Finish or cancel any gradual rollout in Cloudflare before deploying through Void.
|
|
316
168
|
|
|
317
|
-
For an existing Durable Object Worker that Cloudflare cannot stage, review the
|
|
169
|
+
For an existing Durable Object Worker that Cloudflare cannot stage, review the changes and use:
|
|
318
170
|
|
|
319
|
-
|
|
171
|
+
```sh
|
|
172
|
+
void deploy --platform cloudflare --atomic
|
|
173
|
+
```
|
|
320
174
|
|
|
321
|
-
|
|
175
|
+
To use this on every deploy, set `deploy: { cloudflare: { mode: 'atomic' } }`. Atomic deployment sends traffic to the new version before its readiness check. Durable Object class migrations cannot be rolled back across their migration boundary.
|
|
322
176
|
|
|
323
|
-
|
|
177
|
+
A new Worker may need an active first deployment before readiness can be checked. Keep `.void/cloudflare-candidate.json` if a staged upload fails so you can retry from the same checkout.
|
|
178
|
+
|
|
179
|
+
Inspect or restore versions with:
|
|
324
180
|
|
|
325
181
|
```sh
|
|
326
182
|
void project status
|
|
327
183
|
void project rollback [version]
|
|
328
184
|
```
|
|
329
185
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
Rollback does not reverse database migrations. Void asks for confirmation when the schema may be newer than the code or migration metadata is missing.
|
|
186
|
+
Void restores recorded triggers along with the code. Versions without a complete trigger snapshot keep current routes and schedules. Rollback does not reverse database migrations.
|
|
333
187
|
|
|
334
188
|
#### Scope and limitations
|
|
335
189
|
|
|
336
|
-
Void
|
|
337
|
-
|
|
338
|
-
Static sites use a small Worker in front of Workers Assets to handle redirects, rewrites, fallbacks, and headers. Hybrid and SSR apps keep their application Worker. A page that opts out of prerendering, a dynamic page without `getPrerenderPaths()`, or another runtime feature keeps the app on a Worker even with `output: "static"`.
|
|
339
|
-
|
|
340
|
-
Native Void applications apply `void.config.ts` routing rules in their Worker.
|
|
341
|
-
Framework-owned Workers do not yet support those Void redirects, rewrites,
|
|
342
|
-
fallbacks, or headers on the direct target. The CLI rejects such configuration
|
|
343
|
-
before provisioning or building; configure the rules in the framework or its
|
|
344
|
-
Worker instead. This restriction does not change an explicit asset policy for
|
|
345
|
-
`routing.notFound`.
|
|
346
|
-
|
|
347
|
-
Worker apps support D1, KV, R2, Queues, typed state, PostgreSQL and MySQL through Hyperdrive, auth, WebSockets, AI, cron jobs, and ISR. The main limits are:
|
|
190
|
+
Void deploys native apps, static sites, SPAs, supported SSGs, and Cloudflare builds from TanStack Start, React Router, SvelteKit, Nuxt, Analog, and Astro. The vinext adapters are experimental.
|
|
348
191
|
|
|
349
|
-
-
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
192
|
+
- Native apps support Void routing rules. Framework apps on the direct target must configure redirects, rewrites, fallbacks, and headers through their framework or Worker.
|
|
193
|
+
- `--skip-build` works for existing static output. Worker apps require a fresh build.
|
|
194
|
+
- Named Cloudflare environments aren't supported. Use a separate Void project config for each target.
|
|
195
|
+
- Sandbox requires Workers Paid and Docker. See [Sandbox requirements](../guide/sandboxes.md#deployment) for plan and token permissions.
|
|
196
|
+
- Email to arbitrary recipients requires Workers Paid; verified recipients and inbound mail work on Workers Free. See [Email](../guide/email/domains.md#your-own-cloudflare-account).
|
|
197
|
+
- Node.js, Bun, and Deno use their [own deployment path](./nodejs-bun-deno.md).
|
|
354
198
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
ISR uses the shared cache protocol. Entries are scoped to a deployment and hostname, and `routing.revalidateQueryAllowlist` adds bounded query variants. `revalidate()` purges matching entries and variants from KV and the local edge cache. See [ISR](#isr-self-host) below for cache behavior across regions.
|
|
199
|
+
Commit Durable Object migration history in `void.lock.json`. Do not delete or reorder deployed steps.
|
|
358
200
|
|
|
359
201
|
### Managing the deployed app
|
|
360
202
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
Custom domain changes update routes immediately without rewriting schedules, queues, or workflows. Removing the final custom domain uses your browser session from `void cloudflare login` or an API token with Workers Scripts: Edit permission.
|
|
364
|
-
|
|
365
|
-
`void project delete` doesn't remove direct Cloudflare resources, which may be shared. Review their use and remove them explicitly in Cloudflare.
|
|
366
|
-
|
|
367
|
-
::: details How Void checks the build
|
|
203
|
+
`void secret`, `void domain`, `void project status|list|logs|rollback`, and remote `void db` commands use the selected account and Worker. Logs are a live tail.
|
|
368
204
|
|
|
369
|
-
|
|
205
|
+
Custom domain commands update routes immediately. If a first deployment times out while DNS or TLS is propagating, check the domain in Cloudflare and retry once `/__void/ready` is reachable.
|
|
370
206
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
:::
|
|
207
|
+
`void project delete` does not remove Cloudflare resources. Review ownership and remove them in Cloudflare.
|
|
374
208
|
|
|
375
209
|
### Local development
|
|
376
210
|
|
|
377
|
-
|
|
211
|
+
Local D1, KV, and R2 bindings use local data. Your production resource IDs are used during deployment.
|
|
378
212
|
|
|
379
|
-
|
|
213
|
+
Workers AI runs remotely after you connect to Cloudflare, so development calls consume your account's allowance.
|
|
380
214
|
|
|
381
|
-
|
|
215
|
+
### AI on your Cloudflare account {#ai-self-host}
|
|
382
216
|
|
|
383
|
-
|
|
384
|
-
- **Provider models** (`ai.provider("openai").fetch(...)`) route through _your own_ Cloudflare AI Gateway. Set its id in `void.config.ts` and add the provider's API key as a Worker secret.
|
|
217
|
+
`ai.run()`, `ai.stream()`, and `ai.image()` use your Workers AI binding. For provider models, configure your AI Gateway and store the provider key as a Worker secret:
|
|
385
218
|
|
|
386
219
|
```ts
|
|
387
220
|
import { defineConfig } from 'void/config';
|
|
388
221
|
|
|
389
222
|
export default defineConfig({
|
|
390
|
-
ai: {
|
|
391
|
-
gateway: 'my-gateway', // an AI Gateway in your Cloudflare account
|
|
392
|
-
},
|
|
223
|
+
ai: { gateway: 'my-gateway' },
|
|
393
224
|
});
|
|
394
225
|
```
|
|
395
226
|
|
|
396
|
-
```
|
|
397
|
-
# provider API key, stored as a Worker secret (never committed)
|
|
227
|
+
```sh
|
|
398
228
|
void secret put OPENAI_API_KEY
|
|
399
229
|
```
|
|
400
230
|
|
|
401
|
-
|
|
402
|
-
// routes/chat.ts
|
|
403
|
-
import { defineHandler } from 'void';
|
|
404
|
-
import { ai } from 'void/ai';
|
|
405
|
-
|
|
406
|
-
export const POST = defineHandler(async (c) => {
|
|
407
|
-
// Workers AI -- uses the inferred or configured AI binding directly
|
|
408
|
-
const summary = await ai.run('@cf/meta/llama-3.3-70b-instruct-fp8-fast', {
|
|
409
|
-
prompt: 'Summarize the changelog.',
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
// Provider model -- routes through your "my-gateway" AI Gateway,
|
|
413
|
-
// authed with the OPENAI_API_KEY secret above
|
|
414
|
-
const res = await ai.provider('openai').fetch('chat/completions', {
|
|
415
|
-
method: 'POST',
|
|
416
|
-
body: JSON.stringify({ model: 'gpt-4o-mini', messages: [] }),
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
return c.json({ summary, provider: await res.json() });
|
|
420
|
-
});
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Set `ai.gateway` before calling `ai.provider().fetch()`; otherwise it returns `501`. Requests use the provider secrets in your Worker's environment and go through your AI Gateway to the provider. They don't pass through the Void platform's shared proxy.
|
|
424
|
-
|
|
425
|
-
Notes:
|
|
426
|
-
|
|
427
|
-
- **Account-owned usage.** Direct deployments use your own [Cloudflare AI Gateway analytics](https://developers.cloudflare.com/ai-gateway/). A team platform meters requests through its shared proxy; those usage records do not automatically bill application developers.
|
|
428
|
-
- **Custom AI binding names are supported.** Set `inference.bindings.ai` to `MY_AI`, or declare `cloudflare.ai.binding` in `void.config.ts`; the generated worker records the resolved name for `void/ai` automatically.
|
|
429
|
-
- **Workers AI runs remotely during development.** After `void connect --platform cloudflare`, an app importing `void/ai` uses your account's remote AI binding with your Cloudflare login or API token. Development and preview calls consume that account's allowance. Apps without AI imports add no AI binding or authentication probe.
|
|
231
|
+
`ai.provider('openai').fetch(...)` then uses that gateway and key. See the [AI guide](../guide/ai.md) for examples. Use [AI Gateway analytics](https://developers.cloudflare.com/ai-gateway/) to inspect account usage.
|
|
430
232
|
|
|
431
233
|
### ISR on your Cloudflare account {#isr-self-host}
|
|
432
234
|
|
|
433
|
-
[
|
|
434
|
-
|
|
435
|
-
Configure revalidation exactly as on the platform -- globally or per-path in `void.config.ts`:
|
|
436
|
-
|
|
437
|
-
```ts
|
|
438
|
-
import { defineConfig } from 'void/config';
|
|
439
|
-
|
|
440
|
-
export default defineConfig({
|
|
441
|
-
routing: {
|
|
442
|
-
revalidate: { '/blog/*': 3600, '*': 60 },
|
|
443
|
-
},
|
|
444
|
-
});
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
...or per page with an exported `revalidate` literal in a `.server.ts` companion (Pages mode):
|
|
448
|
-
|
|
449
|
-
```ts
|
|
450
|
-
// pages/blog/[slug].server.ts
|
|
451
|
-
export const revalidate = 3600; // seconds
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
On-demand purges work through `revalidate()`:
|
|
455
|
-
|
|
456
|
-
```ts
|
|
457
|
-
import { revalidate } from 'void/isr';
|
|
458
|
-
|
|
459
|
-
await revalidate({ paths: ['/blog/hello'] });
|
|
460
|
-
// or purge every ISR page:
|
|
461
|
-
await revalidate({ all: true });
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
Self-hosted, `revalidate()` purges this worker's own KV entries (global, authoritative) plus the current colo's edge cache.
|
|
235
|
+
Configure [revalidation](../guide/edge/revalidation.md) globally, per path, or per page. Void provisions the cache automatically.
|
|
465
236
|
|
|
466
|
-
|
|
237
|
+
`revalidate()` clears shared storage and the current data center's edge cache. Other data centers can serve cached responses until their cache lifetime expires. Pages data requests in a data center that hasn't rendered the HTML are generated live.
|
|
467
238
|
|
|
468
|
-
|
|
469
|
-
- **Pages JSON is cached after an HTML render.** A data center that hasn't rendered the HTML yet generates the JSON response live rather than reading it from KV.
|
|
470
|
-
- **Each deploy starts with a fresh cache.** Cache keys include a new deployment ID, so cached HTML can't reference assets from an older build. The first request renders the page again.
|
|
239
|
+
Each deploy starts with a fresh cache.
|