---
url: https://void.cloud/reference/api.md
description: >-
  Look up public imports, signatures, and return types. The guides cover setup
  and examples.
---

# API Reference {#api-reference}

Use this reference to find public imports, signatures, and return types. For setup and examples, start with the [guides](../guide/index.md).

## API Topics

| Topic                                              | Use it for                                                      |
| -------------------------------------------------- | --------------------------------------------------------------- |
| [Plugin and configuration](./api/plugin.md)        | Add Void to Vite and configure your app.                        |
| [Handlers and middleware](./api/handlers.md)       | HTTP routes, validation, scheduled jobs, queues, and rendering. |
| [Rewrites](./api/rewrites.md)                      | Serve another route while keeping the requested URL.            |
| [Authentication](./api/auth.md)                    | Sessions, users, and the auth client.                           |
| [Fetch client](./api/client.md)                    | Typed requests and errors.                                      |
| [Durable State and WebSockets](./api/durable.md)   | Persistent objects and typed connections.                       |
| [Database and seeding](./api/database.md)          | Queries, operators, and seed scripts.                           |
| [KV, storage, AI, and logging](./api/resources.md) | Resource clients, cache revalidation, and logs.                 |
| [Deployment artifacts](./api/deploy.md)            | Package built apps for managed deployment.                      |
| [Types](./api/types.md)                            | Typed URLs, route types, handler context, and head metadata.    |
| [Environment variables](./api/env.md)              | Validated environment values and binding types.                 |
| [Pages adapters](./api/pages.md)                   | React, Vue, Svelte, Solid, and Markdown.                        |

## User-Facing Imports {#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`](https://orm.drizzle.team/docs/zod) for schema-derived Zod validators for Drizzle tables                                                                                                                                                                                                                                                                                                                                                             |
| `void/drizzle-valibot`    | Re-exports [`drizzle-valibot`](https://orm.drizzle.team/docs/valibot) for schema-derived Valibot validators for Drizzle tables                                                                                                                                                                                                                                                                                                                                                 |
| `void/drizzle-arktype`    | Re-exports [`drizzle-arktype`](https://orm.drizzle.team/docs/arktype) for schema-derived ArkType validators for Drizzle tables                                                                                                                                                                                                                                                                                                                                                 |
| `void/schema-d1`          | Re-exports [`drizzle-orm/sqlite-core`](https://orm.drizzle.team/docs/column-types/sqlite) for D1 table and column builders                                                                                                                                                                                                                                                                                                                                                     |
| `void/schema-pg`          | Re-exports [`drizzle-orm/pg-core`](https://orm.drizzle.team/docs/column-types/pg) 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`             | [`routeUrl()`](./api/types.md#routeurl-path-options), `RouteDestination`, `RoutePath`, `RouteOptions`, `RouteUrl`, `Href`, `RouteUrlInput`, and generated route maps                                                                                                                                                                                                                                                                                                           |
| `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](../guide/email.md).                                                                                                                                                                                                                                                                                     |
| `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](../guide/sandboxes.md) 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()`                                                                                                                                                                                                                                                                                                                                                                                         |
