Skip to content

Part 4: Stages

Terminal window
alchemy deploy --stage staging

Each stage gets its own template and Worker, named after the stage. Without --stage, you deploy to live_$USER.

Stages share your E2B team. Sandboxes a stage’s Worker creates carry the stage in their metadata (alchemy::stage), so you can list one stage’s sandboxes without touching another’s:

const staging = yield* sandboxes.list({ metadata: { "alchemy::stage": "staging" } });

Destroying a stage leaves its sandboxes running until they time out.

Volumes and templates you create at runtime have no metadata. Delete them when their owner goes away, as the example’s DELETE /users/:user route does.

Part 5 deploys from CI.