API Reference
Use this reference to find public imports, signatures, and return types. For setup and examples, start with the guides.
API Topics
| Topic | Use it for |
|---|---|
| Plugin and configuration | Add Void to Vite and configure your app. |
| Handlers and middleware | HTTP routes, validation, scheduled jobs, queues, and rendering. |
| Rewrites | Serve another route while keeping the requested URL. |
| Authentication | Sessions, users, and the auth client. |
| Fetch client | Typed requests and errors. |
| Durable State and WebSockets | Persistent objects and typed connections. |
| Database and seeding | Queries, operators, and seed scripts. |
| KV, storage, AI, and logging | Resource clients, cache revalidation, and logs. |
| Deployment artifacts | Package built apps for managed deployment. |
| Types | Handler context, route types, and head metadata. |
| Environment variables | Validated environment values and binding types. |
| Pages adapters | React, Vue, Svelte, Solid, and Markdown. |
User-Facing Imports
Import Void's app-facing APIs from these paths:
| Import path | Contents |
|---|---|
void | voidPlugin, handler/type re-exports, defer, Deferred, DeferredState, InferProps, HeadDescriptor |
void/handler | defineHandler, defineMiddleware, basicAuth, defineScheduled, defineQueue, defineRender, defineHead, types |
void/auth | defineAuth, getUser, getSession, requireAuth, AuthUser, AuthSession, AuthState |
void/client | fetch, fetchStream, FetchError, auth, createAuthClient, AuthUser, AuthSession, AuthState |
void/client/{framework} | Same as void/client, with framework-specific Better Auth clients for react, vue, svelte, and solid |
void/ws | defineRoom, defineWebSocket, connect, WebSocket context and connection types |
void/durable | defineDurableState, defineDurableObject, typed state/RPC/context/migration types |
void/sse | eventStream, formatSse, formatSseText, getLastEventId, SseStreamClosedError, SSE message and stream types |
void/sse/client | connectEventStream, browser EventSource wrapper types |
void/live | defineLiveStream, SSE topic fanout runtime types. Server-only. |
void/live/client | connectLiveStream, browser helper for one SSE connection plus POST subscribe/unsubscribe control. |
void/response | convertReturnValue |
void/validator | runValidation, ValidatorSlots, HandlerInput |
void/drizzle-zod | Re-exports drizzle-zod for schema-derived Zod validators for Drizzle tables |
void/drizzle-valibot | Re-exports drizzle-valibot for schema-derived Valibot validators for Drizzle tables |
void/drizzle-arktype | Re-exports drizzle-arktype for schema-derived ArkType validators for Drizzle tables |
void/schema-d1 | Re-exports drizzle-orm/sqlite-core for D1 table and column builders |
void/schema-pg | Re-exports drizzle-orm/pg-core for PostgreSQL table and column builders |
void/schema-mysql | Re-exports drizzle-orm/mysql-core for MySQL table and column builders |
void/database-provider | defineDatabaseProvider and adapter types for void db connect --provider |
void/db | db (Drizzle D1, PostgreSQL, or MySQL instance for the active dialect), createDb, query operators (eq, and, or, desc, like, inArray, etc.) |
void/seed | defineSeed, SeedContext, SeedFn for programmatic void db seed modules |
void/kv | kv, createKV, typed KV client/map types |
void/storage | storage, createStorage for the inferred R2 binding or a specific R2Bucket |
void/ai | ai, VoidAi, model input and response types |
void/limits | UsageLimit, UsageLimitData, and readUsageLimit. AI and Sandbox limits reject with UsageLimit; uncaught limits in Void routes and Pages actions return structured HTTP 429 responses. |
void/isr | revalidate(options) for on-demand ISR cache invalidation |
void/log | logger structured logging helper |
void/routes | RouteMap and WebSocketRouteMap stubs (types only) |
void/queues | queues proxy for sending messages to typed queues |
void/email | sendEmail, createEmail, defineEmail, parseEmail, replyEmail, MimeError, ParseEmailError, and address, attachment, result, and handler types. See Email. |
void/email/testing | createEmailTestHarness and createInboundTestHarness to capture sends and deliver test messages to email/ handlers. |
void/sandbox | getSandbox, sandbox, SandboxLimitError, SandboxUnavailableError, and the SDK 1.0 file, backup, and mount helpers. getSandbox(id) resolves a client. Commands, files, port requests, and process completion return promises; limits reject with SandboxLimitError, which extends UsageLimit. Container state lasts until inactivity (default ten minutes), a crash, or a restart. See Sandboxes for the API and deployment requirements. |
void/env | defineEnv, env, schema helpers (string, number, boolean, url, email, oneOf, json), and global Cloudflare env types |
void/nitro | Nitro module for Nuxt and Analog. Add 'void/nitro' to the Nitro modules so server routes get the app's void/db and @schema |
void/sveltekit | SvelteKit integration helpers: withVoidTSConfig() and mergeVoidSvelteKitTsconfig() |