Command-line interface
Drifthost CLI
Package a static-site folder and deploy it to a live subdomain in one command — from your terminal or from CI. Sign in through your browser (no passwords), and every deploy is a versioned, rollback-able snapshot.
Install
Requires Node.js 18+. Install globally from npm:
$ npm i -g drifthost
Verify it's on your PATH:
$ drifthost --help
Sign in
drifthost login opens your browser to authorize this device. Approve it with the
account you already use (Google or email) — no password is typed into the
terminal — and a revocable token is saved to ~/.drifthost/config.json.
$ drifthost login # → opens your browser… ✓ Signed in as You $ drifthost whoami # You you@example.com
drifthost login --token hst_… or set
the DRIFTHOST_TOKEN environment variable. Set DRIFTHOST_NO_BROWSER=1 to
print the authorize URL instead of opening a browser.
Deploy
Point deploy at the folder that contains your site (it must have an
index.html at its root). The first deploy can create the project for you:
$ drifthost deploy ./dist --create my-site # → Packaging 8 files… Uploading… # ✓ Deployed! Live at https://my-site.drifthost.site
A .drifthost.json link file is written to the folder, so subsequent deploys need
no flags:
$ drifthost deploy
Before uploading, the CLI validates locally (non-empty, a root index.html, and
file count/size within your plan's limits) and only then touches the server — so a bad folder
never leaves an orphan project. Every project gets a subdomain automatically; override it with
--subdomain.
Command reference
| Command | What it does |
|---|---|
drifthost login | Sign in via your browser (no password). |
drifthost login --token <hst_…> | Sign in headlessly with a personal access token. |
drifthost logout | Sign out (clears the saved token). |
drifthost whoami | Show the signed-in account. |
drifthost projects | List your projects — name, subdomain, last deploy, file count & size (--json for scripts). |
drifthost deploy [dir] | Deploy a folder (default: current directory). |
drifthost delete <project> | Delete a project and all its deployments (asks to confirm; --yes to skip). |
drifthost subdomain <project> <sub> | Set or change a project’s subdomain. |
drifthost link [dir] --project <id|name> | Link a folder to a project for zero-flag deploys. |
drifthost tokens create <name> | Create a personal access token (shown once). |
drifthost tokens list | List your tokens. |
drifthost tokens revoke <id> | Revoke a token. |
deploy options
--project <id|name> | Target an existing project. |
--create <name> | Create a new project and deploy to it. |
--subdomain <sub> | Attach/confirm a subdomain after deploying. |
--sync-editor | Replace the AI-editor workspace with the deployed files (text only; binaries skipped). |
--json | Print a JSON result to stdout (progress on stderr); for CI. |
Continuous deployment
Build in your CI runner, then deploy with a token stored as a secret. With GitHub Actions, use the Drifthost Deploy Action:
# .github/workflows/deploy.yml
name: Deploy
on: { push: { branches: [main] } }
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm ci && npm run build
- uses: abdforge/drifthost-deploy-action@v1
with:
dir: dist
project: ${{ vars.DRIFTHOST_PROJECT }}
env:
DRIFTHOST_TOKEN: ${{ secrets.DRIFTHOST_TOKEN }}
Or call the CLI directly in any CI:
$ DRIFTHOST_TOKEN=hst_… npx drifthost deploy ./dist --project <id>
Personal access tokens
Tokens are revocable credentials for CLI/CI use (unlike a browser session, they don't expire on their own). Create one, copy it once, store it as a CI secret:
$ drifthost tokens create "github-actions" # hst_XXXXXXXXXXXXXXXXXXXX (copy now — shown once) $ drifthost tokens list $ drifthost tokens revoke <id>
Environment variables
| Variable | Purpose |
|---|---|
DRIFTHOST_TOKEN | Bearer token — use in CI instead of login. |
DRIFTHOST_API_URL | API base URL (default https://app.drifthost.site; set for self-hosted). |
DRIFTHOST_ORG | Act within a specific organization (defaults to your first org). |
DRIFTHOST_NO_BROWSER | Print the authorize URL instead of opening a browser. |