Sign Up

Playground

Write and run TypeScript against the Daytona SDK in your browser.

Daytona provides an interactive environment ("playground") in the Daytona Dashboard ↗ for writing TypeScript against the TypeScript SDK and running it in your browser. It bundles the SDK and provides a code editor with type checking and completions, an examples browser, and a console for program output. You do not install anything locally or handle an API key.

Use cases

The playground is used to run TypeScript SDK code without a local setup.

  • SDK trials. SDK calls run in a web worker inside the browser. The playground provides the API key and endpoints, so there is nothing to install or configure. The Run button compiles the program and executes it in that web worker.

  • Learning the SDK. The editor checks types and completes names from the SDK's type definitions. A new user sees the available methods and their parameters while writing the code. Programs are plain TypeScript that import the Daytona SDK, and top-level await is supported.

  • Commands and files. A program runs a shell command in a sandbox, writes and reads files, and prints the results to the console. The Run a command and File operations examples show both tasks. File reads and writes go through the toolbox file system API.

  • Operation sequences. A sequence of sandbox operations runs against the Daytona API and is checked before it goes into an application. A stopped run does not clean up the sandboxes it already created. Any sandbox created mid-run can still exist after the stop, and a delete removes it.

  • Starting points. A curated example runs as it is, then changes, then moves into your own application. The examples cover the sandbox lifecycle, commands, files, images, and volumes. A Snapshots example creates a sandbox snapshot and launches a second sandbox from it.

Access from Dashboard

  1. Go to Daytona Dashboard ↗
  2. Click Playground in the sidebar to access the playground

Writing code

Programs are plain TypeScript that import the Daytona SDK. Top-level await is supported, and the editor provides type checking and completions from the SDK's type definitions.

import { Daytona } from '@daytona/sdk'

// The playground provides the API key and endpoints for you — no config needed.
const daytona = new Daytona()

async function main() {
  console.log('Creating a sandbox…')
  const sandbox = await daytona.v2.create()
  console.log('Sandbox ready:', sandbox.id, '(', sandbox.state, ')')

  console.log('Cleaning up…')
  await daytona.v2.delete(sandbox)
  console.log('Done.')
}

await main()

Running code

  1. Go to Daytona Playground ↗ to access the playground.
  2. Click Run to compile the program and execute it in a web worker inside your browser.
  3. Click Stop to terminate a run in progress. Stopping a run does not clean up resources it already created. Any sandbox created mid-run may still exist — delete it if needed.

Examples

ExampleDescription
Hello sandboxCreate a sandbox, print its id and state, then delete it.
LifecycleCreate, list and delete sandboxes; inspect state transitions.
Run a commandExecute a shell command inside a sandbox and read its output.
File operationsWrite, list and read files in a sandbox via the toolbox file system API.
SnapshotsCreate a sandbox snapshot and launch a second sandbox from it.
Build from a DockerfileBuild an image from an inline Dockerfile, then launch a sandbox from it.
VolumesAttach a persistent volume to two sandboxes: write a file in one, read it in the other.

For more information on the operations used in the examples, see sandboxes, process execution, code execution, file system operations, snapshots, and volumes.