void 1.8.0 → 1.9.1

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.
Files changed (222) hide show
  1. package/dist/{account-cmd-CZKntRH2.mjs → account-cmd-BEMOdwtl.mjs} +3 -3
  2. package/dist/{application-analysis-CyTagJQM.mjs → application-analysis-3VVsflWZ.mjs} +5 -5
  3. package/dist/{application-routing-BLrMVpqi.mjs → application-routing-CJRlXCc2.mjs} +1 -1
  4. package/dist/{auth-Bk9VGtQW.d.mts → auth-CV9kXHKe.d.mts} +3 -1
  5. package/dist/{auth-DyWp-fSo.mjs → auth-aMuFOZeI.mjs} +8 -2
  6. package/dist/{auth-link-BOaQWMKw.mjs → auth-link-B1IynRW5.mjs} +3 -3
  7. package/dist/{auth-router-D0-VcmDs.mjs → auth-router-DVaWJdRB.mjs} +2 -2
  8. package/dist/{better-auth-shared-CdVyCUou.mjs → better-auth-shared-C7LHvF4L.mjs} +1 -1
  9. package/dist/{better-auth-shared-CQFdtguU.d.mts → better-auth-shared-ajs3LNrY.d.mts} +1 -1
  10. package/dist/{build-cmd-JTsXXf2F.mjs → build-cmd-Dq8tdqQG.mjs} +1 -1
  11. package/dist/{cache-D0m3Z_Xf.mjs → cache-DGMnskX7.mjs} +1 -1
  12. package/dist/{cancel-deploy-Ce6Os4fa.mjs → cancel-deploy-96S5hD1E.mjs} +1 -1
  13. package/dist/cli/cli.mjs +1 -1
  14. package/dist/cli/env-schema-probe.mjs +3 -3
  15. package/dist/{cli-main-rkrJy2Ge.mjs → cli-main-CQRLxZAu.mjs} +28 -28
  16. package/dist/client-66c0RLDM.mjs +1 -0
  17. package/dist/{client-SZPyj4X_.mjs → client-D6w5x7hM.mjs} +7 -7
  18. package/dist/{cloudflare-auth-7jTqy9Bx.mjs → cloudflare-auth-pNvmT6kL.mjs} +1 -1
  19. package/dist/{cloudflare-cmd-ChPLQcTP.mjs → cloudflare-cmd-BuuHUM4z.mjs} +3 -3
  20. package/dist/{cloudflare-config-DtOGAbeB.mjs → cloudflare-config-PxbinLLE.mjs} +2 -2
  21. package/dist/{cloudflare-connect-Co93VYTo.mjs → cloudflare-connect-D1QOosLd.mjs} +2 -2
  22. package/dist/{cloudflare-operations-CXaDKYj2.mjs → cloudflare-operations-G5AObYzF.mjs} +5 -5
  23. package/dist/{cloudflare-operations-DATekLwI.mjs → cloudflare-operations-I4t3mt4R.mjs} +1 -1
  24. package/dist/{cloudflare-process-DmTxZR-N.mjs → cloudflare-process-wcnaQ5JG.mjs} +2 -2
  25. package/dist/{config-wo2EaH0X.mjs → config-C1DPf8EK.mjs} +1 -1
  26. package/dist/{config-CTlUaXWZ.d.mts → config-CCWVY7DY.d.mts} +1 -1
  27. package/dist/{config-5oSQhZNj.mjs → config-CzFdJYNA.mjs} +1 -1
  28. package/dist/{config-DcqUBGCb.mjs → config-DlWQ_hIJ.mjs} +3 -3
  29. package/dist/{config-eeDzKBS9.mjs → config-Do7gJI3T.mjs} +2 -2
  30. package/dist/config-entry.d.mts +1 -1
  31. package/dist/{connect-DlvXt1JR.mjs → connect-4uImOwut.mjs} +4 -4
  32. package/dist/{create-project-CC_7hmYJ.mjs → create-project-BaUzZnLZ.mjs} +1 -1
  33. package/dist/{create-project-DzY05xqC.mjs → create-project-CQMyzTvK.mjs} +1 -1
  34. package/dist/{db-FhyYGcJJ.mjs → db-DEpDeDsi.mjs} +19 -19
  35. package/dist/{db-types-sVwEpyPR.mjs → db-types-BpPYAx0B.mjs} +1 -1
  36. package/dist/{delete-CModjyOC.mjs → delete-BVD2kI82.mjs} +1 -1
  37. package/dist/deploy-Dr_Qamzw.mjs +2 -0
  38. package/dist/{deploy-Cz9TEzZy.mjs → deploy-Dyeo5soA.mjs} +24 -75
  39. package/dist/{deploy-managed-static-DlxxXkAM.mjs → deploy-managed-static-Kn73R83A.mjs} +20 -20
  40. package/dist/{deploy-transport-DUvm6-CR.mjs → deploy-transport-BpKBs_KR.mjs} +2 -2
  41. package/dist/deploy.mjs +6 -6
  42. package/dist/discover-Diq0l6TZ.mjs +1 -0
  43. package/dist/{discover-CVFCWU7W.mjs → discover-Vd18lHsj.mjs} +1 -1
  44. package/dist/{dispatch-CCiaAnSK.mjs → dispatch-BBfb519j.mjs} +5 -5
  45. package/dist/{domain-DvdZPA50.mjs → domain-BTIdyUVk.mjs} +2 -2
  46. package/dist/{email-ASpNrfLd.mjs → email-DvrS-I0U.mjs} +7 -7
  47. package/dist/{email-cloudflare-kqoN9jst.mjs → email-cloudflare-DAGpgzY1.mjs} +3 -3
  48. package/dist/{entry-BweGTCgj.mjs → entry-DMgR7XOf.mjs} +1 -1
  49. package/dist/{env-Bpkg3G5i.mjs → env-D7vORwpn.mjs} +4 -4
  50. package/dist/{env-types-Dz9qkiOn.mjs → env-types-WEZw5D-r.mjs} +1 -1
  51. package/dist/{env-validation-CN386Utu.mjs → env-validation-DKDcpxbt.mjs} +1 -1
  52. package/dist/{env-validation-BpCCQE_6.mjs → env-validation-DeYNRp1d.mjs} +3 -3
  53. package/dist/{gen-upKJChvd.mjs → gen-DimkGNve.mjs} +4 -4
  54. package/dist/gen-DmEeVEs4.mjs +1 -0
  55. package/dist/{github-cmd-BvMOlb8Z.mjs → github-cmd-D-zs6VQr.mjs} +1 -1
  56. package/dist/{handler-BO7Od-z9.d.mts → handler-6fzr_ikp.d.mts} +3 -3
  57. package/dist/{head-5XPcnG-j.mjs → head-0o0QoREY.mjs} +63 -4
  58. package/dist/{head-MeF_5M_3.d.mts → head-CVO92KEx.d.mts} +14 -3
  59. package/dist/{headers-COGEDoMN.mjs → headers-Q0kZDpk8.mjs} +1 -1
  60. package/dist/{help-TPCjTu6e.mjs → help-Cgdcd-SG.mjs} +4 -4
  61. package/dist/help-Cp3K5m1w.mjs +1 -0
  62. package/dist/index.d.mts +4 -4
  63. package/dist/index.mjs +29 -24
  64. package/dist/{info-EsDyihwf.mjs → info-BbxQ34kk.mjs} +4 -4
  65. package/dist/{init-a4lVagrb.mjs → init-zyRj3QRw.mjs} +14 -14
  66. package/dist/{link-CE55DDzS.mjs → link-DAFXuIER.mjs} +2 -2
  67. package/dist/{list-CxRthQks.mjs → list-BTIcC3W9.mjs} +2 -2
  68. package/dist/{live-Kc55iuOQ.d.mts → live-DBybyDt0.d.mts} +2 -2
  69. package/dist/{live-CYJ4KGoR.mjs → live-Dw7NF1t2.mjs} +1 -1
  70. package/dist/load-user-env-ztmIyiLx.mjs +34 -0
  71. package/dist/{local-d1-CFcH9Bx3.mjs → local-d1-BnVb7Fem.mjs} +1 -1
  72. package/dist/login-DBs8JuSl.mjs +1 -0
  73. package/dist/{login-AfcSGSmE.mjs → login-DOE-MkeK.mjs} +2 -2
  74. package/dist/{logs-BgRJuvb1.mjs → logs-CUsjihc3.mjs} +2 -2
  75. package/dist/migrate-BYhoIK9R.mjs +1 -0
  76. package/dist/{migrate-BNAh6m_C.mjs → migrate-DtoKdGas.mjs} +4 -4
  77. package/dist/nitro.mjs +3 -3
  78. package/dist/{node-CXFUw0Uz.mjs → node-D9dPyUr0.mjs} +2 -2
  79. package/dist/operator-ai-logging-DFTEp81Z.mjs +121 -0
  80. package/dist/{operator-args-DGTuCdSE.mjs → operator-args-BCCohcz3.mjs} +3 -2
  81. package/dist/{operator-cmd-C-viB7Si.mjs → operator-cmd-CQOQrUiO.mjs} +26 -6
  82. package/dist/operator-cmd-xCACDtT1.mjs +1 -0
  83. package/dist/pages/client.d.mts +1 -1
  84. package/dist/pages/client.mjs +15 -13
  85. package/dist/pages/head.d.mts +2 -2
  86. package/dist/pages/head.mjs +1 -1
  87. package/dist/pages/index.d.mts +2 -2
  88. package/dist/pages/index.mjs +5 -5
  89. package/dist/pages/islands-plugin.d.mts +5 -1
  90. package/dist/pages/islands-plugin.mjs +6 -2
  91. package/dist/pages/protocol.d.mts +2 -2
  92. package/dist/pages/protocol.mjs +1 -1
  93. package/dist/platform-args-DSi4_M8n.mjs +1 -0
  94. package/dist/{platform-args-CiYeZmc5.mjs → platform-args-DtpHS_75.mjs} +1 -1
  95. package/dist/{platform-auth-config-Dt2qEc2w.mjs → platform-auth-config-fLwIS5VG.mjs} +3 -3
  96. package/dist/{platform-auth-protection-B7TaF-PZ.mjs → platform-auth-protection-BTRI_YwD.mjs} +2 -2
  97. package/dist/{platform-auth-recovery-suXSteJ6.mjs → platform-auth-recovery-DPK2Mvmo.mjs} +2 -2
  98. package/dist/{platform-cmd-DuAsIxbU.mjs → platform-cmd-BLy5uCa-.mjs} +1 -1
  99. package/dist/{platform-cmd-9rvYBBtr.mjs → platform-cmd-HS_FSthn.mjs} +5 -5
  100. package/dist/{platform-domain-DhH_vDr6.mjs → platform-domain-CHpcq_qg.mjs} +2 -2
  101. package/dist/{platform-lifecycle-3uI-E2bF.mjs → platform-lifecycle-B6LUBwjS.mjs} +1 -1
  102. package/dist/{platform-lifecycle-CXmXe2xt.mjs → platform-lifecycle-D2RS7DE0.mjs} +236 -26
  103. package/dist/{platform-management-PdrgDQTe.mjs → platform-management-C-T0ch4y.mjs} +1 -1
  104. package/dist/{platform-management-BBCHfwji.mjs → platform-management-d3ETv3Dw.mjs} +14 -14
  105. package/dist/{platform-plans-config-BGwkXYDM.mjs → platform-plans-config-B7yJQKf7.mjs} +114 -30
  106. package/dist/{platform-recovery-C8NxXGRR.mjs → platform-recovery-DS5CAsly.mjs} +2 -2
  107. package/dist/{plugin-inference-CErfTgEx.mjs → plugin-inference-DZHmVe1f.mjs} +3 -3
  108. package/dist/{prepare-BDKWZgfL.mjs → prepare-AVM4Hj3T.mjs} +8 -8
  109. package/dist/prepare-BSXKz6m8.mjs +1 -0
  110. package/dist/{prepare-BLrzXjIl.mjs → prepare-DMk8NAO-.mjs} +1 -1
  111. package/dist/{project-cmd-DzGvxXKH.mjs → project-cmd-TQKAOTMV.mjs} +15 -15
  112. package/dist/{project-paths-G0yut6Zz.mjs → project-paths-CUhCPMpK.mjs} +33 -2
  113. package/dist/{project-team-C5XtHbZk.mjs → project-team-B1OKeb-T.mjs} +1 -1
  114. package/dist/{project-token-B4D5yhHQ.mjs → project-token-RW_wpmN-.mjs} +1 -1
  115. package/dist/{project-tsconfig-nhnTWO_Y.mjs → project-tsconfig-MyRJgufB.mjs} +1 -1
  116. package/dist/{project-zero-trust--0LvktDg.mjs → project-zero-trust-TNc66p0_.mjs} +1 -1
  117. package/dist/{protocol-Cg2I81NA.d.mts → protocol-YS3tbxWE.d.mts} +2 -2
  118. package/dist/{protocol-B1Tvc9-x.mjs → protocol-a3ZUQq5W.mjs} +56 -20
  119. package/dist/{provision-CAcrauvr.mjs → provision-BLdkpFT4.mjs} +1 -1
  120. package/dist/{provision-C3yiHdld.mjs → provision-bgQTi5QZ.mjs} +2 -2
  121. package/dist/redirect-Dqb4fEc5.mjs +80 -0
  122. package/dist/{requests-CrRiTgQA.mjs → requests-Cj15-yrI.mjs} +1 -1
  123. package/dist/{rollback-BsmQyj-Q.mjs → rollback-CYnkng7B.mjs} +2 -2
  124. package/dist/{route-types-CgtlFCDz.mjs → route-types-C6eAOmOj.mjs} +1 -1
  125. package/dist/runtime/auth.d.mts +1 -1
  126. package/dist/runtime/auth.mjs +1 -1
  127. package/dist/runtime/better-auth-mysql.d.mts +1 -1
  128. package/dist/runtime/better-auth-mysql.mjs +1 -1
  129. package/dist/runtime/better-auth-pg.d.mts +1 -1
  130. package/dist/runtime/better-auth-pg.mjs +1 -1
  131. package/dist/runtime/better-auth.d.mts +1 -1
  132. package/dist/runtime/better-auth.mjs +1 -1
  133. package/dist/runtime/client-react.d.mts +1 -1
  134. package/dist/runtime/client-solid.d.mts +1 -1
  135. package/dist/runtime/client-svelte.d.mts +1 -1
  136. package/dist/runtime/client-vue.d.mts +1 -1
  137. package/dist/runtime/client.d.mts +1 -1
  138. package/dist/runtime/handler.d.mts +1 -1
  139. package/dist/runtime/live-client.d.mts +1 -1
  140. package/dist/runtime/live-server.mjs +1 -1
  141. package/dist/runtime/live.d.mts +1 -1
  142. package/dist/runtime/live.mjs +1 -1
  143. package/dist/runtime/routing.d.mts +2 -2
  144. package/dist/runtime/routing.mjs +6 -5
  145. package/dist/runtime/validator.d.mts +1 -1
  146. package/dist/runtime/ws-server.d.mts +3 -3
  147. package/dist/runtime/ws-server.mjs +1 -1
  148. package/dist/runtime/ws.d.mts +1 -1
  149. package/dist/{scan-BJ3bj6aP.mjs → scan-4YOxDaw2.mjs} +2 -2
  150. package/dist/{secret-D0g5oBsP.mjs → secret-BSf7dgg_.mjs} +3 -3
  151. package/dist/{action-key-ByZ6DDld.mjs → url-DaehRGKR.mjs} +43 -1
  152. package/dist/{version-metadata-eUd6Ar_U.mjs → version-metadata-CeftH0fQ.mjs} +1 -1
  153. package/dist/{wrangler-k40T7XTQ.mjs → wrangler-B1gkT_wC.mjs} +3 -3
  154. package/dist/wrangler-fNGvPTlO.mjs +1 -0
  155. package/dist/{wrapper-CVMZarxf.mjs → wrapper-xJ4LP5A7.mjs} +3 -3
  156. package/dist/{ws--U7QicYy.d.mts → ws-C2zy0QBf.d.mts} +2 -2
  157. package/docs/guide/ai.md +1 -1
  158. package/docs/guide/app-types.md +1 -1
  159. package/docs/guide/auth.md +24 -27
  160. package/docs/guide/database/d1.md +4 -2
  161. package/docs/guide/database.md +29 -27
  162. package/docs/guide/deployment.md +2 -2
  163. package/docs/guide/edge/headers.md +3 -3
  164. package/docs/guide/edge/prerendering.md +5 -5
  165. package/docs/guide/edge/redirects.md +1 -1
  166. package/docs/guide/edge/revalidation.md +4 -2
  167. package/docs/guide/edge/rewrites.md +1 -1
  168. package/docs/guide/edge/static-assets.md +4 -0
  169. package/docs/guide/email/sending.md +4 -2
  170. package/docs/guide/live.md +1 -1
  171. package/docs/guide/pages-routing/actions-and-forms.md +25 -7
  172. package/docs/guide/pages-routing/errors.md +17 -9
  173. package/docs/guide/pages-routing/head.md +44 -1
  174. package/docs/guide/pages-routing/islands.md +3 -1
  175. package/docs/guide/pages-routing/layouts.md +2 -2
  176. package/docs/guide/pages-routing/loaders.md +3 -1
  177. package/docs/guide/pages-routing/markdown.md +5 -3
  178. package/docs/guide/pages-routing/overview.md +14 -21
  179. package/docs/guide/platform/administration/connected-apps.md +10 -3
  180. package/docs/guide/platform/administration/email.md +1 -1
  181. package/docs/guide/platform/administration/plans.md +34 -1
  182. package/docs/guide/platform/administration/projects.md +6 -2
  183. package/docs/guide/platform/installation/credentials.md +12 -10
  184. package/docs/guide/platform/installation/maintenance.md +7 -1
  185. package/docs/guide/platform/installation/setup.md +8 -7
  186. package/docs/guide/queues.md +1 -1
  187. package/docs/guide/server-routing.md +2 -2
  188. package/docs/guide/sse.md +1 -1
  189. package/docs/guide/ssg.md +17 -6
  190. package/docs/guide/storage.md +1 -1
  191. package/docs/guide/testing.md +9 -7
  192. package/docs/guide/type-safety.md +23 -21
  193. package/docs/integrations/cloudflare.md +6 -2
  194. package/docs/integrations/frameworks/nuxt.md +1 -1
  195. package/docs/integrations/hono.md +21 -0
  196. package/docs/integrations/nodejs-bun-deno.md +4 -4
  197. package/docs/reference/api/auth.md +22 -4
  198. package/docs/reference/api/database.md +2 -2
  199. package/docs/reference/api/pages.md +17 -13
  200. package/docs/reference/api/resources.md +1 -1
  201. package/docs/reference/api/rewrites.md +8 -4
  202. package/docs/reference/api.md +1 -1
  203. package/docs/reference/cli/deploy.md +4 -2
  204. package/docs/reference/cli/platform-config.md +3 -3
  205. package/docs/reference/cli/platform-users.md +58 -11
  206. package/docs/reference/cli.md +1 -1
  207. package/docs/reference/config.md +7 -3
  208. package/package.json +7 -7
  209. package/skills/void/SKILL.md +1 -1
  210. package/dist/client-D1Vz1Zep.mjs +0 -1
  211. package/dist/deploy-DMieisRu.mjs +0 -2
  212. package/dist/discover-1DJD4YXD.mjs +0 -1
  213. package/dist/gen-M5fNQKfH.mjs +0 -1
  214. package/dist/help-CItQVDL4.mjs +0 -1
  215. package/dist/load-user-env-CSwdofj0.mjs +0 -48
  216. package/dist/login-ZHsAm-I6.mjs +0 -1
  217. package/dist/migrate-BflbbZQK.mjs +0 -1
  218. package/dist/operator-cmd-D6qNuJ_z.mjs +0 -1
  219. package/dist/platform-args-DJvF1-kl.mjs +0 -1
  220. package/dist/prepare-a1_5usAn.mjs +0 -1
  221. package/dist/url-CuoEn0o3.mjs +0 -43
  222. package/dist/wrangler-R3kMdJfw.mjs +0 -1
