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 OutputPlannedViteHub does not yet emit one general Node deployment bundle for all primitives.

Use Runtime Helpers

Server code should call Runtime Helpers the same way it does in hosted apps. The provider or store choice belongs in package configuration.

server/api/settings.put.ts
import { kv } from '@vite-hub/kv'

export default defineEventHandler(async (event) => {
  await kv.set('settings', await readBody(event))
  return { ok: true }
})
vite.config.ts
import { hubKv } from '@vite-hub/kv/vite'
import { defineConfig } from 'vite'

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

Mount stable handlers manually

When a package exposes a stable server handler, mount that handler in the host instead of copying generated provider code. Generated host files remain implementation details unless the package reference marks them public.

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

export default defineAuth({
  appName: 'Acme',
  route: false,
})

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

Copyright © 2026