CLI Reference
Install the CLI:
npm install -g @getflect/cliThe CLI is a client of the Flect control plane (the broker). It reads its
connection from, in order of precedence: command flags → environment
(FLECT_URL, FLECT_BROKER_URL, FLECT_TOKEN) → ~/.flect/config.json →
defaults.
Point the CLI at your platform once. A single gateway origin fronts the
whole plane — identity at /v1/*, the broker at /. Set it after logging in
and every command (identity and broker) derives from it:
flect config set gatewayUrl https://flect.cloud # the hosted control plane # (self-hosted: your gateway origin)flect doctor # verify plane + broker + token + scopeflect login
Section titled “flect login”Sign in via SSO and store an identity token in ~/.flect/config.json.
flect loginflect login --auth https://api.example.com # override the auth baseflect logout
Section titled “flect logout”Clear the stored token.
flect logoutflect whoami
Section titled “flect whoami”Show who you are and where the CLI is pointed (tenant, identity, broker, active scope).
flect whoamiTenancy — org, workspace, project, environment
Section titled “Tenancy — org, workspace, project, environment”Everything lives in a tree: Org → Workspace → Project → Environment. Tenancy
is managed by the identity plane (org-service); the CLI has one noun command per
level. Your login gives you an org; you create the rest. Resource and deploy
commands act on the active context you set with flect use.
flect org · flect ws · flect proj · flect env
Section titled “flect org · flect ws · flect proj · flect env”Each noun command lists on its own and takes create / get / update /
delete. Parents are named, not passed as ids.
flect org create --name Acme --slug acme # (bare `flect org` lists)flect ws create --org acme --name Web --slug webflect proj create --org acme --ws web --name Site --slug siteflect env create --org acme --ws web --proj site --name prod # `use` auto-creates `production`flect use <path>
Section titled “flect use <path>”Set the active org / workspace / project / environment. Resource and deploy
commands target it (sent to the broker as X-Org-Id + X-Flect-Scope).
flect use acme # just the orgflect use acme/web/site/prod # down to an environmentflect use # interactive pickerflect ls
Section titled “flect ls”Print the whole org → workspace → project tree, active node marked.
flect lsflect ps
Section titled “flect ps”Show the active context (org path, token, broker, config path) as a compact card.
flect access
Section titled “flect access”Inspect the PDP that authorizes your actions (roles resolved by org-service).
flect access role <scopeId> # your effective role at a scopeflect access check <app> <action> <scopeId>Project files
Section titled “Project files”flect init
Section titled “flect init”Scaffold a flect.toml in the current directory (and git-ignore the local dev
files).
flect initflect init --name myapp # default: the directory nameflect bindings
Section titled “flect bindings”List the bindings, apps, and services declared in flect.toml.
flect bindingsflect dev
Section titled “flect dev”Generate flect.local.json from flect.toml so createEnv() resolves bindings
locally with no broker. See Local development.
flect devResources
Section titled “Resources”Each resource kind has the same four subcommands. <ref> is either the resource
id or its public reference (e.g. myapp-db-a1b2c3d4).
flect db create <name> | list | status <ref> | delete <ref> # sqld / libsqlflect kv create <name> | list | status <ref> | delete <ref> # Valkey / redisflect store create <name> | list | status <ref> | delete <ref> # Garage / S3createprovisions a resource in the active scope and prints the public ref to put inflect.toml(name = "…").listshows the resources of that kind in the scope.status <ref>prints the full resource record as JSON.delete <ref>deprovisions the resource.
$ flect db create notes-db✓ created database "notes-db-a1b2c3d4" (provisioning) flect.toml → name = "notes-db-a1b2c3d4"Resource commands act on the active context (flect use) and accept the
connection flags below (--broker, --token, --scope).
Deploy
Section titled “Deploy”flect deploy
Section titled “flect deploy”Realize flect.toml against the broker: provision any missing resources, bind
them to the project, and deploy the app(s) to the cluster behind Traefik. It
targets your active context (set with flect use).
flect use acme/web/site/prod # pick the target context firstflect deployflect deploy --scope <scopeId> # or target an explicit org-service scope idThe deploy target is the active org-service scope (env → project → …) from
flect use; --scope overrides it with an explicit scope id. region (only
eu today) is reserved in the toml for future multi-region.
| Flag | Description |
|---|---|
--broker <url> |
Broker URL (default: FLECT_BROKER_URL / config) |
--token <token> |
Runtime token (default: FLECT_TOKEN / config) |
--scope <scopeId> |
Target org-service scope id (default: the active context) |
At deploy time only FLECT_TOKEN and FLECT_BROKER_URL are injected into your
container; the SDK resolves everything else at runtime.
flect apps
Section titled “flect apps”List the apps deployed in the active scope (name, status, URL).
flect appsInspection
Section titled “Inspection”flect resolve <name>
Section titled “flect resolve <name>”Inspect the manifest the broker returns for a binding — the same resolution the SDK performs — with secrets redacted. Useful for debugging bindings.
flect resolve DBA static site built from git by the platform. Declare it in flect.toml:
[page]name = "docs"repo = "https://github.com/acme/docs"ref = "main"template = "docs"# domain = "docs.acme.com" # optional custom domainflect page deploy # build the [page] repo and publish itflect page ls # pages in the active scopeflect page status [page] # status + build history (* = the build served)flect page logs [page] # the last build's log (--build <id> for another)flect page rollback [page] # serve a previous build — no rebuildflect page stop [page] # stop serving (builds are kept)deploy waits for the build and exits non-zero if it fails. Builds are
immutable and swapped in atomically, so a failed build leaves the live site
untouched.
Config
Section titled “Config”Config lives in ~/.flect/config.json.
flect config set <key> <value> # key: gatewayUrl | broker | tokenflect config get [key] # print config (token masked)flect config path # print the config file pathflect config set gatewayUrl https://flect.cloud # one origin drives the whole planeflect config set broker https://api.example.com # override just the broker (rarely needed)gatewayUrl is the recommended single knob: the identity-plane bases
(/v1/auth, /v1/iam, /v1/org) and the broker URL all derive from it. Set
broker only to point the control plane somewhere different from the gateway.
Connection flags
Section titled “Connection flags”Commands that talk to the broker accept:
| Flag | Description |
|---|---|
--broker <url> |
Broker base URL |
--token <token> |
Runtime / identity token |
--scope <scopeId> |
Override the active scope for this call |
The active scope is sent to the broker as the X-Flect-Scope header; identity
tokens are not scope-bound, so tenant-level reads (like flect ls) work
without one.