# Netlify

The `netlify` host deploys your app to Netlify. Support depends on the
package. ViteHub has Netlify output for Blob, generated Agent HTTP routes, and
static Schedule wake functions. Other primitives need an explicit remote
provider or are not available.

## Available boundaries

| Surface | Current contract |
| --- | --- |
| Blob | `hubBlob()` selects the `netlify-blobs` driver when the build reports Netlify hosting. Your code still uses `vite-hub/blob`. |
| Agent routes | `hubAgent()` writes one `vitehub-agent` function when hosted Agent Definitions exist. It mounts the standard chat dispatcher and webhook route. Route-enabled Channels pick which Agents answer chat requests. `routes.discordGateway` stays explicit. |
| Static schedules | `hubSchedule()` writes one scheduled Netlify function per static Schedule Definition. |
| Local proof | Pull-request CI runs a real-project fixture through Netlify CLI. |

The Agent function goes to `.netlify/v1/functions`, and its source wrapper to `.vitehub/agent/netlify-function.mjs`. Both are Provider Output (generated host files), not public imports.
In Nuxt, the wrapper follows Nuxt's build directory, normally `.nuxt/vitehub/agent/netlify-function.mjs`. The deployed function path does not change.

## Configure the host

Each package writes only its own Netlify output. This example adds the
Schedule integration with `providerOutput: 'standalone'`, so each static
Schedule Definition becomes a Netlify scheduled function. Install the package
first.

```bash [Terminal]
pnpm add @vite-hub/schedule
```

### Nuxt

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['vite-hub/nuxt'],
  vitehub: {
    host: 'netlify',
    agent: { invocations: false },
    blob: true,
    schedule: { providerOutput: 'standalone' },
  },
})
```

### Nitro

```ts [vite.config.ts]
import { defineConfig } from 'vite'
import { nitro } from 'nitro/vite'
import { vitehub } from 'vite-hub'

export default defineConfig({
  plugins: [
    vitehub({
      host: 'netlify',
      agent: { invocations: false },
      blob: true,
      schedule: { providerOutput: 'standalone' },
    }),
    nitro(),
  ],
})
```

### Vite

```ts [vite.config.ts]
import { defineConfig } from 'vite'
import { vitehub } from 'vite-hub'

export default defineConfig({
  plugins: [
    vitehub({
      host: 'netlify',
      agent: { invocations: false },
      blob: true,
      schedule: { providerOutput: 'standalone' },
    }),
  ],
})
```

The `netlify` host selects the Netlify Blobs driver and the Agent function output. Each static Schedule Definition becomes a function such as `.netlify/v1/functions/vitehub-schedule-heartbeat.mjs`.

The standalone Agent function does not install an app-wide Invocation journal. Set `agent.invocations: false` and configure `invocations` on each Agent Definition when records are needed. An omitted or configured app-wide journal fails with `VITE_HUB_R0132`.

## Generated functions

The build writes generated functions and wrappers to Netlify's directories.

The server function comes from Nitro's `netlify` preset, which writes `.netlify/v1/functions/server`. Netlify finds it without `netlify.toml` function settings or redirects. `.netlify/deployment.json` records the server entry.

```bash [Terminal]
pnpm build
find .netlify/v1/functions -maxdepth 2 -type f | sort
find .vitehub/agent -maxdepth 2 -type f | sort
```

In Nuxt, inspect the wrapper with `find .nuxt/vitehub/agent -maxdepth 2 -type f | sort`, or the same path under a custom `buildDir`.

## Features without a Netlify provider

- **Queue, Rate Limit, Sandbox, Workflow:** ViteHub picks no Netlify driver. `queue: true`, `rateLimit: true`, and `sandboxTask: true` fail the build. `sandboxTask: { driver: 'vercel' }` uses Vercel Sandbox with Vercel credentials. Workflow stays off when only `agent` turns it on. An explicit `workflow` option needs `workflow.driver`. Pick an external driver only when it works from the Netlify runtime.
- **Provisioning:** The ViteHub Provision CLI does not create Netlify resources. It accepts only Cloudflare and Vercel plans. Netlify Blobs stores need no provisioning; see [Resources without provisioning](https://vitehub.dev/docs/development/provisioning#resources-without-provisioning).
- **KV:** There is no Netlify KV output. Set a remote KV driver for deployed state. Do not rely on the local `fs-lite` fallback in a serverless deployment.
- **Workspace:** There is no Netlify hosted store. Set a durable remote Workspace store. The local filesystem fallback does not persist safely across serverless instances.

## Production proof

Netlify is [Experimental](https://vitehub.dev/docs/frameworks-hosts/support-matrix#test-status). CI on `main` builds one Agent app and sends one chat request to it through Netlify CLI. No CI run calls a primitive on Netlify, and there is no live Netlify test. Check the generated functions on your Netlify site before you call your setup production-ready.

## Next steps

- [Runtime and host support](https://vitehub.dev/docs/frameworks-hosts/support-matrix)
- [Provider output](https://vitehub.dev/docs/reference/provider-output)
- [Import paths](https://vitehub.dev/docs/reference/import-paths)

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

- [Choose a target](https://vitehub.dev/raw/docs/frameworks-hosts.md)
- [Frameworks](https://vitehub.dev/raw/docs/frameworks-hosts/nuxt.md)
- Deployment hosts
  - [Cloudflare](https://vitehub.dev/raw/docs/frameworks-hosts/cloudflare.md)
  - [Vercel](https://vitehub.dev/raw/docs/frameworks-hosts/vercel.md)
  - [Netlify](https://vitehub.dev/raw/docs/frameworks-hosts/netlify.md) (this page)
  - [Deno](https://vitehub.dev/raw/docs/frameworks-hosts/deno.md)
  - [Node and self-hosted](https://vitehub.dev/raw/docs/frameworks-hosts/node-self-hosted.md)
  - [Several Node instances](https://vitehub.dev/raw/docs/frameworks-hosts/node-instances.md)
  - [Production deployment](https://vitehub.dev/raw/docs/frameworks-hosts/production.md)
  - [Canonical redirects](https://vitehub.dev/raw/docs/frameworks-hosts/redirects.md)
  - [Sitemap and robots.txt](https://vitehub.dev/raw/docs/frameworks-hosts/sitemap.md)

Next: [Deno](https://vitehub.dev/raw/docs/frameworks-hosts/deno.md)

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