Back to Denoland

Promote Deno Sandbox to Deploy Apps

sandbox/promote.md

latest3.0 KB
Original Source

There may be times when a Deno Sandbox proves a concept or prototype that should live on as a first-class Deno Deploy app. Instead of rebuilding the codebase elsewhere, you can promote the sandbox directly using sandbox.deno.deploy().

Ephemeral compute vs Deploy apps

AspectDeno SandboxDeno Deploy Apps
LifetimeSeconds to minutesAlways-on, managed rollouts
Control planeProgrammatic via SDKDashboard + CI/CD
Use casesAgents, previews, untrusted codeProduction APIs, long-lived services
StateEphemeral (use volumes when needed)Durable deployments with KV, databases
ExposureexposeHttp()/exposeSsh() per sandboxCustom domains, TLS, routing built-in

Start in a sandbox to iterate quickly. Once the codebase stabilizes and needs 24/7 availability, promote it to a Deploy app where builds, rollouts, and observability are managed for you.

Promote with sandbox.deno.deploy()

When a sandbox proves the concept, you can turn it into an always-on Deploy app without rebuilding elsewhere. sandbox.deno.deploy() snapshots the current file system, carries over network policies, and provisions an app with a durable URL, observability, and team access.

<deno-tabs group-id="sandbox-sdk"> <deno-tab value="js" label="JavaScript" default>
tsx
await using sandbox = await Sandbox.create({ timeout: "10m" });
// ...build or scaffold your service...

const app = await sandbox.deno.deploy("ai-preview", {
  entrypoint: "server.ts",
});
console.log(`Promoted to Deploy app ${app.slug}`);
</deno-tab> <deno-tab value="python" label="Python">
py
from deno_sandbox import DenoDeploy

sdk = DenoDeploy()

with sdk.sandbox.create(timeout="10m") as sandbox:
  # ...build or scaffold your service...

  build = sandbox.deno.deploy("ai-preview", entrypoint="server.ts")
  print(f"Promoted to Deploy app, revision ID: {build.id}")
</deno-tab> <deno-tab value="python-async" label="Python (Async)">
py
from deno_sandbox import AsyncDenoDeploy

sdk = AsyncDenoDeploy()

async with sdk.sandbox.create(timeout="10m") as sandbox:
  # ...build or scaffold your service...

  build = await sandbox.deno.deploy("ai-preview", entrypoint="server.ts")
  print(f"Promoted to Deploy app, revision ID: {build.id}")
</deno-tab> </deno-tabs>

Reasons to promote:

  • Keep a sandbox experiment running for customer traffic with production SLAs.
  • Get TLS, custom domains, rollbacks, and traffic splitting handled for you.
  • Share observability (logs/traces/metrics) across the team via the Deploy UI.
  • Replace brittle hand-offs; the exact sandbox state becomes the deployed revision.

Use sandboxes for rapid, ephemeral work, then call sandbox.deno.deploy() when the code should live as a managed service.