Skip to Content
DeploymentsDeploy from ZIP

Deploy from ZIP

Upload a ZIP with client.files.upload, pass the returned URL to deployments.create, then wait() for the build.

Upload the ZIP

Read or build a ZIP archive and upload it. Save the returned uploadUrl / upload_url for the next step.

deployFromZip.js
1
import { readFileSync } from "fs";
2
 
3
const zip = new Blob([readFileSync("app.zip")]);
4
const uploadUrl = await client.files.upload(zip, {
5
  onProgress: ({ percent }) => console.log("Upload %:", percent * 100),
6
});
7
// Should return: "https://storage.example.com/upload/abc123..."
8
console.log(uploadUrl);

Start a deployment

Pass uploadUrl / upload_url on deployments.create along with appName / app_name and owner. You get a buildId and QUEUED status immediately.

deployFromZip.js
1
const deployment = await client.deployments.create({
2
  appName: "my-zip-app",
3
  owner: "stackmachine",
4
  uploadUrl,
5
});
6
// Should return: {// { ... }
11
console.log(deployment.buildId, deployment.status);

Wait for the build

Call wait() on the deployment from step 2. Use onProgress / on_progress for build logs; the resolved app version includes the live URL.

deployFromZip.js
1
const appVersion = await deployment.wait({
2
  onProgress: ({ kind, message }) => console.log(kind, message),
3
});
4
// Should return: {// { ... }
8
console.log(appVersion.app.url);

Source: stackmachine/sdks  examples.