ViteHub is still experimental. Expect bugs and breaking changes.

Nitro and UnJS

Understand the narrow boundary between ViteHub, Nitro, and UnJS server runtimes.

ViteHub is not a Nitro module system. ViteHub uses Vite Integrations as the public integration layer, while package-owned Nitro wiring appears only where a host boundary needs generated runtime hooks.

Boundary

LayerViteHub expectation
VitePublic integration layer for discovery, generated files, the CLI Agent Dev Loop, and Provider Output.
NitroHost runtime bridge when a package must register generated handlers, middleware, or runtime hooks.
UnJS librariesUseful implementation dependencies for server primitives, not public ViteHub framework identity.
Application server codeCalls Runtime Helpers and stable handlers without importing generated Nitro internals.

Accepted Nitro handoffs

BridgeStatusOwnerPurpose
Schedule Provider WakeAvailableSchedule PackageRegisters Cloudflare scheduled runtime hooks and cron output for Nitro-shaped hosts.
Workspace hosted runtime setupAvailable where hosted stores require itWorkspace PackageMoves generated Workspace runtime setup into Nuxt's top-level Nitro config.
Database Nuxt D1 host wiringAvailable for Nuxt D1 host resourcesDatabase PackageKeeps one D1 Database Host Resource in sync with Nuxt Content and Cloudflare output.
General Nitro-first integrationNot the public directionNot applicableViteHub keeps the public contract on Vite Integrations.

Generated route output

Auth and Agent integrations generate Nitro handlers for their owned routes. Treat those files as Provider Output, not as a general Nitro Framework Integration or a public @vite-hub/*/nitro authoring surface.
OutputCurrent ownerBoundary
Auth route handlerAuth PackageExposes the configured Auth route through a generated Nitro handler.
Agent chat and webhook routesAgent PackageDispatches generated Agent route output without making Nitro discovery or route files the app API.

Package-owned handlers

The package Vite Integration reads the application Auth Definition and generates Nitro route output when route is enabled.

server/auth.ts
import { defineAuth } from '@vite-hub/auth'

export default defineAuth({
  appName: 'Acme',
  database: true,
})
vite.config.ts
import { hubAuth } from '@vite-hub/auth/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    hubAuth(),
  ],
})

What not to do

Do not treat Nitro route files as the primary ViteHub API. If a package generates Nitro output, inspect it as Provider Output and keep application code on the package's Runtime Helpers or stable server handler.

Next steps