@motherbase/cli is the operator CLI for Motherbase.
It is designed as a Supabase-style terminal surface for the same things exposed by the Platform Console and Project Studio: projects, database, RLS, auth users, storage buckets, edge functions, secrets, realtime, webhooks, cron, settings, diagnostics, backups, and local self-host workflows.
npm install -g @motherbase/cli
motherbase --helpThe CLI talks to two surfaces: the Platform Console for account and project lifecycle commands, then a linked project for resource commands through the Console proxy. Recent resource commands also cover branches, domains, network/SSL policy, JWT key generation, queues, Vault, Wrappers and index-advisor inspection.
Connection model
- Log in to a Console.
- Link the current directory to a project.
- Run project commands from that directory.
motherbase login --url https://console.example.com
motherbase projects list
motherbase link todo
motherbase status
motherbase db tablesThe same command tree falls back to a direct single-project mode for local automation. It applies only when the context has no Console token and no linked project:
MOTHERBASE_URL=http://localhost:5001 \
MOTHERBASE_ADMIN_TOKEN=... \
motherbase users listWhat it controls
| Area | Commands |
|---|---|
| Connection | login, logout, whoami, link, unlink, status |
| Projects | projects list, create, start, stop, restart, update, rebuild, delete, logs, info, limits |
| Local stack | init, start, stop, deploy, logs |
| Database | db tables, db sql, db dump, db restore, db backups, db indexes, db types, db roles, db publications, migration new, migrations *, import |
| RLS | rls list, enable, disable, policy create/delete, preset, simulate, lint |
| Users | users list, get, create, update, delete, reset-password, promote, demote, revoke-sessions |
| Storage | storage buckets *, storage ls, storage cp, storage rm |
| Edge functions | functions list, get, new, deploy, pull, serve, delete, invoke, logs |
| Operations | secrets, keys, realtime, webhooks, cron, queues, vault, wrappers, branches, domains, config, inspect, index-advisor |
| Codegen and agents | gen types typescript, mcp |
Config files
Global credentials are stored outside your project:
~/.motherbase/config.jsonThe project link is stored locally:
.motherbase/config.jsonExample local link:
{
"consoleUrl": "https://console.example.com",
"projectId": "todo",
"projectName": "todo"
}The local file contains routing metadata only. Do not put tokens in it.
CI and non-interactive use
Use Console mode when CI should operate a project through the Platform Console:
MOTHERBASE_CONSOLE_URL=https://console.example.com \
MOTHERBASE_TOKEN=mbp_... \
MOTHERBASE_PROJECT=todo \
motherbase db sql -e "select 1"Use direct mode when CI points straight at one project API:
MOTHERBASE_URL=https://todo.example.com \
MOTHERBASE_ADMIN_TOKEN=... \
motherbase db tablesEach value resolves in that order: explicit flag, environment variable, the local
link file, then ~/.motherbase/config.json. Direct mode is chosen only when
MOTHERBASE_URL and MOTHERBASE_ADMIN_TOKEN are both set and Console mode has no
token or no project.
Supabase migration
The CLI includes a first-class Supabase import path:
motherbase import --from-supabase "$SUPABASE_DB_URL" --preview --json
motherbase import --from-supabase "$SUPABASE_DB_URL" --yesIt imports public schema, data, RLS policies, and email/password users. Storage objects are not copied. See Migrate from Supabase.