Cargo Hosting
Put something on the internet from Cargo — hosted web apps (Vite by default, other static frameworks detected) and serverless edge workers that answer HTTP requests, plus the deployments that build and promote them, the env vars and secrets a worker reads, running a worker locally, and custom domains and search indexing for public sites. Triggers: \"build me a dashboard for this\", \"host this app\", \"give me a URL to share\", \"deploy this\", \"I need a webhook endpoint\", \"make it live\", \"promote to production\", \"ship a UI for my team\", \"give my worker an API token\", \"set a secret on the worker\", \"Missing CARGO_API_TOKEN\", \"my app cannot call my worker\", \"run the worker locally\", \"put it on my own domain\", \"make the site indexable by Google\". Skip when: the app or worker should be declared as committed workspace code — use cargo-project.
- Skill ID
- getcargohq/cargo-skills/cargo-hosting
- Publisher
- getcargohq
- Repository
- cargo-skills
- Installs
- 0
- Files
- 7
- Requires
- Requires @cargo-ai/cli (npm). Sign in or create an account with `cargo-ai login --email` (emailed code, no browser), `--oauth`, or an API token
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
getcargohq/cargo-skills/cargo-hostingInstalls these files- SKILL.md
- references/examples/apps.md
- references/examples/deployments.md
- references/examples/workers.md
- references/response-shapes.md
- references/troubleshooting.md
- skill-metadata.json
What this skill tells the agent
Cargo CLI — Hosting
Cargo Hosting runs two kinds of workspace-scoped resources, plus the deployments that ship them:
- App — a static front end (a Vite single-page app by default; Next.js static export, Astro, SvelteKit, Nuxt, Gatsby and Create React App are detected too) served on its own subdomain (see URLs). The templates are built on
@cargo-ai/app-sdk(Vite + refine + shadcn primitives, withgetCargoEnv()/useCargoApi()wired to the workspace). - Worker — a serverless HTTP handler that runs on the edge (
fetch(request, env)), built on@cargo-ai/worker-sdk(auto OpenAPI 3.1 spec at/openapi.json, Swagger UI at/docs). - Deployment — one build+upload of a local source directory to an app or worker. A deployment is not live until it's promoted.
For organizing apps/workers into folders, use `cargo-workspace-management` (folder …). The--folder-uuidflags here consume those folder UUIDs.
Seereferences/examples/apps.md,references/examples/workers.md, andreferences/examples/deployments.mdfor end-to-end walkthroughs. Seereferences/response-shapes.mdfor JSON response structures. Seereferences/troubleshooting.mdfor common errors and how to fix them.
Bootstrap
Already signed in (cargo-ai whoami returns a workspace)? Skip to the next section.
npm install -g @cargo-ai/cli # no global install? prefix every command with `npx @cargo-ai/cli`
cargo-ai login --email you@company.com # emailed code, no browser; creates the account on first use
# alternatives: --oauth (browser) · --token <api-token> (CI)
cargo-ai whoami # confirm the active workspace before any writeEvery command prints JSON to stdout; failures exit non-zero with {"errorMessage": "..."}. Anything that creates a run or a batch is async — pass --wait-until-finished or poll the matching get. When the full skill bundle is installed, `../cargo/references/prerequisites.md` adds the CLI version pin, token scopes, and the admin-only surface.
The lifecycle
Apps and workers follow the same shape — scaffold → create slot → deploy → promote:
init (local scaffold) → create (slot + slug) → deployment create (build+upload) → deployment promote (go live)- Scaffold a local project from a template —
hosting app init <dir>/hosting worker init <dir>. - Create the slot in the workspace —
hosting app create --name --slug→appUuid(orworkerUuid). The--slugbecomes part of the subdomain and must be unique within the workspace. - (optional) Wire local dev — for an app,
hosting app env <appUuid>prints the.env.locallines a local copy needs (Cargo OAuth + workspace + app UUID + API URL). For a worker,npm run devin the scaffold (see Run a worker locally). A worker that calls the Cargo API also needs aCARGO_API_TOKENsecret before its first deploy (see Worker env vars and secrets). - Deploy —
hosting deployment create --app-uuid <uuid> --source <dir>uploads the source. The backend then builds it in a sandbox: for an app,npm ci --ignore-scriptsfollowed by the app's ownbuildscript, or the framework's default build if there is none (see App builds); for a worker, it bundles the entrypoint. Returns adeploymentUuid. - Promote —
hosting deployment promote --uuid <deploymentUuid>points the live URL at that build.
Deploys build asynchronously — poll `hosting deployment get <uuid>` until the status is terminal before promoting (see Async polling).
URLs
The live host is `<slug>-<first 8 chars of the workspace UUID>` under the hosting root domain, and apps and workers have different root domains — in production https://<slug>-<ws>.app.getcargo.run for an app, https://<slug>-<ws>.worker.getcargo.run for a worker. The workspace suffix is what makes the host globally unique, which is why a slug only has to be unique inside your workspace.
Don't build the URL by hand. Read url from create or get — the root domain differs per environment. Each deployment also gets a preview host, https://deployment-<deploymentUuid>.<root>, before it is promoted.
Because the roots differ, an app calling a worker is always a cross-origin request. No option serves them on the same origin, so the worker has to answer CORS. See the app + worker pattern in `references/examples/workers.md`.
Apps
# Discover
cargo-ai hosting app list # all apps (filter with --folder-uuid <uuid>)
cargo-ai hosting app get <uuid> # one app's details + URL
# Scaffold locally (Vite + @cargo-ai/app-sdk)
cargo-ai hosting app init ./my-app --list-templates # see available templates, then:
cargo-ai hosting app init ./my-app --template blank --name "My App"
# Create the slot (slug unique per workspace; `url` in the response is the live host)
cargo-ai hosting app create --name "My App" --slug my-app --folder-uuid <folder-uuid>
# Print .env.local for local development
cargo-ai hosting app env <app-uuid>
cargo-ai hosting app env <app-uuid> --api-url https://api.getcargo.io
# Update / remove
cargo-ai hosting app update --uuid <app-uuid> --name "Renamed"
cargo-ai hosting app update --uuid <app-uuid> --folder-uuid null # move to workspace root
cargo-ai hosting app remove <app-uuid> # also removes its deploymentsTemplates: blank (minimal starting point), territories-overview (read-only territories grid demoing useCargoApi() + react-query), and public-site (a public, indexable site that prerenders every route from its own build script and ships robots.txt + sitemap.xml). Run app init <dir> --list-templates for the current list.
App builds
If `package.json` declares a `build` script, Cargo runs it, and that script owns the whole build. Cargo runs nothing before or after it, so the script must produce the client bundle as well as anything extra, such as prerendered HTML. Without a build script, the detected framework's default command runs:
| Framework (detected from dependencies) | Default build | Output dir | Public env prefix |
|---|---|---|---|
| Vite, and anything undetected | vite build | dist | VITE_ |
| Next.js (static export) | next build | out | NEXT_PUBLIC_ |
| Astro | astro build | dist | PUBLIC_ |
| SvelteKit | svelte-kit build | build | PUBLIC_ |
| Nuxt | nuxt generate | .output/public | NUXT_PUBLIC_ |
| Gatsby | gatsby build | public | GATSBY_ |
| Create React App | react-scripts build | build | REACT_APP_ |
- Output must land in that framework's output directory and contain an `index.html`, or the build fails. Unknown paths fall back to that shell.
- Whatever the build script does now runs on every deploy. That includes a
tscpass, a different--mode, andprebuild/postbuildhooks. A script that fails there fails the deploy. The live deployment keeps serving, because promotion only follows a successful build. - A `build` script Cargo can't use falls back silently. That covers an unparseable
package.json, an empty script, or a non-string entry. The deploy still goes green, and only the build log says why, so check it when a prerender step seems to have been skipped. - Platform values are injected under every public prefix. A Vite app reads
VITE_CARGO_API_URLand a Next.js app readsNEXT_PUBLIC_CARGO_API_URL. When abuildscript is used, they are also passed as real process env vars, so a plain-Node prerender step sees them. User env values are redacted from build logs.
App env vars are public
More from getcargohq
Use this skill in a project
Open any RiverX project, search the Skills panel for getcargohq/cargo-skills/cargo-hosting, and install it in one click.
