Skip to content
brought to you byVoidZero

API Reference ​

Use this reference to find public imports, signatures, and return types. For setup and examples, start with the guides.

API Topics ​

TopicUse it for
Plugin and configurationAdd Void to Vite and configure your app.
Handlers and middlewareHTTP routes, validation, scheduled jobs, queues, and rendering.
RewritesServe another route while keeping the requested URL.
AuthenticationSessions, users, and the auth client.
Fetch clientTyped requests and errors.
Durable State and WebSocketsPersistent objects and typed connections.
Database and seedingQueries, operators, and seed scripts.
KV, storage, AI, and loggingResource clients, cache revalidation, and logs.
TypesHandler context, route types, and head metadata.
Environment variablesValidated environment values and binding types.
Pages adaptersReact, Vue, Svelte, Solid, and Markdown.

User-Facing Imports ​

Import Void's app-facing APIs from these paths:

Import pathContents
voidvoidPlugin, handler/type re-exports, defer, Deferred, DeferredState, InferProps, HeadDescriptor
void/handlerdefineHandler, defineMiddleware, basicAuth, defineScheduled, defineQueue, defineRender, defineHead, types
void/authdefineAuth, getUser, getSession, requireAuth, AuthUser, AuthSession, AuthState
void/clientfetch, 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/wsdefineRoom, defineWebSocket, connect, WebSocket context and connection types
void/durabledefineDurableState, typed state/RPC/context/migration types
void/sseeventStream, formatSse, formatSseText, getLastEventId, SseStreamClosedError, SSE message and stream types
void/sse/clientconnectEventStream, browser EventSource wrapper types
void/livedefineLiveStream, SSE topic fanout runtime types. Server-only.
void/live/clientconnectLiveStream, browser helper for one SSE connection plus POST subscribe/unsubscribe control.
void/responseconvertReturnValue
void/validatorrunValidation, ValidatorSlots, HandlerInput
void/drizzle-zodRe-exports drizzle-zod for schema-derived Zod validators for Drizzle tables
void/drizzle-valibotRe-exports drizzle-valibot for schema-derived Valibot validators for Drizzle tables
void/drizzle-arktypeRe-exports drizzle-arktype for schema-derived ArkType validators for Drizzle tables
void/schema-d1Re-exports drizzle-orm/sqlite-core for D1 table and column builders
void/schema-pgRe-exports drizzle-orm/pg-core for PostgreSQL table and column builders
void/schema-mysqlRe-exports drizzle-orm/mysql-core for MySQL table and column builders
void/database-providerdefineDatabaseProvider and adapter types for void db connect --provider
void/dbdb (Drizzle D1, PostgreSQL, or MySQL instance for the active dialect), createDb, query operators (eq, and, or, desc, like, inArray, etc.)
void/seeddefineSeed, SeedContext, SeedFn for programmatic void db seed modules
void/kvkv, createKV, typed KV client/map types
void/storagestorage, createStorage for the inferred R2 binding or a specific R2Bucket
void/aiai, VoidAi, model input and response types
void/isrrevalidate(options) for on-demand ISR cache invalidation
void/loglogger structured logging helper
void/routesRouteMap and WebSocketRouteMap stubs (types only)
void/queuesqueues proxy for sending messages to typed queues
void/sandboxgetSandbox, 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 require .match({ ok, limited }); run() collects output through one matched operation. Container state lasts until inactivity (default ten minutes), a crash, or a restart. See Sandboxes for the API and deployment requirements.
void/envdefineEnv, env, schema helpers (string, number, boolean, url, email, oneOf, json), and global Cloudflare env types
void/sveltekitSvelteKit integration helpers: withVoidTSConfig() and mergeVoidSvelteKitTsconfig()