AI & tools
CLI
HostBase CLI: projects, migrations (db push), TypeScript types, Edge Functions, secrets, branches, backups and PITR from your terminal.
The HostBase CLI (hostbase) manages projects from your terminal and CI/CD through the Management API. The file layout matches the Supabase CLI (supabase/migrations, supabase/functions), so existing repositories work unchanged. Requires Node.js 20+.
Install and sign in
# from the HostBase repository (cli/ directory)
npm install -g ./cli # or: node cli/bin/hostbase.js …
# token: Dashboard → Account → Access tokens
hostbase login # paste hb_pat_… (or: hostbase login --token hb_pat_…)
hostbase whoami
The token is stored in ~/.config/hostbase/config.json (mode 600). In CI use the HOSTBASE_TOKEN variable; point to another API with HOSTBASE_API_URL.
Projects
hostbase projects list
hostbase projects create my-app --org my-org --region pl-waw-1 --compute nano --link
hostbase link --project abcdefghijklmnopqrst # link an existing directory (.hostbase/project.json)
hostbase projects get | pause | resume | delete
hostbase db url # connection strings: direct, pooler, psql
Commands act on the linked project; select another with -p <ref> or HOSTBASE_PROJECT. Every command accepts --json, and destructive operations ask for confirmation (--yes in scripts).
Migrations
hostbase migrations new add_todos_table # supabase/migrations/<version>_add_todos_table.sql
hostbase migrations list # local vs applied (also: hostbase db diff)
hostbase db push --dry-run
hostbase db push
- History is stored in
supabase_migrations.schema_migrations— the same table the Supabase CLI and the dashboard use. - Each migration runs atomically in a single transaction: an error in any statement rolls back the whole migration. Don't add
BEGIN/COMMIT. - A migration older than the last applied one is refused (e.g. after a rebase) — change its version or use
--include-all. - Objects are created as the
postgresrole, just like in Supabase Studio.
Queries and TypeScript types
hostbase db query "select count(*) from todos"
hostbase db query --file report.sql
hostbase gen types typescript --schema public -o src/database.types.ts
Generated types have the same shape as supabase gen types (Database, Tables<>, TablesInsert<>, TablesUpdate<>, Enums<>), so they work with createClient<Database>().
Edge Functions and secrets
hostbase functions deploy hello # supabase/functions/hello/index.ts
hostbase functions deploy webhook --no-verify-jwt
hostbase functions invoke hello --data '{"name":"Ann"}'
hostbase functions logs hello
hostbase secrets set STRIPE_SECRET_KEY=sk_live_… RESEND_API_KEY=re_…
hostbase secrets set --env-file .env.production
hostbase secrets list | unset STRIPE_SECRET_KEY
Files from the sibling supabase/functions/_shared directory are bundled automatically and ../_shared/… imports rewritten. Function code is limited to 1 MB.
Branches, backups and PITR
hostbase branches create feature-x --mode schema # or --mode data
hostbase branches merge feature-x --dry-run # preview migrations to merge into main
hostbase branches merge feature-x
hostbase backups create && hostbase backups list
hostbase backups download manual-20261015-120000 -o backup.dump
hostbase pitr enable --retention 7
hostbase pitr restore --to 2026-10-15T12:30:00Z
Example: GitHub Actions
- run: npm install -g ./cli
- run: hostbase db push --yes && hostbase functions deploy hello
env:
HOSTBASE_TOKEN: ${{ secrets.HOSTBASE_TOKEN }}
HOSTBASE_PROJECT: abcdefghijklmnopqrst
Alternative: the Supabase CLI
The official Supabase CLI also works with a HostBase database via its direct URL:
export DB_URL="postgresql://postgres:PASSWORD@db-abcdefghijklmnopqrst.host.ulewicz.space:5432/postgres?sslmode=require"
npx supabase db push --db-url "$DB_URL"
npx supabase gen types typescript --db-url "$DB_URL" --schema public > src/database.types.ts