ViteHub is still experimental. Expect bugs and breaking changes.

Node and self-hosted

Use ViteHub Runtime Helpers in Node-shaped hosts without pretending every primitive has unified self-hosted output.

Node and self-hosted runtimes can use ViteHub server primitives when the package exposes host-neutral Runtime Helpers or stable server handlers. Unified self-hosted Provider Output is not the default contract for every package.

What works today

SurfaceStatusBoundary
Runtime Helpers in server codeAvailable per packageUse the package root or runtime subpath imports.
Local filesystem and memory providersAvailable where a primitive supports themUseful for development and simple self-hosted setups.
Stable server handlersAvailable per packageMount the handler the package marks stable, such as Auth server behavior.
Unified self-hosted Provider OutputNot providedViteHub does not emit one general Node deployment bundle for all primitives.

Runtime Helper boundary

Server code calls the same Runtime Helpers used in hosted applications. The provider or store choice remains in package configuration.

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
}
vite.config.ts
import { hubKv } from '@vite-hub/kv/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    hubKv(),
  ],
  kv: {
    driver: 'fs-lite',
    base: '.vitehub/data/kv',
  },
})

Auth handler boundary

The Auth Package exposes a stable server handler that a Node framework can mount through its request API. The handler comes from the application Definition; generated host files remain implementation details unless the package reference marks them public.

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

const definition = defineAuth({
  appName: 'Acme',
  route: false,
})

export const handleAuth = createAuthHandler(definition)

handleAuth accepts a Web Request and returns a Promise<Response>. Adapt that handler at the Node framework boundary instead of importing a generated Nitro route.

Production notes

Self-hosted deployments must make durability explicit. Memory providers and single-process local state are development providers, not production coordination systems.

Use Server Env for runtime secrets, configure durable stores for stateful primitives, and add verification that starts the deployed Node process rather than only typechecking package code.

Next steps