Skip to content
HostStack Docs

CLI Reference

The HostStack CLI lets you drive every dashboard action from a terminal — ideal for scripts, CI steps, and local development.

Installation

npm
npm install -g @hoststack.dev/cli
bun
bun add -g @hoststack.dev/cli

Requires Node 18+ or Bun 1.1+.

Authentication

Mint an API key at Settings → API Keys in the dashboard, then persist it on this machine. The CLI stores the key at ~/.hoststack/config.json with file mode 0600. You can also export HOSTSTACK_API_KEY instead — env vars take precedence over the config file.

bash
hoststack login --key hs_live_your_api_key
hoststack whoami

Use hs_test_… keys against a test team for staging / CI; hs_live_… keys carry full-access permissions on the production team. Pass --url to login to authenticate against a self-hosted HostStack control plane.

Command Reference

Authentication

CommandUsageDescription
hoststack loginhoststack login --key hs_live_... [--url https://api.example.com]Authenticate and persist the API key locally
hoststack whoamihoststack whoamiShow the current user, team, and API endpoint

Projects

CommandUsageDescription
hoststack projects listhoststack projects list [--json]List all projects in the active team
hoststack projects createhoststack projects create --name "My Project" [--description "..."] [--region eu-central-1]Create a new project
hoststack projects deletehoststack projects delete <project-id>Delete a project

Services

CommandUsageDescription
hoststack services listhoststack services list [--json]List services across all projects
hoststack services gethoststack services get <service-id>Show service details
hoststack services createhoststack services create --name my-app --type <web_service|private_service|worker|cron_job|static_site> --project <project-id|prj_…>Create a new service
hoststack services deletehoststack services delete <service-id>Delete a service
hoststack services scalehoststack services scale <service-id> <min[:max]>Scale to N replicas
hoststack services suspendhoststack services suspend <service-id>Suspend a service (keep its data, stop traffic)
hoststack services resumehoststack services resume <service-id>Resume a suspended service

Dev environments

CommandUsageDescription
hoststack dev newhoststack dev new [--name <name>] [--github-id <n> | --repo <git-url>] [--branch <name>] [--db postgres,redis,meilisearch] [--plan <size>]Create a standalone dev box in the team Development area — from a connected GitHub repo, any clone URL, or blank. --db attaches fresh companion databases alongside it.
hoststack dev listhoststack dev listList your dev environments and their companion services (alias: ls)
hoststack dev createhoststack dev create --project <project-id|prj_…> [--name <name>] [--size <plan>] [--disk <gb>] [--repo <git-url>] [--branch <name>] [--hoststack-key <key>] [--poststack-key <key>] [--env KEY=VALUE] [--no-deploy]Create a dev box inside a project. --repo is cloned into /workspace on first boot; --no-deploy creates and configures it without firing that deploy.
hoststack dev create --servicehoststack dev create --service <service-id|svc_…> [--no-db] [--name <name>]Spin up a dev box from an existing service: a clone of the app with its env vars, its linked database cloned (unless --no-db), and its own dev URL.
hoststack dev deletehoststack dev delete <service-id|svc_…>Tear a dev box down together with its cloned database and /workspace volume (alias: rm)

Deploys

CommandUsageDescription
hoststack deploy triggerhoststack deploy trigger <service-id> [--commit <hash>] [--branch <name>] [--clear-cache]Trigger a new deploy
hoststack deploy listhoststack deploy list <service-id> [--json]List recent deploys for a service
hoststack deploy logshoststack deploy logs <service-id> <deploy-id> [--json]Print build logs for a specific deploy
hoststack deploy cancelhoststack deploy cancel <service-id> <deploy-id>Cancel an in-progress deploy
hoststack deploy rollbackhoststack deploy rollback <service-id> <deploy-id>Roll back the service to a previous deploy

Environment Variables

CommandUsageDescription
hoststack env listhoststack env list <service-id>List variables on a service (secret values are masked)
hoststack env sethoststack env set <service-id> KEY=VALUE [--secret|--no-secret] [--target build|runtime|both]Create or update a single variable (upsert by key). Use --secret/--no-secret to set its secret status and --target to control where it is injected.
hoststack env gethoststack env get <service-id> <KEY>Get a single variable (secret values are masked)
hoststack env deletehoststack env delete <service-id> <KEY|env-var-id>Delete a variable by its KEY or numeric env-var id
hoststack env bulkhoststack env bulk <service-id> KEY1=VAL1 KEY2=VAL2 ... [--secret] [--target build|runtime|both]Replace ALL variables on a service with the given set (anything not listed is removed). --secret marks every variable secret; --target sets their injection target.

Databases

CommandUsageDescription
hoststack db listhoststack db list --project <project-id> [--json]List databases in a project
hoststack db gethoststack db get <database-id>Show database details
hoststack db createhoststack db create --project <project-id|prj_…> --name my-db --engine <postgres|redis|mysql|mariadb|mongodb> [--version <v>]Provision a new database
hoststack db credentialshoststack db credentials <database-id>Show host, port, user, password, connection URL
hoststack db connecthoststack db connect <database-id>Open psql / mysql / mongosh / redis-cli with creds pre-filled
hoststack db deletehoststack db delete <database-id>Deprovision a database
hoststack db upgrade-to-hahoststack db upgrade-to-ha <database-id>Migrate a standalone Postgres to a 3-node Patroni HA cluster
hoststack db clusterhoststack db cluster <database-id> [--json]Show HA cluster topology and failover history

Domains

CommandUsageDescription
hoststack domains listhoststack domains list [--json]List custom domains
hoststack domains addhoststack domains add <domain> --service <service-id|svc_…> [--path-prefix <prefix>]Attach a custom domain to a service
hoststack domains verifyhoststack domains verify <domain-id>Re-check DNS and (re)provision the Let's Encrypt cert
hoststack domains deletehoststack domains delete <domain-id>Remove a custom domain

Volumes

CommandUsageDescription
hoststack volumes listhoststack volumes list <service-id>List volumes attached to a service
hoststack volumes createhoststack volumes create <service-id> <name> <mount-path> --size <gb>Attach a new volume
hoststack volumes resizehoststack volumes resize <service-id> <volume-id> <new-size-gb>Grow a volume (cannot shrink)
hoststack volumes deletehoststack volumes delete <service-id> <volume-id>Detach and deprovision a volume

Environments

CommandUsageDescription
hoststack environments listhoststack environments list <project-id>List environments in a project
hoststack environments createhoststack environments create <project-id> --name staging --type <production|staging|development|preview> [--protected]Create a new environment
hoststack environments deletehoststack environments delete <project-id> <environment-id>Delete an environment

Cron

CommandUsageDescription
hoststack cron listhoststack cron list <service-id> [--limit <n>] [--json]List recent cron executions for a service
hoststack cron gethoststack cron get <service-id> <execution-id> [--json]Show details of a single cron execution
hoststack cron triggerhoststack cron trigger <service-id>Trigger an ad-hoc cron run

Runtime

CommandUsageDescription
hoststack logshoststack logs <service-id> [--lines 200] [--since 1h]Print recent runtime logs for a service

Infrastructure as Code

CommandUsageDescription
hoststack inithoststack init [--force]Generate a hoststack.yaml template in the cwd
hoststack validatehoststack validateType-check a local hoststack.yaml against the schema (no API call)

Dev boxes

hoststack dev drives dev environments from your own terminal. new creates a standalone box in the team's Development area, create puts one inside a project (or clones an existing service into one), and delete removes the box, its cloned database, and its /workspace volume in one call.

bash
hoststack dev new --name app-dev --github-id 42 --db postgres,redis
hoststack dev new --repo https://github.com/you/your-app.git
hoststack dev new --name scratch                  # blank box
hoststack dev list
hoststack dev create --project prj_abc --repo https://github.com/me/app.git
hoststack dev create --service svc_abc            # clone of an app + dev URL
hoststack dev delete svc_dev

Box size defaults to standard, and anything smaller is raised to it server-side — a coding agent plus a build does not fit below 2 GB, so --plan nano would otherwise quote a price you never get. The interactive shell is the browser one (Development → your box): there is no hoststack dev shell or dev ssh, and no SSH server inside the image.

No command takes a --team flag. On more than one team, set HOSTSTACK_TEAM_ID to choose which one these act on. Run hoststack dev help for the full flag list plus the cheat sheet of what runs inside a box.

Common Workflows

Deploy and view build logs
hoststack deploy trigger svc_abc123
# → prints the new deploy id, e.g. dpl_xyz...
hoststack deploy logs svc_abc123 dpl_xyz...
Set env vars and roll out
hoststack env set svc_abc123 NODE_ENV=production
hoststack env set svc_abc123 STRIPE_SECRET_KEY=sk_live_... --secret
hoststack deploy trigger svc_abc123 --clear-cache
CI deploy step (GitHub Actions, GitLab, etc.)
# Use a deploy-only API key minted at Settings → API Keys
export HOSTSTACK_API_KEY=hs_live_deployonly_...
npm install -g @hoststack.dev/cli
hoststack deploy trigger svc_abc123

Exit codes & scripting

  • Every command exits 0 on success, non-zero on any failure.
  • List/get commands accept --json for machine-readable output — pipe straight into jq.
  • The CLI honors NO_COLOR and detects non-TTY output, so logs captured in CI runs are clean.

Essential cookies only — for login sessions. No tracking. Details