Skip to content
brought to you byVoidZero

Resource Inference ​

Void automatically detects which Cloudflare resources your project uses by scanning source files at startup. In most cases, there is no manual configuration. Use a resource in code, and Void provisions the matching binding for local development.

Detected Bindings ​

BindingTypeDetected by importDetected by env access
DBD1Databaseimport { db } from "void/db"env.DB or c.env.DB
KVKVNamespaceimport { kv } from "void/kv"env.KV or c.env.KV
STORAGER2Bucketimport { storage } from "void/storage"env.STORAGE or c.env.STORAGE
AIAiimport { ai } from "void/ai"env.AI or c.env.AI
SANDBOXManaged Sandbox capabilityimport { getSandbox } from "void/sandbox"getSandbox(); native Cloudflare also exposes env.SANDBOX / c.env.SANDBOX
Authnoneimport { ... } from "void/auth" or import { auth } from "void/client" / void/client/react / void/client/vue / void/client/svelte / void/client/solidnone
QUEUE_*Queueimport { queues } from "void/queues"env.QUEUE_*
filename-derivedDurableObjectNamespaceA default-exported defineDurableState() module in durable-objects/n/a

Auth detection also triggers when importing the auth specifier from void/client or a framework-specific client subpath such as void/client/react (but not when importing only fetch).

Durable state is inferred from files in durable-objects/. For example, durable-objects/shopping-cart.ts creates the SHOPPING_CART binding, exports ShoppingCartDurableObject, and records its migration. See Durable State.

Scanned Directories ​

Standard mode ​

When using Void's built-in routing (no meta-framework), these directories are scanned:

DirectoryContains
routes/API route handlers
middleware/Hono middleware
queues/Queue consumers
pages/Page components and .server.ts companions
crons/Scheduled job handlers

Framework mode ​

When a meta-framework is detected (TanStack Start, React Router, SvelteKit, Nuxt, or Astro), a broader set of directories is scanned instead:

DirectoryContains
src/Application source
app/Framework app directory
routes/Framework routes
server/Server-side code

Framework detection checks package.json for @tanstack/react-start, @react-router/dev, @sveltejs/kit, nuxt, or astro in dependencies.

For SvelteKit, Nuxt, and Astro, add voidPlugin() to the framework's Vite config to enable inference during dev. See Frameworks Integration for setup details.

Always scanned ​

Regardless of mode, these are always checked:

  • SSR entry such as src/main.ssr.ts, for SSR apps that access bindings during rendering
  • src/, which is always scanned for auth imports unless it is already in the scan list for framework mode
  • durable-objects/, which is scanned for typed Durable Object state modules in native Void apps

Custom Scan Directories ​

If your project organizes code in non-standard directories, you can override which directories are scanned:

json
{
  "inference": {
    "scanDirs": ["src", "lib", "workers"]
  }
}

Paths are relative to the project root. When inference.scanDirs is set, it replaces the default directories entirely. Defaults for the current mode are not merged in. The SSR entry and src/ auth scan still apply either way.

Explicit Binding Overrides ​

Override individual bindings when inference does not match your setup:

json
{
  "inference": {
    "bindings": {
      "db": true,
      "kv": true,
      "storage": false,
      "ai": false
    }
  }
}

Explicit values override only their named bindings. Omitted bindings continue to be inferred, so setting kv does not disable storage, auth, or other features. Auth and checked-in migrations still require a database even when db is false.

File Types ​

Inference scans files matching **/*.{ts,tsx,mts,js,jsx,mjs} within each directory. Non-JS files (CSS, HTML, images) are ignored.