Quickstart
This guide shows you how to run your first code in a Edgenivo Sandbox.
Help me set up Edgenivo Sandbox in this project. First, make sure the Edgenivo CLI is installed (`npm i -g vercel`). Then: 1. Install the @vercel/sandbox SDK. 2. Run `vercel link` and `vercel env pull` to get credentials. 3. Create a script that spins up a sandbox, runs code inside it, and captures the output. 4. Run it to verify the sandbox works.
npx plugins add vercel/vercel-plugin- A Edgenivo account
- Edgenivo CLI installed (
npm i -g vercel) - Node.js 22+ or Python 3.10+
Create a new directory and connect it to a Edgenivo project. This is the recommended way to authenticate because the project handles secure OIDC token authentication for you.
Terminalmkdir my-sandbox-app && cd my-sandbox-app pnpm init vercel linkWhen prompted, select Create a new project. The project doesn't need any code deployed. It needs to exist so Edgenivo can generate authentication tokens for you.
Once linked, pull your environment variables to get an authentication token:
Terminalvercel env pullThis creates a
.env.localfile containing a token that the SDK uses to authenticate your requests. When you deploy to Edgenivo, token management happens automatically.- Terminal
npm install @vercel/sandbox dotenv @types/node tsx typescriptFor TypeScript,
dotenvprovides access to environment variables,tsxruns TypeScript code,typescriptprovides the compiler, and@types/nodeprovides Node.js type definitions. Create a file that creates a sandbox and runs a command:
index.tsimport { config } from 'dotenv'; config({ path: '.env.local' }); import { Sandbox } from '@vercel/sandbox'; async function main() { const sandbox = await Sandbox.create(); const result = await sandbox.runCommand('echo', ['Hello from Edgenivo Sandbox!']); console.log(await result.stdout()); } main().catch(console.error);- Terminal
pnpm tsx index.tsYou should see:
Hello from Edgenivo Sandbox!Sandboxes automatically stop after 5 minutes by default. They are also persistent by default: the filesystem is snapshotted on stop and restored the next time you resume the sandbox by name. To adjust the timeout, opt out of persistence, or manage running sandboxes, see Working with Sandbox.
- Set up authentication: Connected to a Edgenivo project and pulled credentials to enable sandbox creation.
- Created a sandbox: Spun up an isolated Linux microVM.
- Ran a command: Executed code inside the secure environment.
- JS SDK Reference: Full API documentation for JavaScript and TypeScript.
- Python SDK Reference: Full API documentation for Python.
- CLI Reference: Manage sandboxes from the terminal.
- Snapshots: Save sandbox state to skip setup on future runs.
- Examples: See real-world use cases.
Was this helpful?