What is Daytona?
Everything in Daytona belongs to an organization, and you reach it only through Daytona’s API, with a key whose permissions Daytona checks.
Take one small app: a Worker gives each user a sandbox, booted from the Base snapshot, with that user’s volume as their home.
Organizations: the boundary around everything
Section titled “Organizations: the boundary around everything”An organization holds your sandboxes, snapshots, volumes, secrets and API keys, the people who may use them, and the bill. Nothing in one organization can see another’s.
You sign in to Daytona once, and pick the organization your profile deploys to:
pnpm alchemy profile edit --add Daytonabun alchemy profile edit --add Daytonanpx alchemy profile edit --add Daytonayarn alchemy profile edit --add DaytonaSee Organizations and API keys.
API keys: permissions per kind of object
Section titled “API keys: permissions per kind of object”Every call to Daytona carries an API key. A key belongs to one organization and holds permissions per kind of object: write:sandboxes lets it create any sandbox in the organization, manage:secrets any secret.
Each binding creates a key of its own for its Worker or Lambda, with only the permissions its calls need:
const sandboxes = yield* Daytona.CreateSandbox(Base);See Organizations and API keys.
Regions and runners: where sandboxes run
Section titled “Regions and runners: where sandboxes run”A region is where sandboxes run, such as us or eu. Inside it, runners are the machines that host sandboxes. Daytona runs shared regions for everyone, and you can add a region of your own and run its runners on your machines. A sandbox picks its region with target:
export const DevBox = Daytona.Sandbox("DevBox", { snapshot: Base, target: "eu" });See Regions and runners.
Snapshots: the image and size a sandbox boots with
Section titled “Snapshots: the image and size a sandbox boots with”A snapshot is the image a sandbox boots from, plus its size: CPU, memory, disk and GPUs. Daytona builds it from an image, a Dockerfile, or another snapshot with commands run in it.
export const Base = Daytona.Snapshot("Base", { image: "node:22-bookworm-slim", cpu: 1, memory: 1, disk: 3 });See Snapshots.
Sandboxes: stop, archive, start again
Section titled “Sandboxes: stop, archive, start again”A sandbox moves through four states, and its disk survives all but the last:
Create sandboxes per request or per user from a Worker, or declare a long-lived one in your Stack. See Sandboxes.
The toolbox: the API inside every sandbox
Section titled “The toolbox: the API inside every sandbox”The toolbox is the API inside every sandbox. Alchemy hands you a sandbox as a handle with all of it:
const result = yield* sandbox.exec("npm test", { cwd: "/home/daytona/repo" });See Toolbox.
Previews: a URL for each port
Section titled “Previews: a URL for each port”A preview URL reaches a port inside a sandbox from outside, through Daytona’s proxy. It needs the sandbox’s preview token unless the sandbox is public. A port’s fetch sends the token for you:
const port = yield* sandbox.getTcpPort(3000);const res = yield* port.fetch(HttpClientRequest.get("/health"));See Network and previews.
Volumes: files that outlive the sandbox
Section titled “Volumes: files that outlive the sandbox”A volume is a persistent disk, backed by object storage, that sandboxes mount at a path. Its files outlive every sandbox that mounts it, so a user’s home can survive their sandbox.
export const Cache = Daytona.Volume("Cache", {});See Volumes.
Network limits: what a sandbox can reach
Section titled “Network limits: what a sandbox can reach”Daytona controls what a sandbox can reach, outside the sandbox. Your organization’s tier sets the default: below Tier 3, sandboxes reach only an allowlist of essential services, such as package registries, GitHub and AI APIs. On top of that, a sandbox can allow only some domains or ranges, or no network at all:
export const DevBox = Daytona.Sandbox("DevBox", { snapshot: Base, domainAllowList: ["github.com"] });See Network and previews.
Secrets: values a sandbox uses but can’t read
Section titled “Secrets: values a sandbox uses but can’t read”A secret is a value a sandbox can use but not read. The sandbox sees a placeholder, and Daytona’s egress proxy swaps in the real value only on requests to the hosts you name:
export const NpmToken = Daytona.Secret("NpmToken", { value: Config.Redacted("NPM_TOKEN"), hosts: ["registry.npmjs.org"],});See Secrets.
State: where Alchemy keeps its record
Section titled “State: where Alchemy keeps its record”Daytona has no storage for Alchemy’s own record of what each Stack created. Keep it on disk with Alchemy.localState(), or share it with your team and CI through Cloudflare.state() or AWS.state().
How @alchemy.run/daytona models these concepts
Section titled “How @alchemy.run/daytona models these concepts”Snapshots, volumes, secrets, registries, warm pools, regions, runners, roles and organization settings are resources you declare in a Stack. A sandbox is a resource too when it should live as long as the Stack, like a dev box, or a sandbox that runs a program you write. Sandboxes, volumes, secrets and snapshots that come and go per request or per user are created at runtime through bindings (CreateSandbox, CreateVolume, CreateSecret, CreateSnapshot), each with its own API key. Your profile signs you in to Daytona and picks the organization.
Next, build one: set up your profile, then the tutorial puts these ideas to work, one step at a time.