Skip to main content

All commands

Every command runs as npx layero@latest <command>. Detailed help for any of them — npx layero@latest <command> --help. Most commands take --project <id or slug>: without it, the project linked to the current folder is used.

Sign-in and account​

CommandWhat it does
loginsign in through the browser; --no-browser only prints the link
logoutremove the sign-in from this machine
whoamiwhich account you're signed in as
username <name>set the username — your personal organization's address. For agents and CI
orgs listorganizations you're a member of
token create <name>issue a long-lived token for CI and agents, --scope read,deploy,admin
token listissued tokens: name, rights, last use
token revoke <id>revoke a token, takes effect at once
token set <token>save on this machine a token issued elsewhere

How to sign in and where it's stored — Installing and signing in.

Publishing​

CommandWhat it does
deploypack the folder and publish it; --dry-run shows the plan — details
initadd a Layero block to AGENTS.md, CLAUDE.md or .cursorrules — details
link <id or slug>link the current folder to an existing project
claim status [code]state of a temporary site created with deploy --claim
claim accept [code]open the page where a person takes the site into their account

Projects and environments​

CommandWhat it does
projects listyour projects
projects create --repo <provider>:<owner>/<repository>create a project from a connected repository: a push to a branch gives a preview, a push to the main branch the main address
projects delete <id or slug>delete a project — irreversible
envs listthe project's environments and their addresses
sources listGit providers and the organization's connections
sources connect <provider>connect a provider with a personal token
sources repos <connection id>repositories the connection's token can see

projects delete, domains remove and other irreversible commands work with a login sign-in. A token needs admin rights for them.

Builds, rollback and diagnostics​

CommandWhat it does
deploys listrecent builds of the main branch; --branch for another
rollbackbring back the previous build; --deploy for a specific one
promote [build]make a build the main one; without an argument takes the latest build of the cli environment
logsthe build log; --runtime for the running app's log, --tail <n> for how many lines
diagnoseexplain why a build is in its state: the cause, the log around the error, the app's state
source [build]download an upload's sources as a ZIP; --url gives just the link

Rollback and picking a build — a separate article.

In deploys list every build shows its source: cli — a folder upload, push — a push to the repository or a hook, manual — started with the «Собрать заново» (Build again) button in the dashboard.

Project settings​

CommandWhat it does
env listenvironment variable names and value lengths
env set KEY=value …set variables, leaves the rest alone
env unset KEY …delete variables
domains listthe project's domains
domains add <domain>connect a domain and show the DNS records
domains verify <domain>check DNS now instead of waiting for the background check
domains primary <domain>make the domain primary: the layero.app address redirects to it
domains remove <domain>disconnect a domain — irreversible
hooks listthe project's deploy hooks
hooks create <name>create a hook: an address a POST to which starts a build. For CMSs, cron and external CI
hooks delete <id>revoke a hook; the address stops working at once

Details: environment variables, custom domain.

Analytics and speed​

CommandWhat it does
analytics statuswhether Yandex Metrica is connected
analytics connectconnect Metrica: the command prints a link, a person grants access
analytics statstraffic: totals, trend, sources, devices, pages
analytics disconnectdisconnect Metrica
perf checkmeasure the main branch's speed; --wait waits for the result
perf showthe latest measurement and the comparison with the previous build

Databases and the Data API​

CommandWhat it does
db list, db create, db connect, db disconnect, db sql, db deletethe organization's databases — details
data enableturn on the Data API for a database
data envVITE_ and NEXT_PUBLIC_ variables for the frontend; --write puts them into .env.local
data methodstables and functions available through the API and the access level of each
data grant <object>set the access level: shows the SQL and applies it after confirmation
data keyskeys: list, issue, revoke
data originssites allowed to call the database from the browser
data probe <method> <path>a test request through the API: real rights and policies, writes are rolled back
data authsign-in of the app's users: methods, providers, return addresses
data bucketsfile buckets: list and create
data secretssecrets for HTTP requests from SQL; values are never shown

Details — in the Data API section.

Common flags​

FlagWhat it does
--jsonprint JSON events, one per line — list of events
--debugprint the full stack trace on an error
--helphelp for the command
--versionthe CLI version

CLI environment variables​

VariableWhat it does
LAYERO_TOKENa token for CI and agents. Wins over the sign-in saved by login
LAYERO_JSON=1the same as --json
LAYERO_NO_UPDATE_CHECK=1don't check whether a newer CLI version is out. Without it the CLI asks npm for the version once a day and, if there is a newer one, says so on stderr; it never goes to stdout or the JSON events. Useful in CI, where extra stderr lines get in the way