Vercel Sandbox

Configure Vercel Sandbox and run isolated sandboxes on Vercel.

Vercel Sandbox fits Vercel-hosted apps that want isolated execution without adding a second platform. ViteHub keeps the public sandbox API stable and forwards runtime settings to Vercel where they matter.

Before you start

Install the Vercel SDK alongside @vitehub/sandbox.

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

Configure Vercel

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@vitehub/sandbox/nuxt'],
  sandbox: {
    runtime: 'node22',
  },
})

Vercel hosting picks the sandbox provider automatically. Set app-wide defaults in top-level sandbox config. Override them per sandbox only when one sandbox needs different runtime limits.

Define a sandbox

Sandbox definitions accept only portable options (timeout, env, runtime). Set Vercel-specific options such as cpu, ports, source, and networkPolicy in the top-level sandbox config.

server/sandboxes/release-notes.ts
import { defineSandbox } from '@vitehub/sandbox'

export default defineSandbox(async (payload?: { notes?: string }) => {
  return { notes: payload?.notes || '' }
}, {
  timeout: 60_000,
})

What changes on Vercel

ConcernBehavior
Runtime defaultsConfigure app-wide defaults such as runtime, timeout, cpu, and ports in top-level sandbox config.
Provider optionsSet cpu, ports, source, and networkPolicy in the top-level sandbox config, not in defineSandbox().
Execution modelViteHub resolves the named sandbox and asks Vercel to run it inside Vercel's sandbox runtime.
Choose Vercel when you want hosted isolation with minimal extra setup in a Vercel deployment. The provider page handles the runtime details while runSandbox() stays the same.