void 0.21.9 → 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-DZZGK80W.mjs → account-cmd-C84Ee8cO.mjs} +5 -5
- 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-B_CeugBw.mjs → auth-link-CioEg6uY.mjs} +5 -5
- package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-BsR981d4.mjs} +5 -5
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-LzvNJORH.mjs} +19 -7
- package/dist/{cache-7_UeZdTk.mjs → cache-C4MvnrMH.mjs} +4 -4
- package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-abUxpP2n.mjs} +4 -4
- package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BPqOT964.mjs} +141 -63
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +114 -460
- package/dist/cli/cloudflare-operation-process.mjs +1103 -0
- 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-QTl6ko_D.mjs → client-RV8NVeB8.mjs} +165 -21
- package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -43
- package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +9 -10
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-B8uPZ4nx.mjs} +4 -4
- package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
- package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-fxHb-byx.mjs} +118 -203
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-CF69HgXc.d.mts → config-BMHb8RCj.d.mts} +2 -2
- package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
- package/dist/{connect-BsUSRzln.mjs → connect-Bd4kJd9U.mjs} +6 -6
- package/dist/{create-project-BniEV0OW.mjs → create-project-Boczwj5r.mjs} +1 -1
- package/dist/{create-project-DBfFSZKY.mjs → create-project-bMf6ffLZ.mjs} +9 -5
- package/dist/{db-hRrvZaq_.mjs → db-8uG64XLl.mjs} +26 -26
- package/dist/{delete-D6dZ9B6B.mjs → delete-NvbiyeJf.mjs} +4 -4
- package/dist/{deploy-WaAQez1O.mjs → deploy-DzAIwqNU.mjs} +944 -607
- package/dist/{deploy-DDz7c8LK.mjs → deploy-bjXdFCtn.mjs} +1 -1
- package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
- package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
- package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
- package/dist/{domain-Dmhvb2oU.mjs → domain-y5Tvydvo.mjs} +5 -5
- package/dist/{email-DFi-s2t4.mjs → email-B3umsW75.mjs} +15 -30
- package/dist/{env-Csi-tMbT.mjs → env-BS6qYHDb.mjs} +6 -6
- package/dist/{env-public-D_6u46fX.d.mts → env-public-BX_r8HR6.d.mts} +2 -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-Dz3X1Qab.mjs → gen-B580--vC.mjs} +5 -5
- package/dist/gen-BVaUUumi.mjs +2 -0
- package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-v45BdfKX.mjs} +6 -8
- package/dist/{handler-BXJTXd02.d.mts → handler-CZ4nAylQ.d.mts} +2 -1
- package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
- package/dist/help-DofyZuY7.mjs +2 -0
- package/dist/{help-DC7gdz7L.mjs → help-daGKjXGk.mjs} +268 -666
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +305 -1490
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-WO0JlPx8.mjs → init-Bvy7zrBo.mjs} +51 -20
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-CsHOinF7.mjs → link-CDqqCjFl.mjs} +5 -5
- package/dist/{list-CDb-4bZ1.mjs → list-CZj0dzKY.mjs} +5 -5
- package/dist/{live-CKiJilLr.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-CC8sKFGu.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/login-DYt_An22.mjs +2 -0
- package/dist/{login-DvqXsfGs.mjs → login-UZKFM_u7.mjs} +5 -5
- package/dist/{logs-BdfiOezj.mjs → logs-CUZ6t9t3.mjs} +5 -5
- package/dist/migrate-8_2u55MD.mjs +2 -0
- package/dist/{migrate-B8KuoYsO.mjs → migrate-DHul7PRV.mjs} +5 -4
- package/dist/{node-BM43oz4G.mjs → node-BkyRWRx8.mjs} +2 -2
- package/dist/operator-args-CLgKGlwU.mjs +690 -0
- package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-DBA6dl0m.mjs} +69 -23
- package/dist/output-Dm_A4Tbv.mjs +81 -0
- 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 +3 -3
- package/dist/pages/islands-plugin.d.mts +16 -6
- package/dist/pages/islands-plugin.mjs +2 -2
- 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/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
- 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-z92h63q5.mjs → platform-auth-config-B56E9YP1.mjs} +4 -4
- package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-BDWO_aER.mjs} +3 -3
- package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-1gg4CSRe.mjs} +4 -4
- package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
- package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-DMcQStSc.mjs} +26 -5
- package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-BNkcz0OB.mjs} +36 -9
- package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-9OyBALhH.mjs} +850 -276
- package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
- package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-CjwLVQwN.mjs} +59 -11
- package/dist/{platform-management-C8tt6D8h.mjs → platform-management-CnyTdcWX.mjs} +1 -1
- package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
- package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-DyZ-Yok5.mjs → prepare-B5Mkic5u.mjs} +3 -3
- package/dist/{prepare-C3kt3Rst.mjs → prepare-DOsL0CC9.mjs} +4 -20
- package/dist/prepare-cgvDMtSb.mjs +2 -0
- package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-CNzrqvBv.mjs} +30 -16
- package/dist/{project-team-BkbYIsXN.mjs → project-team-DQOWPfQT.mjs} +4 -4
- package/dist/{project-token-C8xEEQnB.mjs → project-token-CTDYU0Cc.mjs} +4 -4
- package/dist/project-zero-trust-BNAkW-_0.mjs +63 -0
- package/dist/{protocol-ZH3jP4a7.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-DNtrtaVD.mjs → provision-C4ORE7G7.mjs} +1 -1
- package/dist/{provision-BhreDAOS.mjs → provision-CJFgTZY8.mjs} +111 -215
- package/dist/{requests-DFyhBMaf.mjs → requests-MhxYnau8.mjs} +4 -4
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-DHHxXZiS.mjs → rollback-CJ6iSDoU.mjs} +5 -5
- 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 +3 -0
- package/dist/runtime/sandbox-container.mjs +2 -0
- package/dist/runtime/sandbox.d.mts +4 -32
- package/dist/runtime/sandbox.mjs +151 -75
- 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-XZAqzFlG.d.mts +52 -0
- package/dist/sandbox-container-Bo0eiFKz.d.mts +73 -0
- package/dist/sandbox-container-C6ItmVuN.mjs +281 -0
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-DN9sSNiV.mjs → secret-Dli5fP0B.mjs} +6 -6
- package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-BymcxrRa.mjs → wrangler-7K-bW_DL.mjs} +14 -235
- package/dist/{ws-BwcqizuH.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +48 -33
- package/sandbox.Dockerfile +4 -0
- package/schema.json +10 -22
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +50 -133
- 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 +6 -19
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +23 -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 +189 -0
- package/skills/void/docs/guide/platform/development/local.md +2 -2
- 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 +31 -3
- package/skills/void/docs/guide/platform/installation/first-deployment.md +6 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +21 -16
- package/skills/void/docs/guide/platform/installation/setup.md +9 -5
- package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
- package/skills/void/docs/guide/platform-administration.md +2 -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 +78 -41
- 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 +33 -1621
- package/skills/void/docs/reference/config.md +26 -32
- 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/cli/cf-compat.mjs +0 -968
- package/dist/client-4cDVv7BO.mjs +0 -2
- package/dist/gen-Vnv2f65C.mjs +0 -2
- package/dist/help-DQMfeKMz.mjs +0 -2
- package/dist/login-DFQk7rbW.mjs +0 -2
- package/dist/migrate-TsHGBnDA.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-BZXkjdNe.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,7 +4,7 @@ outline: deep
|
|
|
4
4
|
|
|
5
5
|
# MySQL
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Connect your MySQL database through [Cloudflare Hyperdrive](https://developers.cloudflare.com/hyperdrive/), then define tables and query them with Drizzle. Void configures the connection and applies your migrations when you deploy.
|
|
8
8
|
|
|
9
9
|
## Configure
|
|
10
10
|
|
|
@@ -36,25 +36,17 @@ This connects directly to your Postgres database during local Vite development.
|
|
|
36
36
|
|
|
37
37
|
### 3. Deploy
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
For a Void platform, deploy prompts for the connection string if needed. You can also set it with `void db set-url`. For direct Cloudflare deploys, export the production `DATABASE_URL` in your shell.
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
Your project uses PostgreSQL. Enter your connection string:
|
|
43
|
-
> postgresql://user:password@host:5432/mydb?sslmode=require
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Void provisions Hyperdrive and records its config ID. The connection string isn't written to `void.config.ts`, `void.lock.json`, or generated Worker config.
|
|
47
|
-
Both `postgres://` and `postgresql://` URLs are supported, including provider-supplied query strings such as `?sslmode=require`.
|
|
48
|
-
|
|
49
|
-
For a linked Void project, you can also configure the connection with `void db set-url`. For a direct Cloudflare deploy, export the production `DATABASE_URL` in your shell.
|
|
41
|
+
Void provisions Hyperdrive without saving the connection string in project config. Both `postgres://` and `postgresql://` URLs are supported, including provider query strings such as `?sslmode=require`.
|
|
50
42
|
|
|
51
43
|
## Schema Definition
|
|
52
44
|
|
|
53
|
-
|
|
45
|
+
Import schema helpers from `void/schema-pg`:
|
|
54
46
|
|
|
55
47
|
```ts
|
|
56
48
|
// db/schema.ts
|
|
57
|
-
import { pgTable, serial, text, timestamp, boolean
|
|
49
|
+
import { pgTable, serial, text, timestamp, boolean } from 'void/schema-pg';
|
|
58
50
|
|
|
59
51
|
export const users = pgTable('users', {
|
|
60
52
|
id: serial('id').primaryKey(),
|
|
@@ -86,20 +78,7 @@ void db status
|
|
|
86
78
|
|
|
87
79
|
The main difference is that PostgreSQL supports **transactional DDL**. Each migration is wrapped in `BEGIN` and `COMMIT`, so a failure rolls back the whole migration instead of leaving the database half-updated.
|
|
88
80
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
When deploying a PostgreSQL project to a Void platform:
|
|
92
|
-
|
|
93
|
-
1. The app is built
|
|
94
|
-
2. Migration files are collected from `db/migrations/`
|
|
95
|
-
3. If Hyperdrive hasn't been provisioned yet, you're prompted for the connection string
|
|
96
|
-
4. Pending migrations run inside the deployed worker via Hyperdrive
|
|
97
|
-
5. The new worker goes live
|
|
98
|
-
|
|
99
|
-
When deploying to your own account with `void deploy --platform cloudflare`, export the production
|
|
100
|
-
connection string as `DATABASE_URL`. Void uses it to provision Hyperdrive and apply the checked-in
|
|
101
|
-
migrations transactionally before it uploads the Worker. The connection string is not written to
|
|
102
|
-
`void.config.ts`, `void.lock.json`, or the generated Worker config.
|
|
81
|
+
`void deploy` applies pending migrations before making the new version live. See [Deployment](../deployment.md).
|
|
103
82
|
|
|
104
83
|
## Updating the Connection String
|
|
105
84
|
|
|
@@ -39,16 +39,13 @@ Define your tables in TypeScript, then query them with `db` from `void/db`. Void
|
|
|
39
39
|
|
|
40
40
|
## Choosing a Dialect
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Choose a database during `void init`, or set `database` in `void.config.ts`:
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| Managed by | Void | Bring your own database | Bring your own database |
|
|
50
|
-
| Best for | Prototypes, read-heavy apps | Complex queries, existing Postgres | Existing MySQL infrastructure |
|
|
51
|
-
| Connection | Automatic D1 binding | Hyperdrive | Hyperdrive |
|
|
44
|
+
| | [D1 (SQLite)](./database/d1) | [PostgreSQL](./database/postgresql) | [MySQL](./database/mysql) |
|
|
45
|
+
| ---------- | ---------------------------- | ----------------------------------- | ------------------------- |
|
|
46
|
+
| Config | Default | `"database": "pg"` | `"database": "mysql"` |
|
|
47
|
+
| Managed by | Void | Bring your own database | Bring your own database |
|
|
48
|
+
| Connection | Automatic D1 binding | Hyperdrive | Hyperdrive |
|
|
52
49
|
|
|
53
50
|
## Schema Definition
|
|
54
51
|
|
|
@@ -235,25 +232,15 @@ const usersWithPosts = await db.query.users.findMany({
|
|
|
235
232
|
});
|
|
236
233
|
```
|
|
237
234
|
|
|
238
|
-
The user schema is automatically loaded into the `db` instance via a Vite plugin, so relational queries work out of the box.
|
|
239
|
-
|
|
240
235
|
::: warning ⚠️ Nuxt and Analog limitations
|
|
241
|
-
Nuxt and Analog use
|
|
236
|
+
In Nuxt and Analog, use the query builder (`db.select().from(table)`). The `db.query.*` relational API is not available in these frameworks.
|
|
242
237
|
:::
|
|
243
238
|
|
|
244
239
|
## Seeding
|
|
245
240
|
|
|
246
241
|
Use `void db seed` to reset your local database, re-apply migrations, and then run a seed file.
|
|
247
242
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
1. `db/seed.ts`
|
|
251
|
-
2. `db/seed.mts`
|
|
252
|
-
3. `db/seed.js`
|
|
253
|
-
4. `db/seed.mjs`
|
|
254
|
-
5. `db/seed.sql`
|
|
255
|
-
|
|
256
|
-
If more than one default seed file exists, pass `--file <path>` explicitly.
|
|
243
|
+
Use `db/seed.ts` for a programmatic seed or `db/seed.sql` for SQL. JavaScript and `.mts` / `.mjs` files also work. If more than one seed file exists, choose one with `--file <path>`.
|
|
257
244
|
|
|
258
245
|
### Programmatic seeding
|
|
259
246
|
|
|
@@ -274,7 +261,7 @@ export default defineSeed<typeof import('./schema')>(async ({ db, schema }) => {
|
|
|
274
261
|
|
|
275
262
|
The seed context includes:
|
|
276
263
|
|
|
277
|
-
- `dialect`: `"sqlite"` or `"
|
|
264
|
+
- `dialect`: `"sqlite"`, `"postgresql"`, or `"mysql"`
|
|
278
265
|
- `db`: a Drizzle instance for the local database
|
|
279
266
|
- `schema`: the exports from your `db/schema.ts` or `db/schema/` modules
|
|
280
267
|
|
|
@@ -288,25 +275,14 @@ INSERT INTO messages (text) VALUES ('Hello from SQL');
|
|
|
288
275
|
|
|
289
276
|
## Schema-Derived Validators
|
|
290
277
|
|
|
291
|
-
|
|
278
|
+
Derive request validators from your tables with `void/drizzle-zod`, `void/drizzle-valibot`, or `void/drizzle-arktype`. Add the validator after your table definition:
|
|
292
279
|
|
|
293
280
|
::: code-group
|
|
294
281
|
|
|
295
282
|
```ts [Zod]
|
|
296
283
|
// db/schema.ts
|
|
297
|
-
import { sqliteTable, text, integer } from 'void/schema-d1';
|
|
298
|
-
import { sql } from 'void/db';
|
|
299
284
|
import { createInsertSchema } from 'void/drizzle-zod';
|
|
300
285
|
|
|
301
|
-
export const users = sqliteTable('users', {
|
|
302
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
303
|
-
name: text('name').notNull(),
|
|
304
|
-
email: text('email').notNull(),
|
|
305
|
-
createdAt: text('created_at')
|
|
306
|
-
.notNull()
|
|
307
|
-
.default(sql`(datetime('now'))`),
|
|
308
|
-
});
|
|
309
|
-
|
|
310
286
|
export const insertUserSchema = createInsertSchema(users, {
|
|
311
287
|
name: (schema) => schema.min(1),
|
|
312
288
|
email: (schema) => schema.email(),
|
|
@@ -315,20 +291,9 @@ export const insertUserSchema = createInsertSchema(users, {
|
|
|
315
291
|
|
|
316
292
|
```ts [Valibot]
|
|
317
293
|
// db/schema.ts
|
|
318
|
-
import { sqliteTable, text, integer } from 'void/schema-d1';
|
|
319
|
-
import { sql } from 'void/db';
|
|
320
294
|
import { createInsertSchema } from 'void/drizzle-valibot';
|
|
321
295
|
import { pipe, minLength, email } from 'valibot';
|
|
322
296
|
|
|
323
|
-
export const users = sqliteTable('users', {
|
|
324
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
325
|
-
name: text('name').notNull(),
|
|
326
|
-
email: text('email').notNull(),
|
|
327
|
-
createdAt: text('created_at')
|
|
328
|
-
.notNull()
|
|
329
|
-
.default(sql`(datetime('now'))`),
|
|
330
|
-
});
|
|
331
|
-
|
|
332
297
|
export const insertUserSchema = createInsertSchema(users, {
|
|
333
298
|
name: (schema) => pipe(schema, minLength(1)),
|
|
334
299
|
email: (schema) => pipe(schema, email()),
|
|
@@ -337,20 +302,9 @@ export const insertUserSchema = createInsertSchema(users, {
|
|
|
337
302
|
|
|
338
303
|
```ts [ArkType]
|
|
339
304
|
// db/schema.ts
|
|
340
|
-
import { sqliteTable, text, integer } from 'void/schema-d1';
|
|
341
|
-
import { sql } from 'void/db';
|
|
342
305
|
import { createInsertSchema } from 'void/drizzle-arktype';
|
|
343
306
|
import { type } from 'arktype';
|
|
344
307
|
|
|
345
|
-
export const users = sqliteTable('users', {
|
|
346
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
347
|
-
name: text('name').notNull(),
|
|
348
|
-
email: text('email').notNull(),
|
|
349
|
-
createdAt: text('created_at')
|
|
350
|
-
.notNull()
|
|
351
|
-
.default(sql`(datetime('now'))`),
|
|
352
|
-
});
|
|
353
|
-
|
|
354
308
|
export const insertUserSchema = createInsertSchema(users, {
|
|
355
309
|
name: type('string > 0'),
|
|
356
310
|
email: type('string.email'),
|
|
@@ -397,35 +351,29 @@ npm install arktype
|
|
|
397
351
|
|
|
398
352
|
## CLI Commands
|
|
399
353
|
|
|
400
|
-
| Command | Purpose
|
|
401
|
-
| ------------------ |
|
|
402
|
-
| `void db push` | Apply schema
|
|
403
|
-
| `void db
|
|
404
|
-
| `void db
|
|
405
|
-
| `void db
|
|
406
|
-
| `void db
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
| `void db execute` | Run ad-hoc SQL against local DB (`--file <path>`) |
|
|
410
|
-
| `void db studio` | Open Drizzle Studio for the local database |
|
|
411
|
-
| `void db export` | Dump local DB as SQL (`--output`, `--no-data`, `--no-schema`) |
|
|
412
|
-
| `void db set-url` | Update the PostgreSQL or MySQL connection string for deployment |
|
|
413
|
-
|
|
414
|
-
See the [CLI reference](../reference/cli.md#database) for details.
|
|
354
|
+
| Command | Purpose |
|
|
355
|
+
| ------------------ | ---------------------------------------------------- |
|
|
356
|
+
| `void db push` | Apply schema changes locally without migration files |
|
|
357
|
+
| `void db generate` | Generate SQL migrations |
|
|
358
|
+
| `void db migrate` | Apply pending migrations locally |
|
|
359
|
+
| `void db status` | Check schema drift and pending migrations |
|
|
360
|
+
| `void db seed` | Reset the local database and run a seed file |
|
|
361
|
+
|
|
362
|
+
See the [CLI reference](../reference/cli/database.md#database) for connection setup, SQL execution, Studio, exports, and other commands.
|
|
415
363
|
|
|
416
364
|
## Scaffolding
|
|
417
365
|
|
|
418
366
|
The `void gen model` command generates dialect-appropriate `sqliteTable`, `pgTable`, or `mysqlTable` definitions.
|
|
419
367
|
|
|
420
368
|
```bash
|
|
421
|
-
void gen model
|
|
369
|
+
void gen model posts title:string body:text published:boolean
|
|
422
370
|
```
|
|
423
371
|
|
|
424
372
|
This creates:
|
|
425
373
|
|
|
426
|
-
1. `db/schema/
|
|
427
|
-
2. Updates `db/schema.ts` with `export * from "./schema/
|
|
374
|
+
1. `db/schema/posts.ts`: a Drizzle table definition with `id`, `createdAt`, `updatedAt`, and your columns
|
|
375
|
+
2. Updates `db/schema.ts` with `export * from "./schema/posts"`
|
|
428
376
|
3. `routes/api/posts/index.ts`: `GET` for list and `POST` for insert with validation
|
|
429
377
|
4. `routes/api/posts/[id].ts`: `GET` by id with `404` handling
|
|
430
378
|
|
|
431
|
-
See the [CLI reference](../reference/cli.md#code-generation) for the full list of generators.
|
|
379
|
+
See the [CLI reference](../reference/cli/generate.md#code-generation) for the full list of generators.
|
|
@@ -6,7 +6,7 @@ outline: deep
|
|
|
6
6
|
|
|
7
7
|
`void deploy` builds your app, provisions its resources, applies migrations, and deploys it to your own Cloudflare account or a Void platform run by your team.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You can [install a Void platform](./self-hosted-platform.md) for shared team deployments.
|
|
10
10
|
|
|
11
11
|
## Deployment Targets
|
|
12
12
|
|
|
@@ -51,21 +51,13 @@ Your choice is saved in `.void/project.json`, so the next deploy is just `void d
|
|
|
51
51
|
|
|
52
52
|
Already have a Cloudflare Worker and a root `wrangler.jsonc` or `wrangler.json`? Run `void deploy`. If no destination is selected, Void offers to link and deploy using the existing Worker and resources. Accept once to keep deploying to that site. See [Deploy an existing Worker](../integrations/cloudflare.md#deploy-an-existing-worker) for the first-deployment checks.
|
|
53
53
|
|
|
54
|
-
To
|
|
54
|
+
To set up deployment later, use `void connect --platform cloudflare` or `void connect <platform-url>`.
|
|
55
55
|
|
|
56
56
|
Owners can [share a platform project](./project-collaboration.md) with readers, collaborators, and project administrators. This does not apply to direct Cloudflare deployments.
|
|
57
57
|
|
|
58
58
|
### Migrations
|
|
59
59
|
|
|
60
|
-
If your
|
|
61
|
-
|
|
62
|
-
1. Build the app
|
|
63
|
-
2. Read SQL migrations from `db/migrations/`
|
|
64
|
-
3. Check that the migrations match your current schema
|
|
65
|
-
4. Apply pending migrations to the target database
|
|
66
|
-
5. Make the new deploy live
|
|
67
|
-
|
|
68
|
-
If you've changed your schema without a matching migration, deploy stops. Run `void db generate`, review and commit the SQL, then deploy again. For the full database workflow and backend-specific details, see the [Database guide](./database.md).
|
|
60
|
+
Deploy applies pending SQL migrations from `db/migrations/`. If your schema has changes without a migration, deploy stops. Run `void db generate`, review and commit the SQL, then deploy again. See the [Database guide](./database.md).
|
|
69
61
|
|
|
70
62
|
### Flags
|
|
71
63
|
|
|
@@ -117,131 +109,53 @@ If your platform supports managed GitHub builds, the Void GitHub App can build a
|
|
|
117
109
|
|
|
118
110
|
You don't need a deployment workflow file or a repository `VOID_TOKEN` for this path.
|
|
119
111
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
void init
|
|
124
|
-
# Or, for existing Void project:
|
|
125
|
-
void project link
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
2. Install the Void GitHub app
|
|
112
|
+
With a linked project, connect the repository:
|
|
129
113
|
|
|
130
|
-
```
|
|
114
|
+
```sh
|
|
131
115
|
void github install
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Void opens GitHub so you can install and authorize the `Void Deploy` app.
|
|
135
|
-
|
|
136
|
-
In the browser, select the GitHub account/organization and grant access to the repository.
|
|
137
|
-
|
|
138
|
-
:::details If someone already installed the App for your organization
|
|
139
|
-
Join that installation instead:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
void github join
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
:::
|
|
146
|
-
|
|
147
|
-
3. Link your repository to your project
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
116
|
void github connect --executor container
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Organization installations always require a browser proof for the specific repository, including for the person who installed the App. Void does not reveal the installation's full private repository list. If an upgraded platform marks an older organization connection as requiring reconnection, run the same `void github connect` command again to renew that repository-scoped authorization before builds resume.
|
|
154
|
-
|
|
155
|
-
4. Verify the connection
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
117
|
void github status
|
|
159
118
|
```
|
|
160
119
|
|
|
161
|
-
|
|
120
|
+
If your organization already installed the App, Void can join that installation during setup. Organization repositories require browser authorization.
|
|
162
121
|
|
|
163
|
-
|
|
164
|
-
Repository <owner/repository>
|
|
165
|
-
Branch main
|
|
166
|
-
Build executor container
|
|
167
|
-
Deploy workflow .github/workflows/void-deploy.yml (unused for container builds)
|
|
122
|
+
Push to the configured branch to deploy, then follow progress with `void build logs --follow`. See [GitHub commands](../reference/cli/github.md#github) for installation sharing and connection options.
|
|
168
123
|
|
|
169
|
-
|
|
124
|
+
### GitHub Actions
|
|
170
125
|
|
|
171
|
-
|
|
126
|
+
Run `void init --github` to generate the workflow for your saved platform and package manager. On Void platforms with GitHub Actions support, authorize the repository once:
|
|
172
127
|
|
|
173
|
-
```
|
|
174
|
-
|
|
128
|
+
```sh
|
|
129
|
+
void github connect <project> --repo <owner/repo> --executor github_actions
|
|
175
130
|
```
|
|
176
131
|
|
|
177
|
-
|
|
132
|
+
Set the repository's `VOID_API_URL` variable to your platform's API URL. Keep `permissions: id-token: write` in the workflow for [GitHub OIDC](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). The workflow uses your linked project, or the `VOID_PROJECT` repository variable.
|
|
178
133
|
|
|
179
|
-
|
|
180
|
-
void build logs --follow
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### GitHub Actions
|
|
134
|
+
Core self-hosted installations do not support this integration. Use your own CI workflow with a [project deploy token](./platform/installation/first-deployment.md).
|
|
184
135
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
The generated workflow uses the platform selected during `void init`. Core self-hosted installations don't yet support this integration, so Void doesn't offer the workflow for them. For a platform that does, the npm version looks like this; set the repository's `VOID_API_URL` variable to your platform's API URL:
|
|
188
|
-
|
|
189
|
-
```yaml
|
|
190
|
-
name: Deploy to Void
|
|
191
|
-
on:
|
|
192
|
-
push:
|
|
193
|
-
branches: [main]
|
|
194
|
-
|
|
195
|
-
# Latest push wins: a newer commit cancels an in-flight deploy for the same
|
|
196
|
-
# repo + branch, so an older commit can never overtake a newer one.
|
|
197
|
-
concurrency:
|
|
198
|
-
group: void-deploy-${{ github.repository }}-${{ github.ref }}
|
|
199
|
-
cancel-in-progress: true
|
|
200
|
-
|
|
201
|
-
permissions:
|
|
202
|
-
id-token: write
|
|
203
|
-
contents: read
|
|
204
|
-
|
|
205
|
-
env:
|
|
206
|
-
VOID_API_URL: ${{ vars.VOID_API_URL }}
|
|
207
|
-
VOID_PROJECT: my-app
|
|
208
|
-
|
|
209
|
-
jobs:
|
|
210
|
-
deploy:
|
|
211
|
-
runs-on: ubuntu-latest
|
|
212
|
-
steps:
|
|
213
|
-
- uses: actions/checkout@v6
|
|
214
|
-
- uses: actions/setup-node@v6
|
|
215
|
-
with:
|
|
216
|
-
node-version: lts/*
|
|
217
|
-
cache: npm
|
|
218
|
-
- run: npm ci
|
|
219
|
-
- name: Deploy
|
|
220
|
-
run: npx void deploy --platform void --project "$VOID_PROJECT"
|
|
221
|
-
```
|
|
136
|
+
## Other Targets
|
|
222
137
|
|
|
223
|
-
|
|
138
|
+
### Your own Cloudflare account
|
|
224
139
|
|
|
225
|
-
|
|
140
|
+
Select Cloudflare during setup, or run `void deploy --platform cloudflare`. See the [Cloudflare guide](../integrations/cloudflare.md) for configuration, CI credentials, and deployment limits.
|
|
226
141
|
|
|
227
|
-
|
|
142
|
+
### Node.js, Bun, and Deno
|
|
228
143
|
|
|
229
|
-
|
|
144
|
+
Set [`target`](../reference/config.md#target) in `void.config.ts` to build a standalone server for Node.js, Bun, or Deno. You can run the result on your own server or in a container.
|
|
230
145
|
|
|
231
|
-
|
|
146
|
+
Deploy `dist/ssr` and `dist/client` together. See the target guide for startup commands.
|
|
232
147
|
|
|
233
|
-
|
|
234
|
-
void deploy --platform cloudflare
|
|
235
|
-
```
|
|
148
|
+
These targets don't provide Cloudflare bindings such as D1, KV, R2, and Workers AI. See the [Node.js, Bun, and Deno guide](../integrations/nodejs-bun-deno.md) for the features available on each target.
|
|
236
149
|
|
|
237
|
-
|
|
150
|
+
## Usage and execution limit pages
|
|
238
151
|
|
|
239
|
-
|
|
152
|
+
Void platforms show a built-in page when an app exhausts its request allowance or an invocation exceeds its CPU limit. API requests and Pages action requests receive a structured HTTP 429 with `code: 'usage_limit'`, `resource`, `reason`, and `message`.
|
|
240
153
|
|
|
241
|
-
|
|
154
|
+
To customize browser error pages, add either optional file to your app's public assets:
|
|
242
155
|
|
|
243
|
-
|
|
156
|
+
- `public/usage-limit.html` for exhausted request allowances.
|
|
157
|
+
- `public/execution-limit.html` for execution limits.
|
|
244
158
|
|
|
245
|
-
|
|
159
|
+
Use standalone HTML with inline CSS and data-URL images. These pages run with scripts, external assets and form submissions disabled, so they remain usable while application requests are blocked. Void serves them directly from the deployed assets; your Worker, loaders and database are not involved. A missing or unreadable custom page uses the built-in page.
|
|
246
160
|
|
|
247
|
-
|
|
161
|
+
Responses are not cached. Once a streaming response has started, it cannot be replaced with an error page; clients should display stream failures and end their pending state. These platform pages apply to Void platform deployments. Direct Cloudflare runtime limits use Cloudflare's own response behavior.
|
|
@@ -6,9 +6,9 @@ outline: deep
|
|
|
6
6
|
|
|
7
7
|
Use a Durable Object when requests need to share state under one name, such as a shopping cart, room, or rate limiter. Void gives you typed methods and stores the object's state between calls.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Create a module in `durable-objects/` with `defineDurableState()`. Void provides a SQLite-backed Cloudflare Durable Object for it. This feature supports native Void apps deployed directly to Cloudflare.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Commit `void.lock.json` when Void adds a resource. Keep its deployed migration entries in their original order.
|
|
12
12
|
|
|
13
13
|
## Define state and methods
|
|
14
14
|
|
|
@@ -32,21 +32,11 @@ export const Counter = defineDurableState({
|
|
|
32
32
|
export default Counter;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
For `counter.ts`, Void generates:
|
|
38
|
-
|
|
39
|
-
| Resource | Generated name |
|
|
40
|
-
| ------------------------ | ------------------------- |
|
|
41
|
-
| Binding | `COUNTER` |
|
|
42
|
-
| Worker class | `CounterDurableObject` |
|
|
43
|
-
| Cloudflare migration tag | `void-durable-counter-v1` |
|
|
44
|
-
|
|
45
|
-
Names are derived from kebab-case filenames: `shopping-cart.ts` becomes `SHOPPING_CART` and `ShoppingCartDurableObject`.
|
|
35
|
+
Default-export the object returned by `defineDurableState()`.
|
|
46
36
|
|
|
47
37
|
## Call it from a route
|
|
48
38
|
|
|
49
|
-
Import
|
|
39
|
+
Import your definition and call `get()` with a name to select an object. Method arguments and return values are typed:
|
|
50
40
|
|
|
51
41
|
```ts
|
|
52
42
|
// routes/api/counter.ts
|
|
@@ -64,8 +54,6 @@ The same name always resolves to the same Durable Object. Use `getById(id)` when
|
|
|
64
54
|
|
|
65
55
|
## Execution and persistence
|
|
66
56
|
|
|
67
|
-
Typed methods run through Cloudflare RPC on the generated Durable Object class. Only your declared methods are exposed; Void’s state-loading and persistence helpers stay private.
|
|
68
|
-
|
|
69
57
|
Void loads state before the first operation and runs RPC methods one at a time. After a method, `fetch`, or `alarm` handler succeeds, it saves the updated state.
|
|
70
58
|
|
|
71
59
|
If the handler or save fails, Void restores `context.state` to its previous value. Direct writes to `context.storage` aren't included in that rollback.
|
|
@@ -127,14 +115,51 @@ export const Counter = defineDurableState({
|
|
|
127
115
|
export default Counter;
|
|
128
116
|
```
|
|
129
117
|
|
|
130
|
-
|
|
118
|
+
State migrations update your saved values. Void manages Cloudflare’s separate class migrations in `void.lock.json`.
|
|
131
119
|
|
|
132
120
|
Do not delete or reorder generated Durable Object migrations in `void.lock.json` after deployment. For a class addition, rename, or removal on an existing Worker, review the migration and run `void deploy --platform cloudflare --atomic`. If this Worker needs atomic publication on every deploy, set `deploy: { cloudflare: { mode: 'atomic' } }` in `void.config.ts`. Cloudflare applies class lifecycle changes in one deployment. The Worker receives traffic before Void checks readiness, and you cannot roll back across that migration boundary. Staged deploys keep pre-traffic readiness verification.
|
|
133
121
|
|
|
122
|
+
## Rename a file while keeping its state
|
|
123
|
+
|
|
124
|
+
Before renaming a deployed definition, run:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
void info
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For `durable-objects/counter.ts`, Void prints:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
To preserve this resource when moving its code, add this to 'defineDurableState':
|
|
134
|
+
name: "counter",
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Add that property to the existing definition:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
export const Counter = defineDurableState({
|
|
141
|
+
name: 'counter',
|
|
142
|
+
initialState: { count: 0 },
|
|
143
|
+
methods: {
|
|
144
|
+
read(context) {
|
|
145
|
+
return context.state.count;
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export default Counter;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Rename the file within `durable-objects/`, update its imports, and deploy. Keep `name: 'counter'` and the names passed to `Counter.get()` unchanged to preserve the stored state.
|
|
154
|
+
|
|
155
|
+
`name` is optional. Use a static string, either inline or in a local `const`, containing words that start with a letter, such as `'shopping-cart'`. Names must produce distinct Worker classes and bindings. Changing an existing resource's `name` selects a different resource.
|
|
156
|
+
|
|
157
|
+
If you already moved the file, `void info` also shows resources recorded in `void.lock.json` without a matching definition. Identify the original resource and use its suggested name. If no name can be suggested, restore the original file from source history and run `void info` before moving it again. Keep the existing lock and migration history.
|
|
158
|
+
|
|
134
159
|
## Deployment support
|
|
135
160
|
|
|
136
161
|
Typed state works in local development and direct Cloudflare deploys of native Void apps. Deploy with `void deploy --platform cloudflare`.
|
|
137
162
|
|
|
138
|
-
|
|
163
|
+
Custom Durable Object modules are not supported on Void platforms, in meta-frameworks, or on Node.js, Bun, and Deno.
|
|
139
164
|
|
|
140
165
|
This is separate from [typed WebSocket routes](./websockets.md), which also use SQLite-backed Durable Objects and work on both direct Cloudflare and hosted Void deployments.
|
|
@@ -25,44 +25,13 @@ Define custom response headers in [`void.config.ts`](../../reference/config) usi
|
|
|
25
25
|
- All matching rules are merged. When multiple rules set the same header name, the **last match wins**.
|
|
26
26
|
- User-defined `Cache-Control` overrides the built-in default. The default still applies when no rule matches.
|
|
27
27
|
|
|
28
|
-
## Example: security headers
|
|
29
|
-
|
|
30
|
-
```json
|
|
31
|
-
{
|
|
32
|
-
"routing": {
|
|
33
|
-
"headers": {
|
|
34
|
-
"/*": [
|
|
35
|
-
"X-Frame-Options: DENY",
|
|
36
|
-
"X-Content-Type-Options: nosniff",
|
|
37
|
-
"Referrer-Policy: strict-origin-when-cross-origin"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Example: override caching
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"routing": {
|
|
49
|
-
"headers": {
|
|
50
|
-
"/*.html": ["Cache-Control: public, max-age=300"],
|
|
51
|
-
"/config.json": ["Cache-Control: no-store"]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
28
|
## Scope
|
|
58
29
|
|
|
59
|
-
|
|
30
|
+
Header rules apply to static assets, SSR pages, and API responses, including hashed assets served from cache.
|
|
60
31
|
|
|
61
32
|
For hashed assets, you can add headers, but the platform keeps control of caching and response encoding. Rules cannot replace `Cache-Control`, `Content-Type`, `Content-Encoding`, `Content-Length`, `Content-Range`, `Accept-Ranges`, or `Transfer-Encoding` on these files.
|
|
62
33
|
|
|
63
|
-
Header rules do not apply to
|
|
64
|
-
|
|
65
|
-
- ISR cache responses (these have their own cache-control headers)
|
|
34
|
+
Header rules do not apply to ISR cache responses.
|
|
66
35
|
|
|
67
36
|
### Blocked headers
|
|
68
37
|
|
|
@@ -70,17 +39,4 @@ Header rules do not apply to:
|
|
|
70
39
|
|
|
71
40
|
## Framework `_headers` files
|
|
72
41
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- Framework-generated rules are applied **before** `void.config.ts` rules. Since the last match wins, `routing.headers` in `void.config.ts` takes precedence and can override framework defaults.
|
|
76
|
-
- The `_headers` file is not uploaded as a static asset. Its contents are parsed and included in the manifest only.
|
|
77
|
-
|
|
78
|
-
No configuration is needed. If the framework generates a `_headers` file, it is picked up automatically.
|
|
79
|
-
|
|
80
|
-
## How headers work
|
|
81
|
-
|
|
82
|
-
1. `void deploy` reads header rules from the framework `_headers` file (if present) and `routing.headers` in `void.config.ts`, then includes them in the deploy manifest.
|
|
83
|
-
2. The platform stores the rules in the KV routing entry for your project.
|
|
84
|
-
3. The dispatch Worker adds matching headers before returning a response. Most cached responses include those headers. Hashed assets get header rules on each response, including cache hits, so a rule change takes effect without changing the file.
|
|
85
|
-
|
|
86
|
-
Headers are applied at the edge as part of serving the response; no separate network request is needed.
|
|
42
|
+
Void reads `_headers` files produced by supported frameworks. Your `routing.headers` rules run afterward, so they can override framework defaults. No additional setup is needed.
|