Skip to main content

CLI commands

CommandWhat it does
layero initA block for AI agents in AGENTS.md / CLAUDE.md / .cursorrules and a .layero/project.json scaffold. Optional: deploy links the folder by itself.
layero loginSign in through the browser (an emailed code or Yandex ID) — a device flow.
layero logoutRemove the saved token.
layero whoamiShow the current account.
layero orgs listList your Layero organizations (personal + teams).
layero projects listList your projects.
layero projects create --repo <provider>:<owner/repo>Create a project from a repository of a connected provider — push to a branch = preview, push to main = production.
layero projects delete <slug> --yesDelete a project. Irreversible; needs a token with scope admin.
layero sources listGit providers the platform supports and the organization's connections.
layero sources connect <provider> --token-stdinConnect a provider with a personal access token (read from stdin, so it stays out of shell history).
layero sources repos <connection_id>Repositories visible to a connection.
layero envs listEnvironments (branches) of a project with their addresses.
layero link <id_or_slug>Link the current directory to an existing project.
layero deployPack the current directory and deploy: the platform builds and publishes it. For a project without a repository every deploy replaces the live site.
layero deploy --dry-runPrint the build plan and exit: uploads nothing, no login needed.
layero deploy --prodA project with a connected repository: publish the upload at the live address (with confirmation).
layero deploy --org <slug>Create the new project in the given team instead of your personal organization.
layero deploy --jsonA machine-readable event stream — for agents and CI.
layero deploy --claimDeploy without an account: a temporary site for 1 hour (static sites and SPAs only) and a link for a human to take the site over.
layero claim status / claim accept <code>State of a claimable project's claim; open the page where a human accepts it.
layero deploys listShow recent deploys of the current project.
layero promotePoint the production apex at a specific ready deploy.
layero promote <sha>Point the apex at a specific deploy by commit_sha — the working way to roll back, see Rollback.
layero hooks list/create/deleteDeploy hooks — URL tokens that start a build on POST (CMS, cron, external CI).
layero db listThe organization's databases: name, slug, placement, Postgres version, Data API, storage used, paid-until date.
layero db create <name>Create a shared database from the plan. The connection string is printed once.
layero db connect <database>Connect a project to the database — the connection string goes into its environment variables.
layero db disconnect <database>Disconnect a project from the database: the variable goes away with the next deploy.
layero db sql <database> "SQL"Run a query or a script in the database.
layero data envThe Data API URL and public key for the frontend.
layero token set <jwt>Set the token by hand (for CI).

The full flag list for a command:

npx layero@latest <cmd> --help

The global --json flag switches the CLI to JSON lines on stdout — that is for AI agents (Cursor, Claude Code) and CI pipelines. More in Deploying from AI agents.

layero init​

Run it once inside the site directory:

cd my-site
npx layero@latest init

What it does:

  1. Looks at the folder with the same detection as deploy --dry-run and prints the detected event — with hint and next_action when the app is not recognised (a monorepo subfolder, frontend and backend side by side, a custom build script).
  2. Creates .layero/project.json with analytics_enabled and env_vars. It does not record the detection guess (framework_hint / build_cmd / output_dir): the CLI reads the fields of this file as your choice. If the file already exists it is left alone.
  3. Appends a "Deploying with Layero" block to AGENTS.md, CLAUDE.md and/or .cursorrules (whichever exist; if none do, it creates AGENTS.md). The block names the framework only when detection is sure of it.

The block is fenced with <!-- layero:start --> / <!-- layero:end --> markers, so a repeat init updates it in place instead of duplicating it.

Flags:

  • --skip-agent-docs — leave AGENTS.md / CLAUDE.md / .cursorrules untouched.
  • -y, --yes — non-interactive (all defaults applied silently).

layero orgs list​

Shows the Layero organizations you belong to:

borisowvalia personal (admin)
acme-team team (admin)
client-x team (member)
  • personal — your personal account, created at signup.
  • team — a team, created by hand (in the dashboard or via layero deploy --org=...).

Under the older naming scheme the organization slug was a prefix of the hostname (<org>-<project>.layero.app). For projects created after the move the address consists of the project slug alone — see Environments, previews and production.

layero projects list​

Shows every project you have access to.

Link the current directory to an existing project:

npx layero@latest link 123 # by id
npx layero@latest link alice-blog # by slug

It creates ./.layero/project.json pointing at the project. Useful when you cloned somebody else's repository and want to deploy into your own project, or moved from another folder.

layero deploy​

Pack the current directory and start a deploy. Details in layero deploy.

