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.
- 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.
- Sandbox lifecycle: a program creates, lists, and deletes sandboxes and prints the state of each. The output shows how a sandbox moves between states.
- Commands and files: a program runs a shell command in a sandbox, writes and reads files, and prints the results to the console.
- Image builds: a program builds an image from an inline Dockerfile and creates a sandbox from it. The Dockerfile is checked before it moves into an application.
- Shared data between sandboxes: a program attaches one volume to two sandboxes, writes a file in one, and reads it in the other.
- Operation sequences: a sequence of sandbox operations runs against the Daytona API and is checked before it goes into an application.
- 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.
Access from Dashboard
- Go to Daytona Dashboard ↗
- 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
- Go to Daytona Playground ↗ to access the playground.
- Click Run to compile the program and execute it in a web worker inside your browser.
- 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
| Example | Description |
|---|---|
| Hello sandbox | Create a sandbox, print its id and state, then delete it. |
| Lifecycle | Create, list and delete sandboxes; inspect state transitions. |
| Run a command | Execute a shell command inside a sandbox and read its output. |
| File operations | Write, list and read files in a sandbox via the toolbox file system API. |
| Snapshots | Create an image snapshot alias and launch a sandbox from it. |
| Build from a Dockerfile | Build an image snapshot from an inline Dockerfile, then launch a sandbox from it. |
| Volumes | Attach 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.