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+. The CLI is also published as a single executable binary on GitHub Releases if you don't want a global npm install.

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-2]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

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]Set or update a single variable
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 ...Set many variables in one call

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)

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