layero deploys list​

Show the project's recent deploys (the default branch unless told otherwise):

npx layero@latest deploys list # the current default branch
npx layero@latest deploys list --branch=staging # another branch
npx layero@latest deploys list --limit 50 # more history

Each line carries the status (ready/building/failed), the commit SHA, a timestamp and the deploy source:

BadgeWhat it means
(push)Came from a GitHub webhook after a push
(cli)Uploaded through layero deploy
(manual)Started by hand from the dashboard (Redeploy)

layero projects create​

A project from a repository without the dashboard — path (a) for agents and the terminal:

layero sources list # providers and connections
echo "$GITVERSE_TOKEN" | layero sources connect gitverse --token-stdin
layero sources repos <connection_id>
layero projects create --repo gitverse:acme/site --branch main --json

GitHub is connected by installing the Layero GitHub App in the dashboard; the other providers take a personal access token. The command checks the repository against the connection, creates the project and installs the webhook. If the provider refuses the webhook (token permissions; SourceCraft has no outgoing webhooks at all), the CLI says so with webhook_unavailable and the URL to register by hand — the repository is connected either way, only push-triggered builds wait for the webhook.

Once linked, the command finishes the setup wizard itself and starts the first build. It does not write the framework, build command or output directory into the project: the builder detects them from the repository on every build, so a framework change in the repository is picked up by itself, and layero.json overrides them. Only a decision is written: the app folder of a monorepo and the package manager from layero.json. Events setup_applied and deploy_started; from there, layero deploys list --project <slug>. With --no-deploy the project stays in the wizard (event setup_pending with the dashboard URL) and nothing builds until setup is completed there. If detection or setup fails, the project is still created (exit 0): event setup_failed with the reason and the wizard URL.

layero projects create --repo github:acme/site --json # link, set up, build
layero projects create --repo github:acme/site --no-deploy --json # link only

layero projects delete​

layero projects delete <slug> --yes

Irreversible: the address and slug are freed immediately, resources are cleaned up in the background. The route needs a token with scope admin — the default token (read + deploy) gets forbidden, and that is right: an agent holding a deploy token must not be able to wipe a project. In a terminal without --yes the command asks you to type the slug; outside a terminal without --yes it refuses with confirmation_required.

layero envs list​

The project's environments with their addresses. An environment and a branch are the same thing: a CLI project has one (cli), a project with a repository has one per branch; production is marked. In --json — the environments event.

layero claim​

For a project created without an account (layero deploy --claim): layero claim status shows whether the claim is alive, layero claim accept opens the dashboard page where a human takes the site into their account. A claim cannot be accepted from the terminal — only by a person in the dashboard.

layero hooks​

A deploy hook is a URL that starts a build when it receives a POST. It is for cases where the build is triggered by something other than a person: publishing in a headless CMS, a cron job, an external CI pipeline.

layero hooks create strapi-content # preview hook, default branch
layero hooks create publish --prod # production hook
layero hooks list
layero hooks delete <id> # revoked immediately

The command prints a URL of the form https://api.layero.ru/hooks/<token>. Verified on a live project: POST returns 202 with a deploy_id and starts a build, while GET returns 405 — so a crawler or an accidental visit in a browser cannot fire one.

The hook URL is a credential

Anyone holding it can start a build. To rotate, delete the hook and create a new one; there is no separate "regenerate token".

layero promote​

Point the project's production apex at a specific ready deploy. Details in layero promote.

npx layero@latest promote # default branch → latest ready
npx layero@latest promote --branch=staging # latest ready of the staging branch
npx layero@latest promote a3f9c2b # a specific deploy by commit_sha (positional)
npx layero@latest promote --yes # no confirmation (CI)

layero deploy --promote is the short path — "build it and ship it to production straight away", equivalent to layero deploy … && layero promote <last-sha>.

layero db​

The organization's databases from the terminal — so you don't have to switch to the browser mid-task, and so an agent in CI can do the same.

npx layero@latest db list # which databases exist
npx layero@latest db create crm # create one
npx layero@latest db connect crm # connect the current project
npx layero@latest db sql crm "select count(*) from entries"

With a single organization the CLI uses it; with several, your personal one. For a team organization pass --org <slug>. A database is addressed by name, slug or id.

The connection string is printed once

The CLI won't print it a second time. If you lose it, you can view or reset the password in the dashboard: the database card menu → Connect. It's safer to save the db create output right away.

Commands, output, JSON events and the limits of db sql are covered in Databases from the CLI.