@@ -1,7 +1,7 @@
1
1
  import { a as join, l as toSlash, n as dirname, r as extname } from "./dist-DMYe8CZJ.mjs";
2
- import { l as getDatabaseDialect, p as readConfig } from "./config-5oSQhZNj.mjs";
3
- import { c as voidDbBundlerPlugin, r as cloudflareQueueName, t as generateQueueResolverSource } from "./dispatch-CCiaAnSK.mjs";
4
- import { n as readProjectPaths } from "./project-paths-G0yut6Zz.mjs";
2
+ import { l as getDatabaseDialect, p as readConfig } from "./config-CzFdJYNA.mjs";
3
+ import { c as voidDbBundlerPlugin, r as cloudflareQueueName, t as generateQueueResolverSource } from "./dispatch-BBfb519j.mjs";
4
+ import { n as readProjectPaths } from "./project-paths-CUhCPMpK.mjs";
5
5
  import { t as WORKER_CONDITIONS } from "./worker-conditions-CBZ0RYsZ.mjs";
6
6
  import { t as MagicString } from "./dist-B6eN80gc.mjs";
7
7
  import { n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
@@ -1,6 +1,6 @@
1
1
  import { t as StandardSchemaV1 } from "./standard-schema-CuDawHOC.mjs";
2
- import { i as AuthUser } from "./auth-Bk9VGtQW.mjs";
3
- import { a as CloudEnv } from "./handler-BO7Od-z9.mjs";
2
+ import { i as AuthUser } from "./auth-CV9kXHKe.mjs";
3
+ import { a as CloudEnv } from "./handler-6fzr_ikp.mjs";
4
4
  import { WebSocketRouteMap } from "void/routes";
5
5
  type MaybePromise<T> = T | Promise<T>;
6
6
  type ParamsRecord = Record<string, string>;
package/docs/guide/ai.md CHANGED
@@ -142,7 +142,7 @@ const result = await ai.run('google/gemini-2.5-flash', {
142
142
  });
143
143
  ```
144
144
 
145
- Pass AI Gateway options as the third argument: `ai.run(model, inputs, { gateway: { skipCache: true } })`. On a team platform, the platform chooses the gateway and sets its metadata and logging; options such as `skipCache` and `cacheTtl` still apply.
145
+ Pass AI Gateway options as the third argument: `ai.run(model, inputs, { gateway: { skipCache: true } })`. On a team platform, the platform chooses the gateway and sets its metadata and logging; options such as `skipCache` and `cacheTtl` still apply. The platform's logging setting also covers `void dev` in a linked project; an unlinked project uses your own Cloudflare account and its gateway settings.
146
146
 
147
147
  For provider-native requests on a direct deployment, configure [`ai.gateway`](../integrations/cloudflare.md#ai-self-host).
148
148
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'Build a Void app, keep a meta framework, or deploy a static site. Void provisions resources and deploys each of them.'
2
+ description: 'Build a Void app, use your existing Vite framework, or deploy a static site. Void manages resources and deployment for each.'
3
3
  outline: deep
4
4
  ---
5
5
 
@@ -38,9 +38,9 @@ await auth.signIn.email({
38
38
  });
39
39
  ```
40
40
 
41
- ### 3. Protect a server route
41
+ ### 3. Protect a server route {#protect-a-server-route}
42
42
 
43
- Call `requireAuth` in a route handler or page loader that needs a signed-in user. It returns that user, or throws `401` if the request isn't authenticated:
43
+ Call `requireAuth` in a route handler or action to get the signed-in user or reject unauthenticated requests with `401`:
44
44
 
45
45
  ```ts
46
46
  // routes/api/profile.ts
@@ -53,21 +53,29 @@ export const GET = defineHandler((c) => {
53
53
  });
54
54
  ```
55
55
 
56
- In a pages-mode loader, use `getUser` or `getSession` when you want to allow unauthenticated access:
56
+ In a page loader, pass `throwRedirect` to send unauthenticated visitors to your login page instead of a plain-text `401`:
57
57
 
58
58
  ```ts
59
59
  // pages/dashboard.server.ts
60
60
  import { defineHandler, type InferProps } from 'void';
61
- import { getUser } from 'void/auth';
61
+ import { requireAuth } from 'void/auth';
62
62
 
63
63
  export type Props = InferProps<typeof loader>;
64
64
 
65
- export const loader = defineHandler(() => {
66
- const user = getUser();
65
+ export const loader = defineHandler((c) => {
66
+ const user = requireAuth(c, {
67
+ throwRedirect: '/login',
68
+ });
67
69
  return { user };
68
70
  });
69
71
  ```
70
72
 
73
+ The same option works in actions and middleware. It throws a redirect, stopping execution: `302` for GET/HEAD requests and `303` for other methods. Document requests follow the redirect normally; Pages client navigation follows it without reloading the document.
74
+
75
+ Signing in does not replay a rejected action.
76
+
77
+ To allow unauthenticated access, use `getUser()` and return the nullable user. For custom guards, you can also [throw a redirect](../integrations/hono.md#redirects) from a helper.
78
+
71
79
  ### 4. Sign out
72
80
 
73
81
  ```tsx
@@ -119,25 +127,16 @@ import { getSession, getUser, requireAuth } from 'void/auth';
119
127
  - `getUser()` returns the current `AuthUser | null`
120
128
  - `getSession()` returns `{ user, session } | null`
121
129
  - `requireAuth(c)` returns the authenticated user or throws `401`
130
+ - `requireAuth(c, { throwRedirect: '/login' })` returns the user or throws a login redirect
122
131
  - [`getAuth(c)`](../reference/api/auth.md#getauth-c) returns the request's Better Auth instance, with plugin APIs inferred from `auth.ts`, for use with Better Auth helpers.
123
132
 
124
133
  Import `AuthUser` and `AuthSession` from `void/auth` for type annotations. They include the fields your Better Auth plugins and `user.additionalFields` add, such as `role` from `admin()`. See their fields in the [API reference](../reference/api/auth.md#authuser).
125
134
 
126
135
  ## Querying Authentication Tables
127
136
 
128
- When authentication is enabled, Void generates the Better Auth Drizzle schema in `.void/better-auth-schema.ts`.
129
- The generated file exports the core authentication tables:
130
-
131
- - `userTable`
132
- - `sessionTable`
133
- - `accountTable`
134
- - `verificationTable`
137
+ To query users or reference them from your own tables, import Void's generated authentication schema. It exports `userTable`, `sessionTable`, `accountTable`, `verificationTable`, and any tables added by your Better Auth plugins.
135
138
 
136
- Configured Better Auth plugins may also contribute additional tables.
137
-
138
- The generated file path and core table export names are documented integration points. You can import these exports directly rather than recreating the tables in your application.
139
-
140
- To import these tables into your application, add a TypeScript path alias to your root `tsconfig.json`:
139
+ Add an alias to your root `tsconfig.json`:
141
140
 
142
141
  ```json
143
142
  {
@@ -149,11 +148,9 @@ To import these tables into your application, add a TypeScript path alias to you
149
148
  }
150
149
  ```
151
150
 
152
- If your `tsconfig.json` already has a `paths` mapping, add `@auth-schema` to the existing mapping rather than replacing it.
153
-
154
- If your project extends `.void/tsconfig.json` and defines its own `paths`, make sure to retain any mappings from the generated configuration that your project uses, such as `@schema`.
151
+ Keep your other path aliases, including any you use from `.void/tsconfig.json`, such as `@schema`.
155
152
 
156
- You can now import and query authentication tables:
153
+ You can now query users with Drizzle:
157
154
 
158
155
  ```ts
159
156
  import { userTable } from '@auth-schema';
@@ -164,7 +161,7 @@ export function listUsers() {
164
161
  }
165
162
  ```
166
163
 
167
- You can also reference authentication tables when defining your own Drizzle tables:
164
+ To associate a post with its author, reference `userTable.id`:
168
165
 
169
166
  ```ts
170
167
  import { userTable } from '@auth-schema';
@@ -178,11 +175,9 @@ export const postTable = sqliteTable('post', {
178
175
  });
179
176
  ```
180
177
 
181
- This example assumes the default text ID strategy. If you configure `advanced.database.generateId: 'serial'`, use an integer foreign-key column to match the generated user ID.
178
+ This example uses D1 and the default text IDs. For PostgreSQL or MySQL, use `void/schema-pg` or `void/schema-mysql`. With `advanced.database.generateId: 'serial'`, use an integer foreign key.
182
179
 
183
- The example above uses SQLite/D1. For PostgreSQL and MySQL, use the corresponding schema modules: `void/schema-pg` and `void/schema-mysql`.
184
-
185
- The generated schema is managed by Void. Do not edit `.void/better-auth-schema.ts` manually, as Void may regenerate it during its build or preparation process.
180
+ Void regenerates `.void/better-auth-schema.ts`. Configure authentication in `auth.ts` rather than editing the generated file.
186
181
 
187
182
  ## Behavior
188
183
 
@@ -245,6 +240,8 @@ export default defineAuth(({ defaults }) => ({
245
240
 
246
241
  `defaults` already includes Void's conventions. Extend it explicitly instead of expecting a deep merge.
247
242
 
243
+ In `auth.ts`, load helpers that import `@auth-schema` inside the hook that uses them, with `await import('./server/users')`. This lets `void prepare` generate the authentication schema on a fresh clone. The same applies when a helper imports your app's database schema and that schema references authentication tables.
244
+
248
245
  For the full set of available options, see the official [Better Auth options reference](https://www.better-auth.com/docs/reference/options).
249
246
 
250
247
  ## Database and Migrations
@@ -43,7 +43,7 @@ await db.batch([
43
43
 
44
44
  Void enables [D1 read replication](https://developers.cloudflare.com/d1/best-practices/read-replication/) when it provisions a database. To enable it on an existing database, run `void deploy --platform cloudflare --provision`. Queries through `db` from `void/db` use a D1 session for each Void request, so reads can run near the request and later queries in that request see at least the same data. Framework handlers without Void's request scope start each database operation on the primary. `createDb` starts a replica-capable session for the binding you pass it.
45
45
 
46
- Replicas can lag between requests. Authentication session checks start on the primary so a revoked session is not accepted because of replica lag. For another read that needs the latest primary data, create a Drizzle client inside that request with `createDb(env.DB, { session: 'first-primary' })`:
46
+ Replicas can lag between requests. Authentication checks use the primary so a lagging replica can't accept a revoked session. For other reads that need the latest primary data, create a client inside the request:
47
47
 
48
48
  ```ts
49
49
  import { users } from '@schema';
@@ -57,7 +57,9 @@ export const GET = defineHandler(async () => {
57
57
  });
58
58
  ```
59
59
 
60
- The first query uses the primary; subsequent queries in that session see at least the same data. Without this option, `createDb()` uses `'first-unconstrained'`, allowing its first query to use a replica. Other query libraries and raw D1 calls need their own `withSession()` to use replicas; a bare D1 binding reads from the primary.
60
+ With `session: 'first-primary'`, the first query reads from the primary and later queries see at least the same data. The default, `'first-unconstrained'`, allows the first query to use a replica.
61
+
62
+ For raw D1 calls or another query library, use `withSession()` to read from replicas. A bare D1 binding reads from the primary.
61
63
 
62
64
  ## Alternative Query Layers
63
65
 
@@ -388,36 +388,38 @@ See the [CLI reference](../reference/cli/database.md#database) for connection se
388
388
 
389
389
  ## Adopt an existing Drizzle PostgreSQL database {#adopt-existing-drizzle}
390
390
 
391
- You can keep a PostgreSQL database that Drizzle has already migrated. Void tracks applied files separately, so record the existing history before the first Void deployment.
391
+ To use Void with a PostgreSQL database that Drizzle has already migrated, record its applied migrations before your first deployment:
392
392
 
393
393
  1. Back up the database and pause deployments. Try the procedure on a restored copy first.
394
394
  2. Set `database: 'pg'` in `void.config.ts`. Keep your existing schema, SQL filenames, and `db/migrations/meta/` directory. Do not regenerate or rename migrations during adoption.
395
- 3. Check the database's Drizzle history against `meta/_journal.json` and your SQL files. Match each applied row's `created_at` to the journal entry's `when`, and its `hash` to the SHA-256 of the corresponding SQL file. Drizzle normally stores this history in `drizzle.__drizzle_migrations`; use your configured schema and table if different. If a file cannot be verified, resolve the discrepancy before continuing.
396
-
397
- ```sql
398
- SELECT hash, created_at FROM drizzle.__drizzle_migrations ORDER BY created_at;
399
- ```
400
-
401
- 4. Save the following as `adopt-void.sql`, replacing the example filenames with **only the migrations verified as already applied to this database**, including `.sql`. Leave new, unapplied files out of the list.
402
-
403
- ```sql [adopt-void.sql]
404
- BEGIN;
405
- CREATE TABLE IF NOT EXISTS _void_migrations (
406
- name TEXT PRIMARY KEY,
407
- applied_at TEXT NOT NULL
408
- );
409
- INSERT INTO _void_migrations (name, applied_at)
410
- VALUES
411
- ('0000_create_users.sql', CURRENT_TIMESTAMP::text),
412
- ('0001_add_email.sql', CURRENT_TIMESTAMP::text)
413
- ON CONFLICT (name) DO NOTHING;
414
- COMMIT;
415
- ```
416
-
417
- 5. Run the file against the existing database with your PostgreSQL client, stopping on errors. Use the same database and PostgreSQL search path that Void will use. This records the verified filenames without executing their SQL or changing Drizzle's history.
418
- 6. Configure Void's connection to that database and run `void db status`. Verify that only new migrations are pending, then deploy. For direct Cloudflare deployments, provide that database's `DATABASE_URL` in the shell or CI environment running `void deploy`.
419
-
420
- Repeat the verification and adoption separately for each database. An entry in one environment's history does not prove that another environment has applied it. Leave Drizzle's history table intact, and use Void for subsequent migrations.
395
+ 3. Read Drizzle's migration history. The default table is `drizzle.__drizzle_migrations`; use your configured schema and table if different.
396
+
397
+ ```sql
398
+ SELECT hash, created_at FROM drizzle.__drizzle_migrations ORDER BY created_at;
399
+ ```
400
+
401
+ Match each row's `created_at` to `when` in `meta/_journal.json`, and its `hash` to the SQL file's SHA-256. Resolve any differences before continuing.
402
+
403
+ 4. Save this as `adopt-void.sql`. Replace the example filenames with **only the migrations you verified as applied**, including `.sql`. Leave pending migrations out.
404
+
405
+ ```sql [adopt-void.sql]
406
+ BEGIN;
407
+ CREATE TABLE IF NOT EXISTS _void_migrations (
408
+ name TEXT PRIMARY KEY,
409
+ applied_at TEXT NOT NULL
410
+ );
411
+ INSERT INTO _void_migrations (name, applied_at)
412
+ VALUES
413
+ ('0000_create_users.sql', CURRENT_TIMESTAMP::text),
414
+ ('0001_add_email.sql', CURRENT_TIMESTAMP::text)
415
+ ON CONFLICT (name) DO NOTHING;
416
+ COMMIT;
417
+ ```
418
+
419
+ 5. Run the file with your PostgreSQL client, stopping on errors. Use the database and search path Void will use. This records the filenames without running their SQL or changing Drizzle's history.
420
+ 6. Connect Void to the database and run `void db status`. Only new migrations should be pending. For direct Cloudflare deployments, set `DATABASE_URL` in the shell or CI environment that runs `void deploy`.
421
+
422
+ Repeat these steps for each database; development and production may have different migration histories. Keep Drizzle's history table, and use Void for future migrations.
421
423
 
422
424
  ## Hand-written migrations {#hand-written-migrations}
423
425
 
@@ -36,13 +36,13 @@ void db generate
36
36
 
37
37
  Review and commit the SQL, then deploy again. Rollback does not reverse database migrations. See [Database](./database.md) for the local workflow.
38
38
 
39
- When migrations run in a separate release step, or a preview shares an existing database, deploy code without applying application or authentication SQL migrations:
39
+ If you run migrations in a separate release step, or a preview shares your database, deploy without applying SQL migrations:
40
40
 
41
41
  ```sh
42
42
  void deploy --skip-migrations
43
43
  ```
44
44
 
45
- This works with both deployment destinations. Ensure the app supports the database's current schema. Migration files and schema checks still apply, and the next normal deploy applies any pending migrations. See [the deploy options](../reference/cli/deploy.md#void-deploy) and [`void db migrate`](../reference/cli/database.md#void-db-migrate) for supported ways to apply migrations separately.
45
+ The app must work with the database's current schema. Both deployment destinations support this option, and the next deploy without it applies pending migrations. See [`--skip-migrations`](../reference/cli/deploy.md#void-deploy) for requirements and [`void db migrate`](../reference/cli/database.md#void-db-migrate) to apply migrations separately.
46
46
 
47
47
  For D1 on your own Cloudflare account, deploy saves a restore point before applying migrations and prints a [`void db restore`](../reference/cli/database.md#void-db-restore) command. Use it to recover from a bad migration, then fix the migration before deploying again. A restore discards writes made after that point; check that your deployed code works with the restored schema. See the command reference for the recovery steps and retention limits.
48
48
 
@@ -25,8 +25,8 @@ Define custom response headers in [`void.config.ts`](../../reference/config) usi
25
25
  - **Header values** use `Name: value` format. The value may contain colons.
26
26
  - All matching rules are merged. When multiple rules set the same header name, the **last match wins**.
27
27
  - User-defined `Cache-Control` overrides the built-in default. The default still applies when no rule matches.
28
- - With [authentication](../auth.md), responses to requests that send cookies or credentials stay private, and auth endpoints stay uncached, during local development, with `void deploy --platform cloudflare`, and on [other runtimes](../deployment.md#other-runtimes). On a [Void platform](../deployment.md#deploy-to-a-team-platform), a `Cache-Control` rule replaces the app's value, so do not match signed-in pages or `/api/auth/*` with a public cache rule.
29
- - Rules apply to matching error responses too, including 404 responses. An immutable cache rule can therefore cache a missing file. Use immutable caching only for URLs that change when their content changes.
28
+ - With [authentication](../auth.md), responses to requests with cookies or credentials stay private, and auth endpoints stay uncached, in development, on direct Cloudflare deployments, and on [other runtimes](../deployment.md#other-runtimes). On a [Void platform](../deployment.md#deploy-to-a-team-platform), header rules can replace those cache settings. Keep public cache rules away from signed-in pages and `/api/auth/*`.
29
+ - Rules also apply to errors, including 404s. Use immutable caching only for URLs that change with their content, so a missing file isn't cached under a permanent URL.
30
30
 
31
31
  ## Scope
32
32
 
@@ -48,4 +48,4 @@ During local development, with `void deploy --platform cloudflare`, and on [othe
48
48
 
49
49
  On a Void platform, Void reads `_headers` files produced by supported frameworks. Your `routing.headers` rules run afterward, so they can override framework defaults.
50
50
 
51
- For native Cloudflare framework deployments, put a `_headers` file in your framework's public asset directory to configure static asset responses. Void includes the built file when it uploads a Worker version, including deployments that keep existing Worker secrets. These rules do not apply to responses generated by a Worker.
51
+ For direct Cloudflare framework deployments, put `_headers` in your framework's public asset directory. Its rules apply to static files, including when a deployment preserves existing secrets. To set headers on Worker responses, use your framework's server code.
@@ -23,7 +23,7 @@ Pages without dynamic params do not need `getPrerenderPaths()`.
23
23
 
24
24
  ## Dynamic pages (with params)
25
25
 
26
- For pages with URL params, also export `getPrerenderPaths()` to specify which param combinations to prerender. Annotate the return type with [`PageParams`](../../reference/api/types.md#route-types) for that page's URL pattern, such as `/blog/:slug` for `pages/blog/[slug].server.ts`. TypeScript then requires each object to include those params, so a missing or misspelled key is a type error. Void does not infer this type from the filename.
26
+ For a dynamic page, export `getPrerenderPaths()` to choose which paths to render. Annotate its return type with [`PageParams`](../../reference/api/types.md#route-types) so TypeScript checks the parameter names:
27
27
 
28
28
  ```ts
29
29
  // pages/blog/[slug].server.ts
@@ -31,12 +31,14 @@ import type { PageParams } from 'void/routes';
31
31
 
32
32
  export const prerender = true;
33
33
 
34
- export async function getPrerenderPaths(): Promise<PageParams<'/blog/:slug'>[]> {
34
+ export async function getPrerenderPaths(): Promise<PageParams<'/blog/[slug]'>[]> {
35
35
  return [{ slug: 'hello-world' }, { slug: 'getting-started' }];
36
36
  }
37
37
  ```
38
38
 
39
- Each object must include every param in the page path. Values can be strings or numbers, and Void URL-encodes them. A single-segment param such as `[slug]` cannot contain `/`. For nested paths, use a catch-all page such as `pages/docs/[...slug]` and return `{ slug: 'guides/intro' }`. If an entry is invalid, `void deploy` fails. The error names the server file and the entry index.
39
+ Return an object for each path, with every required parameter. Values can be strings or numbers; Void URL-encodes them. Use a catch-all page such as `pages/docs/[...slug]` for values containing `/`, for example `{ slug: 'guides/intro' }`.
40
+
41
+ The type annotation is required for TypeScript to check the keys. At deployment, Void reports invalid entries with their server filename and index.
40
42
 
41
43
  ## Custom SSR
42
44
 
@@ -51,8 +53,6 @@ export async function getPrerenderPaths(): Promise<string[]> {
51
53
  }
52
54
  ```
53
55
 
54
- Annotate this return type as an array of path strings. Use `PageParams` on file-based pages, where the function returns param objects.
55
-
56
56
  ## Relationship to revalidation
57
57
 
58
58
  Setting `routing.isr: false` in `void.config.ts` disables ISR and this edge-prerendering behavior, including per-page exports. It does not disable build-time HTML generation with `output: "static"`.
@@ -24,7 +24,7 @@ Define URL redirects in [`void.config.ts`](../../reference/config) using the `ro
24
24
  - **Destinations** can be strings (default `302`) or objects with `to` and optional `status`. Supported statuses: `301`, `302`, `303`, `307`, `308`.
25
25
  - `:splat` in the destination is replaced with the portion of the path matched by `*` in the source pattern.
26
26
  - Destination query strings are merged into the `Location` header (the destination's parameters take precedence on per-key conflict). To drop the incoming query, write an explicit reset like `?`.
27
- - `c.redirect()` in a handler, loader, or middleware sends that location unchanged and does not append the request query. A named action still drops its action key when the browser follows with GET, and keeps the page's other parameters. See [`c.redirect()`](../../reference/api/rewrites.md#c-rewrite-destination).
27
+ - For redirects from a handler, loader, or middleware, use [`c.redirect()`](../../reference/api/rewrites.md#c-rewrite-destination). It sends the location you provide without adding the request query. Named actions keep their own query parameters and drop the action key when redirecting to GET.
28
28
  - When multiple rules match, the **first match wins**. Put specific patterns before catch-all patterns.
29
29
  - Redirects are evaluated **before** the request reaches the worker, so they short-circuit static asset serving, ISR, and SSR.
30
30
 
@@ -62,7 +62,7 @@ export const loader = defineHandler(async (c) => {
62
62
  });
63
63
  ```
64
64
 
65
- Use a whole-number literal such as `3600`. Void reads the value without running the file, so it ignores an expression such as `60 * 60` or a value re-exported from another module, and prints a warning.
65
+ Use a whole number such as `3600` directly in the export. Expressions such as `60 * 60` and re-exports are ignored with a warning.
66
66
 
67
67
  Per-page values take precedence over `void.config.ts` patterns.
68
68
 
@@ -109,6 +109,8 @@ Responses that vary by request headers, such as `Vary: Accept-Language` or `Vary
109
109
 
110
110
  Requests with `Cookie`, `Authorization`, or Cloudflare Access's `Cf-Access-Jwt-Assertion` header bypass the ISR cache entirely and always dispatch to the worker. Authenticated responses are not shared between users, including when Access authentication supplies no cookie.
111
111
 
112
+ A request that negotiates a representation other than the cached HTML document also bypasses the cache, because each path holds a single cached body. That covers `Accept: text/event-stream` and `Accept: text/markdown`, so middleware that answers those requests in another format runs on every request.
113
+
112
114
  ## Cache keys and rewrites
113
115
 
114
116
  For a dispatch rewrite, the cache key includes both the destination and original pathname. A direct request to `/en/docs/foo` therefore uses a different entry from `/docs/foo` rewritten to that destination.
@@ -138,4 +140,4 @@ export const POST = defineHandler(async (c) => {
138
140
  });
139
141
  ```
140
142
 
141
- With [`routing.typedRoutes`](../../reference/config.md#routing-typedroutes) on, each path must match one of your routes. Cast a path that TypeScript can't check, such as one from a webhook payload, with `as RouteUrl` from `void/routes`. The cast turns the check off for that path.
143
+ With [`routing.typedRoutes`](../../reference/config.md#routing-typedroutes), TypeScript checks each path against your routes. For a path you validate at runtime, use `as RouteUrl` from `void/routes` to skip the type check.
@@ -57,7 +57,7 @@ Keep access checks on any destination that needs them.
57
57
 
58
58
  A destination without `?` preserves the incoming query string. `c.rewrite('/search')` keeps `?q=...`, while `c.rewrite('/search?q=all')` replaces it.
59
59
 
60
- Your editor suggests known routes through the [`RewriteDestination`](../../reference/api/rewrites.md#rewritedestination) type. Dynamic strings are also accepted. With [`routing.typedRoutes`](../../reference/config.md#routing-typedroutes), a string must match one of your routes; add `as RouteUrl` to a path built at runtime, such as ``c.rewrite(`/en${c.req.path}` as RouteUrl)``.
60
+ Your editor suggests known routes through [`RewriteDestination`](../../reference/api/rewrites.md#rewritedestination). Enable [`routing.typedRoutes`](../../reference/config.md#routing-typedroutes) to reject strings that don't match a route. For a path you build at runtime, import `RouteUrl` from `void/routes` and use a cast, such as ``c.rewrite(`/en${c.req.path}` as RouteUrl)``.
61
61
 
62
62
  ### Runtime rewrites cannot reach static assets
63
63
 
@@ -91,6 +91,10 @@ Choose `single-page-application`, `404-page`, or `none`. These settings preserve
91
91
 
92
92
  SvelteKit, Nuxt, Analog, and Astro handle their own error pages and ignore `routing.notFound`. For direct Cloudflare deployment with TanStack Start, React Router, or vinext, configure the asset binding, directory, and routing policy through the framework's Cloudflare config.
93
93
 
94
+ On direct Cloudflare deployments, SvelteKit, Nuxt, Analog, and Astro serve built files and prerendered pages without running the Worker. Other requests reach the framework.
95
+
96
+ To run server code before serving an asset, set [`run_worker_first`](https://developers.cloudflare.com/workers/static-assets/binding/#run_worker_first) under `cloudflare.assets` in `void.config.ts`. Setting it to `true` runs the Worker on every request and counts toward Worker request usage.
97
+
94
98
  ## API routes and SSR pages
95
99
 
96
100
  API responses and SSR pages are not cached as static assets. Use [Revalidation](./revalidation) to cache public rendered pages.
@@ -92,7 +92,7 @@ On your own Cloudflare account, `from` defaults to `email.from` from `void.confi
92
92
 
93
93
  ## Reply later {#reply-later}
94
94
 
95
- `replyEmail()` works only while the inbound handler runs. To reply later, for example from a queue job, save the thread ids in the handler and pass them to `sendEmail` as `threading`:
95
+ To reply from a queue job or another later task, save the incoming message's thread IDs and pass them to `sendEmail`:
96
96
 
97
97
  ```ts
98
98
  // email/support.ts
@@ -117,7 +117,9 @@ await sendEmail({
117
117
  });
118
118
  ```
119
119
 
120
- `inReplyTo` is the parent message's `Message-ID`. `references` lists the thread's ids, oldest first, ending with the parent; it defaults to `inReplyTo`. Mail clients use them to show the reply in the same conversation. An id that cannot be sent, such as one with a control character, is left out. If `references` cannot be sent, it falls back to `inReplyTo`. The email still sends. `headers` cannot set `In-Reply-To` or `References`.
120
+ Mail clients use `threading` to show the reply in the same conversation. Set `inReplyTo` to the parent's `Message-ID`. For a longer thread, set `references` to the earlier IDs in order, ending with the parent; otherwise it defaults to `inReplyTo`.
121
+
122
+ Use `threading` rather than custom `In-Reply-To` or `References` headers. Invalid thread IDs are omitted without stopping the send. For an immediate reply inside the inbound handler, use [`replyEmail()`](./receiving.md#threaded-replies).
121
123
 
122
124
  ## Attachments {#attachments}
123
125
 
@@ -78,7 +78,7 @@ stream.close();
78
78
 
79
79
  Subscription IDs are scoped to a connection. Reusing an ID replaces its subscription. After reconnecting, the helper restores active subscriptions and sends their latest `eventId` as `lastEventId`.
80
80
 
81
- With [`routing.typedRoutes`](../reference/config.md#routing-typedroutes), the URL must match one of your routes or be an `http://` or `https://` URL. Cast a `string` that TypeScript can't check with `as RouteUrl` from `void/routes`. The cast turns off the check for that URL.
81
+ With [`routing.typedRoutes`](../reference/config.md#routing-typedroutes), TypeScript checks the URL against your routes. External `http://` and `https://` URLs also work. For a URL you validate at runtime, use `as RouteUrl` from `void/routes` to skip the type check.
82
82
 
83
83
  ## Publish
84
84
 
@@ -200,13 +200,25 @@ const form = useForm(
200
200
 
201
201
  `onError` receives a field-error map or a `VoidActionError`. Callbacks can be async; `form.pending` stays true until they finish, and thrown errors reach the nearest React error boundary. Callbacks run before React commits the updated UI, so use an effect or ref callback to focus an element that appears after submission.
202
202
 
203
- If a callback awaits `router.visit()` or `router.refresh()`, pass `{ resolveOn: 'data' }` so it can finish before React commits the navigation. See [React navigation completion](../../reference/api/pages.md#react-navigation-completion).
203
+ When awaiting `router.visit()` or `router.refresh()` inside a callback, pass `{ resolveOn: 'data' }`. The callback can then finish before React commits the navigation. See [React navigation completion](../../reference/api/pages.md#react-navigation-completion).
204
204
 
205
205
  Vue, Svelte, and Solid submissions return a promise instead; use `await form.post()` to run work after a submission.
206
206
 
207
207
  ### Query parameters after submission
208
208
 
209
- An action or form that posts to the current page keeps the page's query parameters. From `/items?page=2&search=foo`, `action('/items?vote')` posts to `/items?vote&page=2&search=foo`, so the action and loader see `page` and `search`. The URL, scroll position, and history entry stay as they are. A parameter written in the action URL takes precedence over the page's: `action('/items?vote&page=1')` posts with `page=1`.
209
+ Actions and forms keep the current page's query parameters when submitting to that page. For example, from `/items?page=2&search=foo`:
210
+
211
+ ```ts
212
+ import { action } from '@void/react'; // or "@void/vue", "@void/svelte", "@void/solid"
213
+
214
+ // The action and loader receive page=2 and search=foo.
215
+ await action('/items?vote');
216
+
217
+ // An explicit parameter overrides the current page's value.
218
+ await action('/items?vote&page=1');
219
+ ```
220
+
221
+ The page URL, scroll position, and history entry stay unchanged.
210
222
 
211
223
  A redirect from the action does not receive the page's query parameters. To clear them after an action, return `c.redirect('/items')`.
212
224
 
@@ -301,7 +313,9 @@ if (!result.ok) {
301
313
 
302
314
  `action()` defaults to `POST`. Pass `data`, `params`, and `method` to set the body, route parameters, or HTTP method.
303
315
 
304
- A successful call returns `{ ok: true, pageData }`. Expected errors, such as validation failures or conflicts, return `{ ok: false, error }`. `error.message` is the message of an [`HTTPException`](../../integrations/hono.md#utilities) with a `4xx` status, or the body of another plain-text `4xx` response. For other errors, it is a status summary such as `Action failed with 404 Not Found`.
316
+ A successful call returns `{ ok: true, pageData }`. Expected errors, such as validation failures or conflicts, return `{ ok: false, error }`.
317
+
318
+ For `4xx` errors, `error.message` uses the [`HTTPException`](../../integrations/hono.md#utilities) message or the body of a plain-text response. Other response formats use a status summary, such as `Action failed with 404 Not Found`.
305
319
 
306
320
  ## Validation Errors
307
321
 
@@ -311,7 +325,7 @@ Expected errors such as `400`, `404`, `409`, `422`, and `429` stay with the form
311
325
 
312
326
  By default, authentication errors (`401`, `403`) and server errors (`500`, `502`) are thrown. Handle them with your framework's error boundary or error handling.
313
327
 
314
- To handle all HTTP failures inline, pass `throwOnError: false` to `useForm()`. Validation errors still populate `form.errors`; other HTTP failures populate `form.error`, keeping the form and its input visible. The `Form` component displays the error automatically. In React, `onError` also receives these failures.
328
+ To keep the form visible when a request fails, pass `throwOnError: false`:
315
329
 
316
330
  ```ts
317
331
  import { useForm } from '@void/react'; // or "@void/vue", "@void/svelte", "@void/solid"
@@ -319,9 +333,11 @@ import { useForm } from '@void/react'; // or "@void/vue", "@void/svelte", "@void
319
333
  const form = useForm('/users', { name: '', email: '' }, { throwOnError: false });
320
334
  ```
321
335
 
322
- Unexpected failures, such as network errors, still throw. Cancelled submissions do not set a form error.
336
+ Validation errors appear in `form.errors`; other HTTP failures appear in `form.error`. `Form` displays the error for you. In React, `onError` also receives it.
323
337
 
324
- Use `isVoidActionError()` to tell a failed action apart from other errors. It's `true` for a `VoidActionError` at any status, and narrows the error so you can read `status` and `message`. `isCallSiteActionError()` is `true` only for the expected errors that `action()` returns.
338
+ Network errors and other unexpected failures still throw. Cancelled submissions don't set a form error.
339
+
340
+ Use `isVoidActionError()` to read an action error's `status` and `message`, including thrown errors:
325
341
 
326
342
  ```ts
327
343
  import { isVoidActionError } from '@void/react'; // or "@void/vue", "@void/svelte", "@void/solid"
@@ -335,6 +351,8 @@ function describeError(error: unknown) {
335
351
  }
336
352
  ```
337
353
 
354
+ Use `isCallSiteActionError()` to recognize only the expected errors returned by `action()`.
355
+
338
356
  Actions can throw `ValidationError` for custom validation logic:
339
357
 
340
358
  ```ts
@@ -461,7 +479,7 @@ export const action = defineHandler(async (c) => {
461
479
  });
462
480
  ```
463
481
 
464
- `withValidator({ body })` accepts the same upload. Nested names such as `profile[name]`, `tags[0]`, and `tags[]` are objects and arrays again. A multipart schema has to coerce the rest: booleans arrive as `'1'` or `'0'`, numbers and dates as strings, and `null` as `''`.
482
+ `withValidator({ body })` also accepts uploads. Nested field names such as `profile[name]`, `tags[0]`, and `tags[]` become objects and arrays. Coerce other values in your schema: booleans arrive as `'1'` or `'0'`, numbers and dates as strings, and `null` as `''`.
465
483
 
466
484
  Pick the storage key on the server and allow only the file types you expect. See [Serving Files](../storage.md#serving-files) to send them back safely.
467
485
 
@@ -5,7 +5,7 @@ outline: deep
5
5
 
6
6
  # Not Found & Errors
7
7
 
8
- Add `_not-found` and `_error` components to `pages/` to show errors inside your app's layouts. Both receive an `error` prop with `status` and `message`.
8
+ Keep your app's navigation and layout visible when a page is missing or fails. Add `_not-found` and `_error` components to `pages/`; both receive an `error` prop with `status` and `message`:
9
9
 
10
10
  ::: code-group
11
11
 
@@ -69,7 +69,9 @@ export default function ErrorPage(props: ErrorPageProps) {
69
69
 
70
70
  :::
71
71
 
72
- `_not-found` handles a page loader returning a 404 or throwing `HTTPException(404)`. A root `pages/_not-found` also handles URLs that don't match a page or API route. Returning a 404 is the same in all four adapters:
72
+ ## Missing pages
73
+
74
+ To show `_not-found` when a product doesn't exist, return a 404 from its loader. This works the same way in all four adapters:
73
75
 
74
76
  ```ts
75
77
  // pages/products/[id].server.ts
@@ -78,24 +80,30 @@ import { defineHandler } from 'void/handler';
78
80
  export const loader = defineHandler((c) => c.notFound());
79
81
  ```
80
82
 
81
- `_error` handles unexpected loader and rendering failures. Unexpected errors use generic production messages; server details stay in your logs. Development shows the error message. Action errors that reach a client boundary retain their HTTP status and public message. Explicit responses such as redirects, authentication failures, and API errors keep their existing behavior.
83
+ Throwing `HTTPException(404)` also shows `_not-found`. A root `pages/_not-found` handles URLs that don't match any page or API route.
84
+
85
+ In middleware, `c.notFound()` shows the root `_not-found` without running a page loader. To send a custom response instead, return `c.text('Not Found', 404)`.
86
+
87
+ ## Failed pages
88
+
89
+ `_error` handles unexpected loader and rendering failures. In production, visitors see a generic message and error details stay in your server logs. Development shows the error message.
82
90
 
83
- Calling `c.notFound()` in middleware invokes the app's not-found handler, which uses the root `pages/_not-found`. It doesn't select a nested boundary or run the page loader. To send your own 404 response from middleware, return a response such as `c.text('Not Found', 404)`; Void leaves it unchanged.
91
+ Action errors that reach a client boundary keep their HTTP status and public message. Redirects, authentication responses, and API errors keep their usual behavior.
84
92
 
85
93
  ## Nested errors
86
94
 
87
- Put a boundary in a subdirectory to customize that section. The closest boundary wins, keeping its layout and outer layouts. A layout's own rendering failure goes to a boundary outside that layout. If an error component fails, Void tries an outer boundary, then its built-in error page.
95
+ Put an error component in a subdirectory to customize that section. Void uses the closest one and keeps its surrounding layouts. If a layout fails, an error component outside that layout handles it. If an error component fails, Void tries an outer one, then its built-in error page.
88
96
 
89
97
  Boundary components don't have `.server` companions, actions, or their own `layout` export. They aren't routes: `/error` and `/not-found` remain available for ordinary pages. `.dev` and `.prod` variants work like other Pages components.
90
98
 
91
99
  ## Recovery
92
100
 
93
- Client rendering errors use the framework's error boundaries. Event handlers, detached async tasks, and independent islands keep the framework's normal error handling. Deferred props retain each adapter's usual behavior: React can throw a rejected deferred promise during rendering; Vue, Svelte, and Solid expose its error state for your component to display.
101
+ Call `useRouter().refresh()` from an interactive error component to retry the page's loader. It fetches fresh data without repeating a form submission. A regular link or document reload also works. Error responses aren't cached by the client router.
94
102
 
95
- Use `useRouter().refresh()` in an interactive error component to retry the current page's GET loader. It bypasses Void's client page cache and never repeats a form submission. A regular link or document reload also works. Error responses aren't stored in the client page cache.
103
+ Client rendering errors use your framework's error boundaries. Event handlers, detached async tasks, and independent islands keep the framework's usual error handling. For deferred data, React can throw rejected promises during rendering; Vue, Svelte, and Solid expose an error state your component can display.
96
104
 
97
105
  ## Rendering modes
98
106
 
99
- `ssr = false` pages show their error component in the browser. Island pages render error documents on the server; they don't gain a client router. Boundary components should work with the same shared context as the page they replace.
107
+ With `ssr = false`, the error component renders in the browser. Island pages render errors on the server without a client router. Error components receive the shared context of the page they replace.
100
108
 
101
- With `output: 'static'`, a root `_not-found` produces `404.html` unless an explicit 404 document already exists. It renders with empty shared data and parameters, without request middleware or client hydration. Keep that component and its layouts usable without a signed-in user or other request data. Your static host controls the response status for unknown URLs.
109
+ With `output: 'static'`, a root `_not-found` produces `404.html` unless you provide one. It renders at build time with empty shared data and parameters, without request middleware or hydration. Keep it and its layouts usable without a signed-in user. Your static host sets the response status for unknown URLs.