Skip to content

Deploy a website

Let an AI agent deploy a static website to a public URL: pack a folder, deploy it with the Dexto CLI or MCP, and update it later. No hosting account needed.

A Dexto Site is a website in your Cloud project, served at https://<slug>.sites.dexto.ai. An agent can deploy one from a folder of files and redeploy it later; each deploy goes live unless you ask for a preview first.

dexto cloud sites deploy runs the folder’s own packer, .dexto/pack.mjs, which writes the deploy request. A static site needs nothing more than this packer, which sends everything under public/:

// .dexto/pack.mjs: packs ./public into a Site deploy request.
import { readdir, readFile, writeFile } from "node:fs/promises";
import path from "node:path";
const dir = path.resolve(process.argv[2] ?? ".");
const out = process.argv[process.argv.indexOf("--out") + 1];
const root = path.join(dir, "public");
const types = {
".html": "text/html",
".css": "text/css",
".js": "text/javascript",
".svg": "image/svg+xml",
".png": "image/png",
};
const files = await readdir(root, { recursive: true, withFileTypes: true });
const assets = await Promise.all(
files
.filter((file) => file.isFile())
.map(async (file) => {
const full = path.join(file.parentPath, file.name);
return {
path: path.relative(root, full).split(path.sep).join("/"),
mediaType: types[path.extname(full)] ?? "application/octet-stream",
contentBase64: (await readFile(full)).toString("base64"),
};
}),
);
await writeFile(
out,
JSON.stringify({
schemaVersion: 1,
runtime: { kind: "static" },
slug: "status-page",
title: "Status",
visibility: "public",
entrypoint: "index.html",
assets,
}),
);

Change slug to the name you want in the URL. Then deploy:

Terminal window
dexto cloud sites deploy .
dexto cloud sites list

The deploy prints the Site and its live URL. Run it again to publish a new version. To check a version before it goes live, deploy with --no-promote; the result names the command that makes it live. Without a .dexto/pack.mjs, the CLI runs the folder’s pack script instead.

dexto_site_publish publishes files as a link, and dexto_site_deploy deploys a Site as you; dexto_sites_list and dexto_site_get read them. Both deploy tools are at the approve level: your client asks you, and the call carries confirm: true only after you agree. Deploying into a Cloud project, as above, stays with the CLI and the API.

POST /v1/sites/deployments takes the same request the packer writes:

Terminal window
node .dexto/pack.mjs . --out site.json
curl -X POST "https://api.dexto.ai/v1/sites/deployments?promote=true" \
-H "Authorization: Bearer $DEXTO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @site.json

See the Sites API for data collections, previews and promotion.

A Site holds up to 25 MiB of static files. A slug is taken by the first Site that uses it; dexto cloud sites delete frees it again, after your person agrees.