# Frameworks and hosts

Pick one framework integration and one deployment host. A host is a named target, such as `node` or `cloudflare`. At build time, ViteHub finds your Definitions and writes the files and bindings that the host needs. Your code keeps ViteHub imports, not generated paths or provider SDKs.

## Choose a framework

| Framework | Register | Guide |
| --- | --- | --- |
| Vite | `vitehub()` from `vite-hub`. It includes Nitro's Vite plugin. | [Installation](https://vitehub.dev/docs/getting-started/installation) |
| Nuxt | The `vite-hub/nuxt` module, on Nuxt 4.7 with `nitro` and ViteHub 0.5.1 or newer, or on Nuxt 5 | [Nuxt](https://vitehub.dev/docs/frameworks-hosts/nuxt) |

Both build the server output with Nitro.
[Nitro and UnJS](https://vitehub.dev/docs/frameworks-hosts/nitro-unjs) explains where ViteHub
packages register Nitro handlers. To move a Nuxt app off NuxtHub, read
[Migrate from NuxtHub](https://vitehub.dev/docs/compare/nuxthub#migrate-from-nuxthub).

## Choose a host

`host` sets the target host, the Nitro preset, and each feature's default provider. Without it, ViteHub detects the host in this order:

1. `VITEHUB_HOST`
2. `NITRO_PRESET`, then `SERVER_PRESET`
3. Build variables that the host sets and Nitro reads: `WORKERS_CI` on Cloudflare Workers Builds, `NETLIFY`, `NOW_BUILDER`, `VERCEL` or `VERCEL_ENV`, then `DENO_DEPLOY` or `DENO_DEPLOYMENT_ID`
4. `node` when none is set

If you set `host` and a variable from step 3 names a different host, the production build fails with [`VITE_HUB_HOST_PROVIDER_CONFLICT`](https://vitehub.dev/docs/development/diagnostics/vite_hub_host_provider_conflict), and dev prints a warning once. Remove `host`, or set `VITEHUB_HOST` to build for another host on purpose.

ViteHub does not detect Cloudflare Pages because the `cloudflare` host builds a Worker. To set host-specific options, call `detectHost()` from `vite-hub`:

### Nuxt

```ts [nuxt.config.ts]
import { detectHost } from "vite-hub";

const host = detectHost() ?? "node";

export default defineNuxtConfig({
  modules: ["vite-hub/nuxt"],
  vitehub: { host, schedule: true },
});
```

### Nitro

```ts [vite.config.ts]
import { detectHost, vitehub } from "vite-hub";
import { defineConfig } from "vite";
import { nitro } from "nitro/vite";

const host = detectHost() ?? "node";

export default defineConfig({
  plugins: [vitehub({ host, schedule: true }), nitro()],
});
```

### Vite

```ts [vite.config.ts]
import { detectHost, vitehub } from "vite-hub";
import { defineConfig } from "vite";

const host = detectHost() ?? "node";

export default defineConfig({
  plugins: [vitehub({ host, schedule: true })],
});
```

`detectHost()` returns `undefined` when no variable names a host, so your config can fall back to `"node"`.

| Host | Guide | Production output | Default providers | Rejected when enabled with `true` |
| --- | --- | --- | --- | --- |
| `node` | [Node and self-hosted](https://vitehub.dev/docs/frameworks-hosts/node-self-hosted) | `.output/server/index.mjs` | Blob `fs`, KV `database` with Postgres or `fs-lite`, Queue `postgres` with Postgres or `local`, Rate Limit `kv` with shared KV or `memory`, Schedule `process` | Sandbox |
| `cloudflare` | [Cloudflare](https://vitehub.dev/docs/frameworks-hosts/cloudflare) | `.output/server/wrangler.json` | Blob R2, KV Workers KV, Queue, Rate Limit, and Sandbox on Cloudflare | None |
| `vercel` | [Vercel](https://vitehub.dev/docs/frameworks-hosts/vercel) | `.vercel/output/**` | Blob Vercel Blob, KV Upstash Redis, Vercel Queues, Vercel Sandbox | Rate Limit, Realtime |
| `netlify` | [Netlify](https://vitehub.dev/docs/frameworks-hosts/netlify) | `.netlify/**` | Blob Netlify Blobs | Agent, Queue, Rate Limit, Realtime, Sandbox |
| `deno` | [Deno](https://vitehub.dev/docs/frameworks-hosts/deno) | `.output/main.ts` with static Schedules, otherwise `.output/server/index.mjs` | KV Deno KV, Schedule `Deno.cron` | Blob, Queue, Rate Limit, Realtime, Sandbox |

- A rejected feature fails the build instead of falling back to another provider.
- On `node`, `schedule: true` runs Schedules in the server process. Set
  `schedule: { providerOutput: false }` to wake them yourself.
  On `netlify`, Agent needs `agent: { invocations: false }`.
- Realtime fails on `vercel`, `netlify`, and `deno` only when the app has Realtime Definitions.
- Browser requires the `cloudflare` host.
- `email: true` uses Cloudflare Email on `cloudflare`. On other hosts, `vite dev` logs each message and production builds fail until you set `email.driver`.
- Blob without an explicit store requires a host with a Blob provider.
- KV without an explicit driver uses Upstash Redis on every host except `deno` when `KV_REST_API_URL` and `KV_REST_API_TOKEN` are set at build time.
- ViteHub sets the Nitro preset. The build fails if `nitro.preset`, `NITRO_PRESET`, or `SERVER_PRESET` names a different one.

The [support matrix](https://vitehub.dev/docs/frameworks-hosts/support-matrix) lists every primitive on every host, with explicit provider choices.

## Keep runtime imports stable

Import server APIs from documented ViteHub paths so the same code runs on every host. Do not import framework virtual modules or generated files unless a reference page marks the path public.

```ts [server/settings.ts]
import { kv } from 'vite-hub/kv'

export async function saveSettings(settings: Record<string, unknown>) {
  const [error] = await kv.set('settings', settings)
  if (error) throw error
}
```

Libraries can register one `hubX()` integration from its `@vite-hub/*/vite` package instead of `vitehub()`.

## Inspect the output

Development checks discovery and local generation. A production build writes the output for the host. List the generated host files with the CLI:

```bash [Terminal]
pnpm build
pnpm vitehub inspect output
```

## Next steps

- Read [Production deployment](https://vitehub.dev/docs/frameworks-hosts/production) before you serve traffic.
- Use [Provider output](https://vitehub.dev/docs/reference/provider-output) for generated host artifacts.
- Use [File conventions](https://vitehub.dev/docs/reference/file-conventions) for discovery paths.
- Use [Local development](https://vitehub.dev/docs/development) for local checks.

<!-- vitehub-docs:section-links -->
## In this section

- Choose a target
  - [Overview](https://vitehub.dev/raw/docs/frameworks-hosts.md) (this page)
  - [Support matrix](https://vitehub.dev/raw/docs/frameworks-hosts/support-matrix.md)
- [Frameworks](https://vitehub.dev/raw/docs/frameworks-hosts/nuxt.md)
- [Deployment hosts](https://vitehub.dev/raw/docs/frameworks-hosts/cloudflare.md)

Next: [Support matrix](https://vitehub.dev/raw/docs/frameworks-hosts/support-matrix.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
