void 0.1.6 → 0.7.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/AGENT_PROMPT.md +15 -0
- package/README.md +62 -123
- package/dist/auth-BdsJ0Aff.d.mts +43 -0
- package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
- package/dist/auth-migrations-BAtAck2g.mjs +117 -0
- package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
- package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
- package/dist/cache-W82I8ihI.mjs +47 -0
- package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
- package/dist/cf-access-Dee5cXxL.mjs +22 -0
- package/dist/chunk-DJd-R1mw.mjs +34 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +1807 -0
- package/dist/client-snXOjrp1.mjs +565 -0
- package/dist/collect-CjeZgz5D.mjs +55 -0
- package/dist/config-BIa9HwVX.mjs +573 -0
- package/dist/config-BzM9Dy7T.mjs +37 -0
- package/dist/config-CvHtTM0q.mjs +30 -0
- package/dist/create-project-BIA15W7z.mjs +90 -0
- package/dist/db-DsRoMcfN.mjs +895 -0
- package/dist/defer-DcxEsVH1.mjs +49 -0
- package/dist/delete-DAP6yDc7.mjs +64 -0
- package/dist/deploy-BPKblFx6.mjs +2424 -0
- package/dist/discover-B7FkXBLB.mjs +40 -0
- package/dist/dist-DUyXJLkq.mjs +2667 -0
- package/dist/dist-Dayj3gCK.mjs +1287 -0
- package/dist/domain-BGofcQ6I.mjs +79 -0
- package/dist/dotenv-DwO4ti0Z.mjs +173 -0
- package/dist/drizzle-NnudE_UN.mjs +232 -0
- package/dist/env-CyG3tvU0.mjs +301 -0
- package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
- package/dist/env-raw-BDL4TvdN.mjs +32 -0
- package/dist/env-types-DknSA4SO.mjs +64 -0
- package/dist/env-validation-DJKjR_8q.mjs +163 -0
- package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
- package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
- package/dist/gen-U0Ktr4Zd.mjs +761 -0
- package/dist/handler-B0ds0OHJ.d.mts +269 -0
- package/dist/head-P-egrtFE.d.mts +45 -0
- package/dist/headers-DCXc7mDs.mjs +279 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +4695 -0
- package/dist/init-C7wS5iGP.mjs +2625 -0
- package/dist/link-p2R6NbgN.mjs +49 -0
- package/dist/list-Bfel-QLc.mjs +113 -0
- package/dist/log-DXdqnmhF.mjs +26 -0
- package/dist/login-CkcXUiIu.mjs +72 -0
- package/dist/logs-DmkrRvx6.mjs +98 -0
- package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
- package/dist/mcp-CaQzfeUi.mjs +373 -0
- package/dist/node-DDfXj10V.mjs +54 -0
- package/dist/output-BwlcIYSR.mjs +139 -0
- package/dist/pages/client.d.mts +198 -0
- package/dist/pages/client.mjs +980 -0
- package/dist/pages/head-client.d.mts +15 -0
- package/dist/pages/head-client.mjs +90 -0
- package/dist/pages/head.d.mts +2 -0
- package/dist/pages/head.mjs +112 -0
- package/dist/pages/index.d.mts +38 -0
- package/dist/pages/index.mjs +76 -0
- package/dist/pages/islands-plugin.d.mts +50 -0
- package/dist/pages/islands-plugin.mjs +195 -0
- package/dist/pages/prefetch.d.mts +31 -0
- package/dist/pages/prefetch.mjs +90 -0
- package/dist/pages/protocol.d.mts +3 -0
- package/dist/pages/protocol.mjs +193 -0
- package/dist/pages/serialize.d.mts +10 -0
- package/dist/pages/serialize.mjs +14 -0
- package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
- package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
- package/dist/prepare-BAtWufvm.mjs +99 -0
- package/dist/preset-D4I73kT4.mjs +221 -0
- package/dist/project-TqORyHn8.mjs +72 -0
- package/dist/project-cmd-B7lQp3F3.mjs +67 -0
- package/dist/project-slug-CKam8lF9.mjs +11 -0
- package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
- package/dist/protocol-BWzXs2A2.d.mts +34 -0
- package/dist/providers-B3aMxWzP.mjs +67 -0
- package/dist/resolve-project-Br5BR03U.mjs +29 -0
- package/dist/rollback-gyC59l7U.mjs +92 -0
- package/dist/route-types-DReF1gUY.mjs +255 -0
- package/dist/routes-stub.d.mts +55 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/runner-6Ep3fNQu.mjs +123 -0
- package/dist/runner-pg-D0wWHYnr.mjs +57 -0
- package/dist/runtime/ai.d.mts +127 -0
- package/dist/runtime/ai.mjs +348 -0
- package/dist/runtime/auth-client-react.d.mts +8 -0
- package/dist/runtime/auth-client-react.mjs +6 -0
- package/dist/runtime/auth-client-solid.d.mts +8 -0
- package/dist/runtime/auth-client-solid.mjs +6 -0
- package/dist/runtime/auth-client-svelte.d.mts +8 -0
- package/dist/runtime/auth-client-svelte.mjs +6 -0
- package/dist/runtime/auth-client-vue.d.mts +8 -0
- package/dist/runtime/auth-client-vue.mjs +6 -0
- package/dist/runtime/auth-client.d.mts +8 -0
- package/dist/runtime/auth-client.mjs +6 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +22 -0
- package/dist/runtime/better-auth-pg.d.mts +11 -0
- package/dist/runtime/better-auth-pg.mjs +51 -0
- package/dist/runtime/better-auth.d.mts +11 -0
- package/dist/runtime/better-auth.mjs +33 -0
- package/dist/runtime/client.d.mts +6 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +30 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/env-helpers.d.mts +2 -0
- package/dist/runtime/env-helpers.mjs +173 -0
- package/dist/runtime/env-public-client.d.mts +22 -0
- package/dist/runtime/env-public-client.mjs +54 -0
- package/dist/runtime/env-public.d.mts +143 -0
- package/dist/runtime/env-public.mjs +366 -0
- package/dist/runtime/env.d.mts +13 -0
- package/dist/runtime/env.mjs +51 -0
- package/dist/runtime/fetch-stream.d.mts +51 -0
- package/dist/runtime/fetch-stream.mjs +81 -0
- package/dist/runtime/fetch.d.mts +59 -0
- package/dist/runtime/fetch.mjs +18 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +85 -0
- package/dist/runtime/isr.d.mts +26 -0
- package/dist/runtime/isr.mjs +43 -0
- package/dist/runtime/kv.d.mts +48 -0
- package/dist/runtime/kv.mjs +106 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +31 -0
- package/dist/runtime/migration-handler-pg.d.mts +6 -0
- package/dist/runtime/migration-handler-pg.mjs +85 -0
- package/dist/runtime/migration-handler.d.mts +19 -0
- package/dist/runtime/migration-handler.mjs +92 -0
- package/dist/runtime/queues.d.mts +7 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +15 -0
- package/dist/runtime/remote/binding-handler.mjs +208 -0
- package/dist/runtime/remote/index.d.mts +8 -0
- package/dist/runtime/remote/index.mjs +461 -0
- package/dist/runtime/response.d.mts +14 -0
- package/dist/runtime/response.mjs +30 -0
- package/dist/runtime/sandbox.d.mts +17 -0
- package/dist/runtime/sandbox.mjs +19 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +30 -0
- package/dist/runtime/seed.mjs +6 -0
- package/dist/runtime/storage.d.mts +7 -0
- package/dist/runtime/storage.mjs +14 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +72 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +296 -0
- package/dist/runtime/ws.d.mts +123 -0
- package/dist/runtime/ws.mjs +103 -0
- package/dist/scan-Ba4hFwlH.mjs +324 -0
- package/dist/scan-C6HMEIdW.mjs +318 -0
- package/dist/secret-CeRSukgM.mjs +109 -0
- package/dist/skills-ipldjlKE.mjs +62 -0
- package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
- package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
- package/dist/sveltekit.d.mts +20 -0
- package/dist/sveltekit.mjs +61 -0
- package/dist/types-mHOEwpW4.d.mts +57 -0
- package/dist/validate-CaMavMxu.mjs +146 -0
- package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
- package/getting-started-prompt.txt +26 -0
- package/package.json +322 -30
- package/schema.json +364 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/SKILL.md +75 -0
- package/skills/void/command/void.md +7 -0
- package/skills/void/docs/guide/ai.md +235 -0
- package/skills/void/docs/guide/app-types.md +103 -0
- package/skills/void/docs/guide/auth.md +257 -0
- package/skills/void/docs/guide/database/d1.md +106 -0
- package/skills/void/docs/guide/database/postgresql.md +106 -0
- package/skills/void/docs/guide/database.md +418 -0
- package/skills/void/docs/guide/deployment.md +98 -0
- package/skills/void/docs/guide/edge/headers.md +79 -0
- package/skills/void/docs/guide/edge/prerendering.md +83 -0
- package/skills/void/docs/guide/edge/redirects.md +116 -0
- package/skills/void/docs/guide/edge/revalidation.md +131 -0
- package/skills/void/docs/guide/edge/rewrites.md +354 -0
- package/skills/void/docs/guide/edge/static-assets.md +72 -0
- package/skills/void/docs/guide/env-vars.md +298 -0
- package/skills/void/docs/guide/index.md +80 -0
- package/skills/void/docs/guide/jobs.md +91 -0
- package/skills/void/docs/guide/kv.md +107 -0
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
- package/skills/void/docs/guide/pages-routing/head.md +130 -0
- package/skills/void/docs/guide/pages-routing/islands.md +405 -0
- package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
- package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
- package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
- package/skills/void/docs/guide/pages-routing/overview.md +236 -0
- package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
- package/skills/void/docs/guide/queues.md +140 -0
- package/skills/void/docs/guide/quickstart.md +233 -0
- package/skills/void/docs/guide/remote-dev.md +67 -0
- package/skills/void/docs/guide/sandboxes.md +82 -0
- package/skills/void/docs/guide/server-routing.md +246 -0
- package/skills/void/docs/guide/ssg.md +74 -0
- package/skills/void/docs/guide/ssr.md +105 -0
- package/skills/void/docs/guide/storage.md +67 -0
- package/skills/void/docs/guide/type-safety.md +179 -0
- package/skills/void/docs/guide/typed-fetch.md +113 -0
- package/skills/void/docs/guide/websockets.md +190 -0
- package/skills/void/docs/index.md +48 -0
- package/skills/void/docs/integrations/agents.md +84 -0
- package/skills/void/docs/integrations/cloudflare.md +284 -0
- package/skills/void/docs/integrations/frameworks/analog.md +182 -0
- package/skills/void/docs/integrations/frameworks/astro.md +197 -0
- package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
- package/skills/void/docs/integrations/frameworks/overview.md +136 -0
- package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
- package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
- package/skills/void/docs/integrations/hono.md +97 -0
- package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
- package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
- package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
- package/skills/void/docs/node_modules/vitepress/README.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
- package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
- package/skills/void/docs/node_modules/void/README.md +89 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
- package/skills/void/docs/reference/api.md +917 -0
- package/skills/void/docs/reference/cli.md +561 -0
- package/skills/void/docs/reference/config.md +408 -0
- package/skills/void/docs/reference/resource-inference.md +149 -0
- package/skills/void/docs/reference/structure.md +176 -0
- package/.npmignore +0 -29
- package/.travis.yml +0 -9
- package/favicon.ico +0 -0
- package/index.js +0 -14
- package/lib/Job.js +0 -150
- package/lib/Void.js +0 -99
- package/lib/scan.js +0 -19
- package/test/credentials.js +0 -20
- package/test/job.js +0 -64
- package/test/static/dir1/test6.html +0 -0
- package/test/static/dir2/test7.html +0 -0
- package/test/static/dir2/test8.html +0 -0
- package/test/static/dir2/test9.html +0 -0
- package/test/static/test1.html +0 -0
- package/test/static/test2.html +0 -0
- package/test/static/test3.html +0 -0
- package/test/void.js +0 -31
- /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
- /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WebSockets
|
|
6
|
+
|
|
7
|
+
::: warning ⚠️ Void Apps Only
|
|
8
|
+
Void-managed WebSockets currently works only for Void apps. Meta-framework mode is not supported yet.
|
|
9
|
+
:::
|
|
10
|
+
|
|
11
|
+
Void supports typed WebSockets from file-based `.ws.ts` routes. Each WebSocket route compiles to a Cloudflare Durable Object, so the feature is currently Cloudflare-only. If you set `target` to `node`, `bun`, or `deno`, builds fail when `.ws.ts` routes are present.
|
|
12
|
+
|
|
13
|
+
Use WebSockets for chat, presence, collaborative rooms, notifications, AI/live-log streaming, and other realtime flows where one connection target maps cleanly to one route instance.
|
|
14
|
+
|
|
15
|
+
## Route files
|
|
16
|
+
|
|
17
|
+
Create WebSocket routes in `routes/` with the `.ws.ts` suffix:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
routes/
|
|
21
|
+
chat/[room].ws.ts
|
|
22
|
+
notifications.ws.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Filename rules match regular server routes:
|
|
26
|
+
|
|
27
|
+
- `index.ws.ts` becomes the parent path
|
|
28
|
+
- `[id].ws.ts` becomes `:id`
|
|
29
|
+
- `[...slug].ws.ts` becomes a catch-all
|
|
30
|
+
- route groups like `(marketing)/chat.ws.ts` are ignored in the URL
|
|
31
|
+
|
|
32
|
+
## `defineRoom()`
|
|
33
|
+
|
|
34
|
+
Use `defineRoom()` when many clients should share one route-scoped room or document.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// routes/chat/[room].ws.ts
|
|
38
|
+
import * as v from 'valibot';
|
|
39
|
+
import { defineRoom } from 'void/ws';
|
|
40
|
+
|
|
41
|
+
const ClientMessage = v.variant('type', [
|
|
42
|
+
v.object({ type: v.literal('chat.message'), text: v.string() }),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const ServerMessage = v.variant('type', [
|
|
46
|
+
v.object({
|
|
47
|
+
type: v.literal('chat.message'),
|
|
48
|
+
id: v.string(),
|
|
49
|
+
text: v.string(),
|
|
50
|
+
userId: v.string(),
|
|
51
|
+
}),
|
|
52
|
+
v.object({ type: v.literal('chat.joined'), userId: v.string() }),
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
export default defineRoom({
|
|
56
|
+
messages: {
|
|
57
|
+
client: ClientMessage,
|
|
58
|
+
server: ServerMessage,
|
|
59
|
+
},
|
|
60
|
+
onBeforeConnect(ctx) {
|
|
61
|
+
if (!ctx.user) {
|
|
62
|
+
return new Response('Unauthorized', { status: 401 });
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
async onConnect(ctx) {
|
|
66
|
+
await ctx.room.broadcast({ type: 'chat.joined', userId: ctx.user!.id }, [ctx.connection.id]);
|
|
67
|
+
},
|
|
68
|
+
async onMessage(ctx, event) {
|
|
69
|
+
await ctx.room.broadcast({
|
|
70
|
+
type: 'chat.message',
|
|
71
|
+
id: crypto.randomUUID(),
|
|
72
|
+
text: event.text,
|
|
73
|
+
userId: ctx.user!.id,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`defineRoom()` adds room helpers to the hook context:
|
|
80
|
+
|
|
81
|
+
- `ctx.room.broadcast(event, excludeIds?)`
|
|
82
|
+
- `ctx.room.getConnections()`
|
|
83
|
+
- `ctx.room.getConnection(id)`
|
|
84
|
+
- `ctx.connection.send(event)`
|
|
85
|
+
- `ctx.connection.close(code?, reason?)`
|
|
86
|
+
- `ctx.connection.setState(data)`
|
|
87
|
+
|
|
88
|
+
## `defineWebSocket()`
|
|
89
|
+
|
|
90
|
+
Use `defineWebSocket()` when each connection is handled independently instead of as a shared room.
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
// routes/notifications.ws.ts
|
|
94
|
+
import * as v from 'valibot';
|
|
95
|
+
import { defineWebSocket } from 'void/ws';
|
|
96
|
+
|
|
97
|
+
export default defineWebSocket({
|
|
98
|
+
messages: {
|
|
99
|
+
client: v.object({ type: v.literal('notifications.ack'), id: v.string() }),
|
|
100
|
+
server: v.object({ type: v.literal('notifications.item'), title: v.string() }),
|
|
101
|
+
},
|
|
102
|
+
onBeforeConnect(ctx) {
|
|
103
|
+
if (!ctx.user) {
|
|
104
|
+
return new Response('Unauthorized', { status: 401 });
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
async onConnect(ctx) {
|
|
108
|
+
await ctx.socket.send({ type: 'notifications.item', title: 'Connected' });
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Typed messages
|
|
114
|
+
|
|
115
|
+
WebSocket messages are schema-backed in both directions:
|
|
116
|
+
|
|
117
|
+
- `messages.client` validates what the browser may send
|
|
118
|
+
- `messages.server` validates what the server may send
|
|
119
|
+
- `onMessage()` receives the parsed, validated client event
|
|
120
|
+
- `ctx.room.broadcast()`, `ctx.connection.send()`, and `ctx.socket.send()` are typed from `messages.server`
|
|
121
|
+
- `connect()` infers route params, outgoing client messages, and incoming server messages from generated route types
|
|
122
|
+
|
|
123
|
+
The default protocol is JSON events. Raw string or binary framing is not the primary API.
|
|
124
|
+
|
|
125
|
+
## Ambient auth
|
|
126
|
+
|
|
127
|
+
WebSocket hooks use the same built-in session resolution as HTTP auth. When Void auth is enabled, `ctx.user` is available in:
|
|
128
|
+
|
|
129
|
+
- `onBeforeConnect`
|
|
130
|
+
- `onConnect`
|
|
131
|
+
- `onMessage`
|
|
132
|
+
- `onClose`
|
|
133
|
+
- `onRequest`
|
|
134
|
+
|
|
135
|
+
This makes cookie-authenticated sockets work without re-parsing the session manually.
|
|
136
|
+
|
|
137
|
+
## Hooks
|
|
138
|
+
|
|
139
|
+
Both `defineRoom()` and `defineWebSocket()` support:
|
|
140
|
+
|
|
141
|
+
- `onBeforeConnect(ctx)`: return a `Response` to reject the upgrade
|
|
142
|
+
- `onConnect(ctx)`: runs after the socket is accepted
|
|
143
|
+
- `onMessage(ctx, event)`: receives the validated client event
|
|
144
|
+
- `onClose(ctx, details)`: receives `{ code, reason, wasClean }`
|
|
145
|
+
- `onRequest(ctx)`: handles ordinary HTTP requests to the same path
|
|
146
|
+
|
|
147
|
+
Every hook receives a context with:
|
|
148
|
+
|
|
149
|
+
- `ctx.id`: deterministic route instance id
|
|
150
|
+
- `ctx.params`: matched route params
|
|
151
|
+
- `ctx.user`: resolved auth user or `null`
|
|
152
|
+
- `ctx.request`
|
|
153
|
+
- `ctx.env`
|
|
154
|
+
- `ctx.storage`
|
|
155
|
+
|
|
156
|
+
If a route does not define `onRequest()`, non-WebSocket requests return `426 Upgrade Required`.
|
|
157
|
+
|
|
158
|
+
## Client
|
|
159
|
+
|
|
160
|
+
Use `connect()` from `void/ws` on the client:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { connect } from 'void/ws';
|
|
164
|
+
|
|
165
|
+
const socket = connect('/chat/:room', {
|
|
166
|
+
params: { room: 'general' },
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
socket.on('message', (event) => {
|
|
170
|
+
if (event.type === 'chat.message') {
|
|
171
|
+
console.log(event.text);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
socket.send({ type: 'chat.message', text: 'hello' });
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`connect()` resolves relative URLs against the current origin and automatically uses `ws:` or `wss:`. It also buffers messages until the socket opens and reconnects by default.
|
|
179
|
+
|
|
180
|
+
## Constraints
|
|
181
|
+
|
|
182
|
+
This first release intentionally focuses on the Durable Object sweet spot:
|
|
183
|
+
|
|
184
|
+
- Cloudflare-only
|
|
185
|
+
- one route-derived connection target per socket
|
|
186
|
+
- no Socket.IO-style dynamic room join/leave API
|
|
187
|
+
- no global pub/sub abstraction
|
|
188
|
+
- JSON event messages only
|
|
189
|
+
|
|
190
|
+
That covers most realtime app shapes Void is targeting without exposing Durable Objects directly.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
theme: dark
|
|
4
|
+
|
|
5
|
+
hero:
|
|
6
|
+
name: Void.
|
|
7
|
+
text: Ship full-stack Vite apps at warp speed
|
|
8
|
+
tagline: Void is a deployment platform designed for Vite - with a powerful backend SDK that makes your Vite apps truly full-stack.
|
|
9
|
+
actions:
|
|
10
|
+
- theme: brand
|
|
11
|
+
text: Get Started
|
|
12
|
+
link: ./guide/
|
|
13
|
+
- theme: alt
|
|
14
|
+
text: View on GitHub
|
|
15
|
+
link: https://github.com/voidzero-dev/void
|
|
16
|
+
image:
|
|
17
|
+
src: /hero.svg
|
|
18
|
+
alt: Void deployment platform
|
|
19
|
+
|
|
20
|
+
features:
|
|
21
|
+
- iconify: lucide:layers
|
|
22
|
+
title: Truly Full-Stack
|
|
23
|
+
details: Database, KV storage, object storage, AI inference, authentication, queues, and cron jobs are built in. Import what you need and ignore the rest.
|
|
24
|
+
- iconify: lucide:wand-sparkles
|
|
25
|
+
title: Your Code is Your Infra
|
|
26
|
+
details: Void scans your source code, detects what you use, and provisions resources automatically. No config files or dashboard clicks, either locally or in the cloud.
|
|
27
|
+
- iconify: lucide:shield-check
|
|
28
|
+
title: End-to-End Type Safety
|
|
29
|
+
details: Types flow from Drizzle schema through route handlers to page component props and the frontend fetch client. One schema validates at runtime and infers types at build time.
|
|
30
|
+
- iconify: lucide:blocks
|
|
31
|
+
title: Any Framework, Any Rendering
|
|
32
|
+
details: React, Vue, Svelte, Solid, plus Vite-based meta-frameworks. Use SSR, SSG, ISR, islands, and markdown where they fit.
|
|
33
|
+
- iconify: lucide:bot
|
|
34
|
+
title: AI-Native
|
|
35
|
+
details: Built-in skills, MCP support, and reference prompts let coding agents scaffold and ship full-stack apps in a single prompt.
|
|
36
|
+
- iconify: lucide:terminal
|
|
37
|
+
title: One Command to Production
|
|
38
|
+
details: '`void deploy` builds your app, runs migrations, provisions resources, and deploys to Cloudflare Workers, without requiring a Cloudflare account or knowledge about the infra.'
|
|
39
|
+
|
|
40
|
+
footer_heading: Build and Deploy at Warp Speed
|
|
41
|
+
footer_subheading: npm install void
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
45
|
+
import Home from './.vitepress/theme/Home.vue'
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<Home />
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Using Void with Coding Agents
|
|
6
|
+
|
|
7
|
+
Void integrates with coding agents via **skills** (agent instructions and reference docs) and an **MCP server** (tool-based documentation access). Both are set up as part of the default `void init` flow. To run only the agent setup step:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx void init --agents
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This detects your coding agent, links skills into its configuration directory, writes MCP config, and injects a Void reference block into your agent instructions file (`CLAUDE.md` or `AGENTS.md`). If auto-detection fails, it asks you to choose from Claude Code, Cursor, Codex, Gemini CLI, or Generic.
|
|
14
|
+
|
|
15
|
+
## Skills
|
|
16
|
+
|
|
17
|
+
Skills give your coding agent structured knowledge about Void, including how to use the CLI, build apps, work with routes, databases, auth, and more. They are symlinked from the `void` package into the agent's skills directory, so they stay version-matched with your installed Void version.
|
|
18
|
+
|
|
19
|
+
Void ships two skills:
|
|
20
|
+
|
|
21
|
+
- **`void`:** main development skill. Routes agent requests to the right documentation for CLI commands, routing, pages, database, auth, deployment, and more.
|
|
22
|
+
- **`migrate-vite-cloudflare-to-void`:** migration skill for converting existing `@cloudflare/vite-plugin` apps to Void.
|
|
23
|
+
|
|
24
|
+
Skills are linked automatically by `void init --agents`. For Claude Code, they are symlinked into `.claude/skills/`. Other agents that support skills will have them linked to their respective directories.
|
|
25
|
+
|
|
26
|
+
## MCP
|
|
27
|
+
|
|
28
|
+
Void ships with a built-in [MCP](https://modelcontextprotocol.io/) server that runs locally over stdio. It provides three tools: `list_pages`, `get_page`, and `search_docs`. Together they give your AI agent full access to the Void documentation, version-matched and usable offline.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npx void mcp
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Automatic Setup
|
|
35
|
+
|
|
36
|
+
MCP config is written automatically by `void init --agents`:
|
|
37
|
+
|
|
38
|
+
- Agents with project-level config support (Claude, Cursor, etc.): writes the config file for you.
|
|
39
|
+
- Agents without project-level config support (Codex, Gemini CLI, etc.): prints the CLI command to register `npx void mcp`.
|
|
40
|
+
- Generic mode: prints MCP JSON you can paste into your agent config.
|
|
41
|
+
|
|
42
|
+
### Manual Setup
|
|
43
|
+
|
|
44
|
+
#### Claude Code
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
claude mcp add void -- npx void mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Codex CLI
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
codex mcp add void -- npx void mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Cursor
|
|
57
|
+
|
|
58
|
+
In `.cursor/mcp.json`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"void": {
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["void", "mcp"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Gemini CLI
|
|
72
|
+
|
|
73
|
+
In `~/.gemini/settings.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"void": {
|
|
79
|
+
"command": "npx",
|
|
80
|
+
"args": ["void", "mcp"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Cloudflare
|
|
6
|
+
|
|
7
|
+
Void runs on Cloudflare Workers. This page covers how bindings work, how the plugin merges your wrangler config, and how to deploy directly to your own Cloudflare account.
|
|
8
|
+
|
|
9
|
+
## Bindings
|
|
10
|
+
|
|
11
|
+
Void automatically infers and provisions Cloudflare bindings (D1, KV, R2, AI, Queues) by scanning your source files. There are two ways to access them at runtime depending on your setup.
|
|
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`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// routes/api/users.ts
|
|
19
|
+
import { defineHandler } from 'void';
|
|
20
|
+
|
|
21
|
+
export const GET = defineHandler(async (c) => {
|
|
22
|
+
const { results } = await c.env.DB.prepare('SELECT * FROM users').all();
|
|
23
|
+
return c.json(results);
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
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
|
+
`c.env` is fully typed via `CloudContext` -- no manual type declarations needed.
|
|
38
|
+
|
|
39
|
+
### Via `cloudflare:workers` import
|
|
40
|
+
|
|
41
|
+
When using framework mode (TanStack Start, React Router, SolidStart), 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
|
+
:::
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { env } from 'cloudflare:workers';
|
|
49
|
+
|
|
50
|
+
const result = await env.DB.prepare('SELECT * FROM users').all();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This also works in server functions:
|
|
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
|
+
```
|
|
71
|
+
|
|
72
|
+
### TypeScript setup
|
|
73
|
+
|
|
74
|
+
Add `"void/env"` to your tsconfig `types` to get typed bindings on `env`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"compilerOptions": {
|
|
79
|
+
"types": ["void/env"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This augments the `Cloudflare.Env` interface with `DB`, `KV`, `STORAGE`, `AI`, and `QUEUE_*` and also pulls in `@cloudflare/workers-types`, so you don't need to add that separately.
|
|
85
|
+
|
|
86
|
+
### Available bindings
|
|
87
|
+
|
|
88
|
+
| Binding | Type | Trigger |
|
|
89
|
+
| --------- | ------------- | --------------------------------------------------------------- |
|
|
90
|
+
| `DB` | `D1Database` | `env.DB` / `c.env.DB` or `import from "void/db"` |
|
|
91
|
+
| `KV` | `KVNamespace` | `env.KV` / `c.env.KV` or `import from "void/kv"` |
|
|
92
|
+
| `STORAGE` | `R2Bucket` | `env.STORAGE` / `c.env.STORAGE` or `import from "void/storage"` |
|
|
93
|
+
| `AI` | `Ai` | `env.AI` / `c.env.AI` or `import from "void/ai"` |
|
|
94
|
+
| `QUEUE_*` | `Queue<T>` | `defineQueue()` or `import from "void/queue"` |
|
|
95
|
+
|
|
96
|
+
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.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"inference": {
|
|
101
|
+
"bindings": { "db": true, "kv": true, "storage": false, "ai": true }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`db`, `kv`, and `storage` accept a string to customize the binding name (e.g. `"db": "MY_DB"`). `ai` only accepts a boolean.
|
|
107
|
+
|
|
108
|
+
See [Configuration](../reference/config.md) for details.
|
|
109
|
+
|
|
110
|
+
### Wrangler passthrough
|
|
111
|
+
|
|
112
|
+
You can set non-binding wrangler fields like `compatibility_date` and `compatibility_flags` in `void.json`:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"worker": {
|
|
117
|
+
"compatibility_date": "2026-02-24",
|
|
118
|
+
"compatibility_flags": ["nodejs_compat"]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For environment variables, use `.env` files instead of `worker.vars`. Void automatically loads `.env` files through Vite's `loadEnv` and merges them into the worker's `vars` bindings:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# .env
|
|
127
|
+
API_URL=https://api.example.com
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Binding arrays such as `d1_databases`, `kv_namespaces`, and `r2_buckets` are not allowed in the `worker` field because Void manages bindings for you. If you need custom bindings with real resource IDs, add a `wrangler.jsonc` to the project root instead. See [Wrangler config merging](#wrangler-config-merging) for details.
|
|
131
|
+
|
|
132
|
+
## Wrangler config merging
|
|
133
|
+
|
|
134
|
+
By default, Void configures the Cloudflare plugin programmatically, so you don't need a `wrangler.jsonc` for bindings. Void pins a Workers compatibility date in `void.json` `worker.compatibility_date`; if no date is already configured in `void.json` or `wrangler.jsonc`/`wrangler.json`, Void writes the latest known-good date to `void.json`. Bindings are inferred from your source code and provisioned with local placeholder IDs for development.
|
|
135
|
+
|
|
136
|
+
If you add a `wrangler.jsonc` (or `wrangler.json`) to your project root, Void respects it -- but **how** depends on whether Void owns the Cloudflare integration or a meta-framework does.
|
|
137
|
+
|
|
138
|
+
### Void-only mode and Vite-based frameworks
|
|
139
|
+
|
|
140
|
+
In Void's default mode and when using frameworks where Void controls the Cloudflare integration (TanStack Start, React Router), Void manages the `@cloudflare/vite-plugin` directly. It passes a `config` callback that merges inferred bindings into whatever the plugin resolves from your `wrangler.jsonc`:
|
|
141
|
+
|
|
142
|
+
1. The plugin reads your `wrangler.jsonc` and resolves it into a config object with `d1_databases`, `kv_namespaces`, `r2_buckets`, etc.
|
|
143
|
+
2. Void checks each inferred binding **by name** (e.g. `"DB"`, `"KV"`, `"STORAGE"`). If a binding with that name already exists in your config, it is left untouched.
|
|
144
|
+
3. Only bindings that are **missing** from your config are added with local placeholder IDs (e.g. `database_id: "local"`).
|
|
145
|
+
4. The merged config is used for both `vite dev` (Miniflare) and `vite build` (output `wrangler.json` in `dist/`).
|
|
146
|
+
|
|
147
|
+
All other fields in your `wrangler.jsonc` -- `name`, `routes`, `services`, `vars`, `env`, `compatibility_date`, etc. -- are preserved in the resolved config and flow through to the build output.
|
|
148
|
+
|
|
149
|
+
Fields that Void always sets (`main`, `triggers`, `assets`) don't need to be in your wrangler config -- they're added programmatically based on your project structure.
|
|
150
|
+
|
|
151
|
+
In this mode, Void does **not** modify your `wrangler.jsonc` file on disk. The merge is purely in-memory.
|
|
152
|
+
|
|
153
|
+
### Adapter-based frameworks (SvelteKit, Nuxt, Astro)
|
|
154
|
+
|
|
155
|
+
When using SvelteKit, Nuxt, or Astro, the framework's own Cloudflare adapter owns the worker build and dev server. Void does **not** provide `@cloudflare/vite-plugin` in that setup. It only contributes DB type codegen, migration management, and binding sync.
|
|
156
|
+
|
|
157
|
+
Because Void doesn't control the CF plugin in this mode, it can't merge bindings via a config callback. Instead, on dev startup Void syncs inferred bindings directly to your `wrangler.jsonc` file on disk:
|
|
158
|
+
|
|
159
|
+
- Only adds bindings that are **missing** by name -- existing bindings are never modified or removed.
|
|
160
|
+
- If `worker.compatibility_date` is set in `void.json`, syncs that date into wrangler config so the framework adapter reads the same value.
|
|
161
|
+
- Also ensures the `nodejs_als` compatibility flag is present.
|
|
162
|
+
- The framework adapter then reads this `wrangler.jsonc` normally.
|
|
163
|
+
|
|
164
|
+
This means your `wrangler.jsonc` is the single source of truth for bindings in this mode. Void keeps it up to date as you add new resource imports to your code, but you're responsible for replacing placeholder IDs with real ones before deploying.
|
|
165
|
+
|
|
166
|
+
### Merge precedence
|
|
167
|
+
|
|
168
|
+
| Source | Priority | What it controls |
|
|
169
|
+
| -------------------------- | -------------------- | ------------------------------------------------------------------- |
|
|
170
|
+
| Your `wrangler.jsonc` | Highest for bindings | Real resource IDs, service bindings, routes, vars, environments |
|
|
171
|
+
| `void.json` `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.json`, project wrangler config, or the supported generated build wrangler fallback during deploy, Void pins the latest known-good date to `void.json` and uses it for that run.
|
|
175
|
+
|
|
176
|
+
### Example
|
|
177
|
+
|
|
178
|
+
If your code uses `c.env.DB` and `c.env.KV`, and your `wrangler.jsonc` only defines D1:
|
|
179
|
+
|
|
180
|
+
```jsonc
|
|
181
|
+
{
|
|
182
|
+
"name": "my-app",
|
|
183
|
+
"d1_databases": [
|
|
184
|
+
{
|
|
185
|
+
"binding": "DB",
|
|
186
|
+
"database_name": "my-app-db",
|
|
187
|
+
"database_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
// Service bindings, routes, etc. are also preserved
|
|
191
|
+
"services": [{ "binding": "API", "service": "my-api-worker" }],
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
This means `pnpm dev` works out of the box (Miniflare creates local instances of all bindings), while `wrangler deploy` uses your real D1 database ID and service bindings.
|
|
198
|
+
|
|
199
|
+
### What ends up in the build output
|
|
200
|
+
|
|
201
|
+
After `vite build`, the Cloudflare Vite plugin writes a merged `wrangler.json` to the `dist/` directory. This file contains:
|
|
202
|
+
|
|
203
|
+
- All fields from your `wrangler.jsonc` (bindings with real IDs, routes, services, vars, environments)
|
|
204
|
+
- Any inferred bindings Void added (with placeholder IDs -- replace these before deploying)
|
|
205
|
+
- Fields set by Void (`main`, `assets`, `triggers`)
|
|
206
|
+
|
|
207
|
+
When you run `wrangler deploy`, it picks up this generated `wrangler.json` and deploys everything.
|
|
208
|
+
|
|
209
|
+
::: tip
|
|
210
|
+
When deploying via `void deploy` (to the Void platform), the `wrangler.json` in the build output is **skipped** -- the platform manages worker configuration via its own deploy manifest. The merge behavior described here only applies to direct `wrangler deploy`.
|
|
211
|
+
:::
|
|
212
|
+
|
|
213
|
+
## Deploy to your own Cloudflare account
|
|
214
|
+
|
|
215
|
+
Void's default deployment path is `void deploy`, which uploads to the Void platform. But the generated worker is a standard Cloudflare Worker -- you can deploy it directly to your own account with `wrangler deploy`.
|
|
216
|
+
|
|
217
|
+
### 1. Create your resources
|
|
218
|
+
|
|
219
|
+
Create whatever bindings your app uses:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# D1 database
|
|
223
|
+
wrangler d1 create my-app-db
|
|
224
|
+
|
|
225
|
+
# KV namespace
|
|
226
|
+
wrangler kv namespace create KV
|
|
227
|
+
|
|
228
|
+
# R2 bucket
|
|
229
|
+
wrangler r2 bucket create my-app-storage
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 2. Add a `wrangler.jsonc`
|
|
233
|
+
|
|
234
|
+
Create `wrangler.jsonc` in your project root with the resource IDs from step 1:
|
|
235
|
+
|
|
236
|
+
```jsonc
|
|
237
|
+
{
|
|
238
|
+
"name": "my-app",
|
|
239
|
+
"compatibility_date": "2026-02-24",
|
|
240
|
+
"d1_databases": [
|
|
241
|
+
{
|
|
242
|
+
"binding": "DB",
|
|
243
|
+
"database_name": "my-app-db",
|
|
244
|
+
"database_id": "<your-database-id>",
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
"kv_namespaces": [
|
|
248
|
+
{
|
|
249
|
+
"binding": "KV",
|
|
250
|
+
"id": "<your-namespace-id>",
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
"r2_buckets": [
|
|
254
|
+
{
|
|
255
|
+
"binding": "STORAGE",
|
|
256
|
+
"bucket_name": "my-app-storage",
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Only include the bindings your app actually uses. You can also add service bindings, custom routes, environment overrides, and any other standard wrangler fields -- they all flow through to the build output. You don't need `main` or `assets` -- those are set by the plugin.
|
|
263
|
+
|
|
264
|
+
### 3. Run migrations
|
|
265
|
+
|
|
266
|
+
If your app uses D1, apply migrations before deploying:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
wrangler d1 migrations apply DB --remote
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
This uses the same `db/migrations/` directory that Void uses locally.
|
|
273
|
+
|
|
274
|
+
### 4. Build and deploy
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
vite build && wrangler deploy
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
That's it. The Cloudflare Vite plugin produces a complete build output with a merged `wrangler.json` in the dist directory (containing your real resource IDs and any inferred bindings), and `wrangler deploy` picks it up.
|
|
281
|
+
|
|
282
|
+
### Local development
|
|
283
|
+
|
|
284
|
+
`pnpm dev` continues to work as before -- Miniflare creates local instances of all bindings regardless of the IDs in your `wrangler.jsonc`. Your real resource IDs are only used when you run `wrangler deploy`.
|