Drifthost ← Back to home

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
Headless / CI or no browser? Create a token (see Tokens) and either run 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

CommandWhat it does
drifthost loginSign in via your browser (no password).
drifthost login --token <hst_…>Sign in headlessly with a personal access token.
drifthost logoutSign out (clears the saved token).
drifthost whoamiShow the signed-in account.
drifthost projectsList 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 listList 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-editorReplace the AI-editor workspace with the deployed files (text only; binaries skipped).
--jsonPrint 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

VariablePurpose
DRIFTHOST_TOKENBearer token — use in CI instead of login.
DRIFTHOST_API_URLAPI base URL (default https://app.drifthost.site; set for self-hosted).
DRIFTHOST_ORGAct within a specific organization (defaults to your first org).
DRIFTHOST_NO_BROWSERPrint the authorize URL instead of opening a browser.