ViteHub

ViteHub adds shared server-side primitives to Nitro. Start with one feature package, then enable database access, blob storage, cache, sandbox execution, workflows, crons, queues, and KV where your app needs them.

ViteHub keeps the runtime API small and moves provider-specific behavior into top-level feature config or the resolved handles returned by the runtime helpers. That keeps the code you write in routes, tasks, and server utilities stable even when you switch hosting.

Use three surfaces consistently:
  • @vitehub/<feature> for public primitives, types, and runtime helpers
  • @vitehub/<feature>/nitro for Nitro module registration
When your app already uses Nitro or Nuxt, you normally do not install nitro separately just for ViteHub.

Install the feature package

Pick the feature you need and install only that package. The @main tag tracks the latest successful preview publish for the main branch.

Terminal
pnpm add https://pkg.pr.new/nuxt-hub/agent/@vitehub/queue@main

Register the Nitro module

Use the Nitro module entrypoint for the feature you enabled.

nitro.config.ts
import { defineNitroConfig } from 'nitro/config'

export default defineNitroConfig({
  modules: ['@vitehub/queue/nitro'],
})

When your Nitro preset points at Cloudflare, Vercel, or Netlify, ViteHub infers the hosted queue provider automatically. Outside hosted presets, queue defaults to the in-memory provider. Set queue.provider only when you want a non-default local or hosted override.

Define a named resource

The file name under server/** becomes the public name you call later.

server/queues/welcome-email.ts
import { defineQueue } from '@vitehub/queue'

export default defineQueue(async (job) => {
  return {
    id: job.id,
    payload: job.payload,
    queued: true,
  }
})

Call the runtime helper

Import the public runtime helper and use the discovered name.

server/api/queue/welcome.post.ts
import { readBody } from 'h3'
import { runQueue } from '@vitehub/queue'

export default defineEventHandler(async (event) => {
  const body = await readBody<{ email?: string }>(event)

  return runQueue('welcome-email', {
    id: `welcome-${Date.now()}`,
    payload: {
      email: body.email,
    },
  })
})

Feature map

Getting Started
Learn how ViteHub fits into a Nitro app, from installation to shared server config.
Database
Add a Drizzle-first database layer with ViteHub-owned raw SQL and connection management.
Blob
Add blob storage with one SDK for local files, S3, Vercel Blob, and Cloudflare R2.
Cache
Configure cache storage with hosting-aware defaults for local, Vercel, and Cloudflare.
Sandbox
Run isolated sandboxes on Cloudflare, Vercel, Deno, or Docker.
Workflow
Run durable workflows and reconnect to them later.
Cron
Schedule recurring work and run the same handlers manually when needed.
Queue
Send queue jobs and reach for provider-native handles only when needed.
KV
Add key-value storage with pluggable backends and a small server API.
Package roots are the public API. Database usage also stays on @vitehub/db: use getDatabase() for raw SQL and db plus schema for Drizzle.