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.
@vitehub/<feature> for public primitives, types, and runtime helpers@vitehub/<feature>/nitro for Nitro module registrationnitro separately just for ViteHub.Pick the feature you need and install only that package. The @main tag tracks the latest successful preview publish for the main branch.
pnpm add https://pkg.pr.new/nuxt-hub/agent/@vitehub/queue@main
Use the Nitro module entrypoint for the feature you enabled.
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.
The file name under server/** becomes the public name you call later.
import { defineQueue } from '@vitehub/queue'
export default defineQueue(async (job) => {
return {
id: job.id,
payload: job.payload,
queued: true,
}
})
Import the public runtime helper and use the discovered name.
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,
},
})
})
@vitehub/db: use getDatabase() for raw SQL and db plus schema for Drizzle.