Running the CLI
Run every command asnpx @xano/sdk <command>, inside a project or not. Inside a project, npx
runs the version the project has installed, so you, your teammates and CI run the same one.
Anywhere else, it runs the latest release.
npm run xano:* scripts that init writes are shortcuts for the common
commands. They run the same CLI with a typecheck and your project’s paths.
The program inside the package is named
xanosdk. That is what the xano:* scripts call in
package.json, and what npm i -g @xano/sdk puts on your PATH. A global xanosdk ignores the
project’s version, so inside a project use npx @xano/sdk or the scripts. npx xanosdk fails
anywhere the SDK is not installed: xanosdk is not a package on npm.
A command the CLI prints for you to run next (a fix, a rerun) is spelled npx @xano/sdk, in its
output and in the files it writes.
Global flags
Every command takes these.Credential flags
Every command that signs in (deploy, release, promote, tenant, workspace, ephemeral,
env, pull, tables, login and the rest) takes the same set beside --profile:
In CI, set
XANO_INSTANCE_URL, XANO_WORKSPACE_ID and XANO_META_TOKEN together instead. That
credential outranks every file and profile. See
Environment & identity and CI/CD.
A write to your workspace or a tenant asks for confirmation first. Off a terminal it needs
--yes (-y), or it exits 1 with the command to rerun. A write to an ephemeral or a Xano Engine
never asks.
Build flags
deploy, export, preflight, workspace diff and workspace reset-tables compile your
project, and each takes this whole set:
release create takes --strict and the env and documentation-token flags, but none of the lock
flags. compile and routes take --strict and --lock. Each command’s page lists exactly what
it takes.
Naming a backend
Every command that reads, writes or opens a running backend names it with one grammar, the backend selector:
The flag follows what the command does with the backend: reads take
--from, writes take --to,
test and site take --on, and a command whose subject is the backend takes it as an argument.
A command that cannot serve a backend refuses it with the reason and the spellings it does take,
whether you typed it or it came from the tracked backend.
The tracked backend
Leave the backend off and a command follows the one this project last deployed to, recorded in.xano/deployed.json. Only a deploy to an ephemeral or a Xano Engine records it. A deploy to your
workspace or a tenant never does, so a bare command cannot reach something real unasked.
With no record, a command falls back to the ephemeral recorded under your current credential,
then to the Engine recorded for this directory, and otherwise refuses, naming the flag to pass.
deploy is the exception: bare, it deploys to the Xano Engine (or an ephemeral with
--ephemeral, or the workspace or a tenant with --to) and writes the record rather than
reading it. generate and init --from always need a backend named. The site commands are the other
exception: a site belongs to a workspace, so bare they read and write your workspace’s sites, and
--on names another backend. npx @xano/sdk status shows the tracked backend.
Output
When stdout is a terminal, commands print text. When it is not (a pipe, a file, a CI step), stdout carries one JSON document, a failure’s included, and progress goes to stderr.--json forces
JSON on a terminal too.
--help, npx @xano/sdk version, and a command whose stdout is its data (export
to stdout, --path -). Exit codes and outcomes covers every exit
code, the failure document { ok: false, error: { code, message, exitCode, details } }, and the
completed outcome of a release write.
Commands by group
Next
- The files these commands read and write: Config files.
- When a command fails: Troubleshooting.