Skip to content

Commit c9027eb

Browse files
yyx990803claude
andcommitted
docs: add footer to doc pages, update cloudflare integration docs
- Add DocFooter component with FooterNav on doc pages (light/dark aware) - Reorder nav: Reference before Integrations - Update cloudflare.md: add AI + Queue bindings, fix config structure (inference.bindings), update compat date, recommend .env over worker.vars, add meta-framework warning - Add meta-framework warning to orms-and-external-dbs.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eab5a38 commit c9027eb

7 files changed

Lines changed: 71 additions & 26 deletions

File tree

‎docs/.vitepress/config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export default extendConfig(
141141

142142
nav: [
143143
{ text: "Guide", link: "/guide/", activeMatch: "/guide/" },
144-
integrationLinks,
145144
referenceLinks,
145+
integrationLinks,
146146
resourcesLinks,
147147
platformLinks,
148148
{ text: "Dashboard", link: "https://dash.void.cloud" },
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script setup>
2+
import { FooterNav } from "@voidzero-dev/vitepress-theme";
3+
import { useData } from "vitepress";
4+
5+
const { frontmatter } = useData();
6+
</script>
7+
8+
<template>
9+
<footer
10+
v-if="!frontmatter.layout || frontmatter.layout === 'doc'"
11+
class="doc-footer bg-[var(--vp-c-bg)]"
12+
>
13+
<FooterNav />
14+
</footer>
15+
</template>
16+
17+
<style scoped>
18+
.doc-footer :deep(.wrapper) {
19+
background-color: var(--vp-c-bg-alt);
20+
}
21+
:root.dark .doc-footer :deep(.wrapper) {
22+
background-color: transparent;
23+
}
24+
</style>

‎docs/.vitepress/theme/index.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { h } from "vue";
88
import "virtual:group-icons.css";
99
import "./styles.css";
1010
import CodeGroupSync from "./CodeGroupSync.vue";
11+
import DocFooter from "./DocFooter.vue";
1112

1213
import logoDark from "./void-dark.svg";
1314
import logoLight from "./void-light.svg";
@@ -59,7 +60,7 @@ export default {
5960
Layout() {
6061
return h(BaseTheme.Layout, null, {
6162
"aside-ads-before": () => h(AsideCredit),
62-
"layout-bottom": () => h(CodeGroupSync),
63+
"layout-bottom": () => [h(DocFooter), h(CodeGroupSync)],
6364
});
6465
},
6566
enhanceApp({ app }) {

‎docs/integrations/cloudflare.md‎

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Void runs on Cloudflare Workers. This page covers how bindings work, how the plu
88

99
## Bindings
1010

11-
Void automatically infers and provisions Cloudflare bindings (D1, KV, R2) by scanning your source files. There are two ways to access them at runtime depending on your setup.
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.
1212

1313
### Via Hono context (`c.env`)
1414

@@ -40,6 +40,10 @@ export const GET = defineHandler(async (c) => {
4040

4141
When using framework mode (TanStack Start, React Router, SolidStart), the framework owns routing and you access bindings through the `cloudflare:workers` module instead:
4242

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+
4347
```ts
4448
import { env } from "cloudflare:workers";
4549

@@ -77,40 +81,52 @@ Add `"void/env"` to your tsconfig `types` to get typed bindings on `env`:
7781
}
7882
```
7983

80-
This augments the `Cloudflare.Env` interface with `DB`, `KV`, and `STORAGE` and also pulls in `@cloudflare/workers-types`, so you don't need to add that separately.
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.
8185

8286
### Available bindings
8387

84-
| Binding | Type | Trigger |
85-
| --------- | ------------- | ----------------------------------------------- |
86-
| `DB` | `D1Database` | `env.DB` or `c.env.DB` usage detected |
87-
| `KV` | `KVNamespace` | `env.KV` or `c.env.KV` usage detected |
88-
| `STORAGE` | `R2Bucket` | `env.STORAGE` or `c.env.STORAGE` usage detected |
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"` |
8995

90-
Bindings are [inferred automatically](../reference/resource-inference.md) by scanning your source files for these access patterns. You can also set them explicitly in `void.json`:
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`:
9197

9298
```json
9399
{
94-
"bindings": { "db": true, "kv": true, "storage": false }
100+
"inference": {
101+
"bindings": { "db": true, "kv": true, "storage": false, "ai": true }
102+
}
95103
}
96104
```
97105

106+
`db`, `kv`, and `storage` accept a string to customize the binding name (e.g. `"db": "MY_DB"`). `ai` only accepts a boolean.
107+
98108
See [Configuration](../reference/config.md) for details.
99109

100110
### Wrangler passthrough
101111

102-
You can set non-binding wrangler fields like `compatibility_date`, `compatibility_flags`, and `vars` in `void.json`:
112+
You can set non-binding wrangler fields like `compatibility_date` and `compatibility_flags` in `void.json`:
103113

104114
```json
105115
{
106116
"worker": {
107-
"compatibility_date": "2025-12-01",
108-
"compatibility_flags": ["nodejs_compat"],
109-
"vars": { "API_URL": "https://api.example.com" }
117+
"compatibility_date": "2026-02-12",
118+
"compatibility_flags": ["nodejs_compat"]
110119
}
111120
}
112121
```
113122

123+
For environment variables, use `.env` files instead of `worker.vars` — Void automatically loads `.env` files via 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+
114130
Binding arrays (`d1_databases`, `kv_namespaces`, `r2_buckets`) are not allowed in the `worker` field — bindings are fully managed by Void. To use custom bindings with real resource IDs, add a `wrangler.jsonc` to your project root instead. See [Wrangler config merging](#wrangler-config-merging) for how Void handles this.
115131

116132
## Wrangler config merging
@@ -119,9 +135,9 @@ By default, Void configures the Cloudflare plugin entirely programmatically -- y
119135

120136
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.
121137

122-
### Void-only mode, TanStack Start, and React Router
138+
### Void-only mode and Vite-based frameworks
123139

124-
In Void's default mode and when using TanStack Start or React Router, Void controls the `@cloudflare/vite-plugin` directly. It passes a `config` callback that merges inferred bindings into whatever the plugin resolves from your `wrangler.jsonc`:
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`:
125141

126142
1. The plugin reads your `wrangler.jsonc` and resolves it into a config object with `d1_databases`, `kv_namespaces`, `r2_buckets`, etc.
127143
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.
@@ -134,9 +150,9 @@ Fields that Void always sets (`main`, `triggers`, `assets`) don't need to be in
134150

135151
In this mode, Void does **not** modify your `wrangler.jsonc` file on disk. The merge is purely in-memory.
136152

137-
### SvelteKit, Nuxt, and Astro
153+
### Adapter-based frameworks (SvelteKit, Nuxt, Astro)
138154

139-
When using SvelteKit, Nuxt, or Astro, the framework's own Cloudflare adapter owns the worker build and dev server. Void does **not** provide the `@cloudflare/vite-plugin` -- instead, it only contributes DB type codegen, migration management, and binding sync.
155+
When using SvelteKit, Nuxt, or Astro, the framework's own Cloudflare adapter owns the worker build and dev server. Void does **not** provide the `@cloudflare/vite-plugin` — instead, it only contributes DB type codegen, migration management, and binding sync.
140156

141157
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:
142158

@@ -218,7 +234,7 @@ Create `wrangler.jsonc` in your project root with the resource IDs from step 1:
218234
```jsonc
219235
{
220236
"name": "my-app",
221-
"compatibility_date": "2025-12-01",
237+
"compatibility_date": "2026-02-12",
222238
"d1_databases": [
223239
{
224240
"binding": "DB",

‎docs/integrations/orms-and-external-dbs.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Void's built-in database layer uses [Drizzle ORM](../guide/database.md) with D1
88

99
You're also free to skip D1 entirely and connect to an external database like PostgreSQL or MySQL — see [External Databases](#external-databases) below.
1010

11+
::: warning ⚠️ Cloudflare env access in meta frameworks
12+
Some frameworks, like Nuxt and SvelteKit, do not run in workerd during dev and therefore do not support directly importing from `cloudflare:workers`.
13+
:::
14+
1115
## Kysely
1216

1317
```ts

‎docs/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"@iconify/vue": "5.0.0",
13-
"@voidzero-dev/vitepress-theme": "^4.7.1",
13+
"@voidzero-dev/vitepress-theme": "^4.8.0",
1414
"oxc-minify": "^0.114.0",
1515
"reka-ui": "2.8.2",
1616
"vitepress": "2.0.0-alpha.16",

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)