The Lahyer CLI

Deploy, read logs, manage variables, databases and domains, and ask Lahyer AI from your terminal or CI.

npm install -g @lahyer/cli

The CLI needs Node.js 20 or later.

Sign in

The CLI acts with an API key. Create one on Settings, API keys in the dashboard, then:

lahyer login            # paste the key when asked, or pass --token <key>
lahyer whoami           # who the saved key acts as
lahyer logout           # forget it

A key acts inside one organization, with the role it was created with. It cannot manage people, other keys or sessions. See API keys.

lahyer init

Run it in a clone of a repository you imported: it finds the project from the Git remote and writes .lahyer/project.json. Commands run in that directory then act on that project. Anywhere else, pass --org <slug> --project <slug>.

Deploy

lahyer deploy                     # deploy the checked-out branch and follow the build
lahyer deploy --branch staging    # another branch
lahyer deploy --dir ./site        # upload a folder instead of deploying from Git
lahyer deploy --no-wait           # return once the deployment is queued

When the folder is not linked to a project yet, --dir creates one, named after the folder unless you pass --name, and links the folder to it. lahyer deploy exits with an error unless the deployment ends ready.

Commands

CommandWhat it does
lahyer projectsList the organization's projects.
lahyer deploymentsList recent deployments (--limit <n>, 20 by default).
lahyer logs [deployment]Build log of a deployment (the latest by default); -f follows it.
lahyer logs --runtimeThe running app's output: --range 15m, 1h, 6h, 24h or 7d; --source production or a preview id; --q <text> to filter; -f to follow.
lahyer env ls / set / rm / pullEnvironment variables.
lahyer db / create / url / rmThe project's Postgres database.
lahyer domains / add / rm / verifyCustom domains: add prints the DNS records to create.
lahyer domains redirect <domain> --to <domain>Redirect a domain (--status 301, 302, 307 or 308; --remove to undo).
lahyer domains headers <domain>Show a domain's headers; --set NAME=VALUE replaces them, --clear removes them.
lahyer ask "<question>"Ask Lahyer AI about the project, or about every project when run outside one.

Lahyer AI from the terminal

lahyer ask "Why did the last deployment fail?"
lahyer ask --conversation <id> "And how do I fix it?"
lahyer ask --approve <action>     # run an action Lahyer AI proposed
lahyer ask --dismiss <action>

Lahyer AI reads deployments, build and runtime logs, usage, domains and settings to answer. It may propose a redeploy, rollback or promote, but nothing runs until you approve it.

In CI

Set LAHYER_TOKEN to an API key instead of running lahyer login, and pass --org and --project when the checkout has no .lahyer/project.json:

.github/workflows/deploy.yml
- run: npm install -g @lahyer/cli
- run: lahyer deploy --org acme --project shop
  env:
    LAHYER_TOKEN: ${{ secrets.LAHYER_TOKEN }}

Add --json to any command for machine-readable output.

Global options

OptionMeaning
--org <slug>The organization; defaults to the linked project's.
--project <slug>The project; defaults to the linked project.
--jsonPrint JSON instead of text.
-v, --versionPrint the CLI's version.
--helpHelp for any command, such as lahyer domains --help.

On this page