Vercel

Sandbox

v0 runs your project inside an isolated Vercel Sandbox. The sandbox is a per-chat virtual machine that hosts your code, dev server, terminal, and agent tools.

Every chat in v0 runs inside its own sandbox: an isolated virtual machine that hosts your project files, runs the live preview you see in the chat, and executes the commands v0 takes on your behalf. State from one chat never leaks into another.

What the sandbox is

v0's sandbox is powered by Vercel Sandbox, a lightweight virtual machine that runs a full Node.js environment in seconds. It replaces the older browser-based preview, which couldn't run server code, API routes, or real database connections. Because the sandbox runs a real Node.js environment, the preview behaves the same way your project will once deployed to Vercel.

Where you see the sandbox

The sandbox surfaces in three places inside every chat:

  • Preview tab: your app running in the sandbox. The dev server inside the sandbox serves this URL.
  • Console panel: tabs for Logs (the dev server's output) and Terminal (a shell where you can run commands directly, in addition to anything v0 runs through its Bash tool).
  • Code editor: a built-in editor attached to the same filesystem, so edits from the editor, v0, or the terminal all read and write the same files.

What runs inside

Every sandbox includes:

  • Node.js, with pnpm, npm, yarn, and bun available out of the box. You can install any dependency your project needs.
  • A framework-aware dev server. v0 detects Next.js, Vite, and generic Node.js projects and starts the right command on the right port.
  • Environment variables from your project's Vars panel, available to both your app and any agent tool that runs in the sandbox.

This is the same environment v0's Bash tool and pre-installed agents operate in.

Isolation boundaries

Sandboxes are isolated along three axes:

BoundaryWhat it means
Per chatEach chat has its own sandbox. Files, env vars, and running processes never cross from one chat to another.
Per user or teamA sandbox belongs to the chat's owner. Other users can't reach it unless you share the chat.
From productionA sandbox is never the same machine as your deployed app. Deployments run on separate Vercel infrastructure with their own environment variables.

On top of these boundaries, Sandbox Network Policy controls which outbound hosts the sandbox is allowed to reach. The default is allow-all. Team owners configure this from team settings.

Lifecycle

v0 creates a sandbox the first time a chat needs one, for example when you generate code that needs a server or when you import a repo.

After that:

  • The filesystem persists between sessions for the same chat. Files you or v0 wrote remain when you come back later.
  • The sandbox stays alive while you're working in the chat, up to a 5-hour maximum per session.
  • The sandbox stops when idle and resumes on your next visit. You don't need to manually start or stop it.
  • Starting a new chat creates a new sandbox. State doesn't carry over from older chats unless you explicitly fork or import.

Learn how v0 runs commands inside the sandbox

On this page