CLI Installation

Install the DeployYourApp CLI, verify it, authenticate for the first time, and run the guided setup wizard.


The DeployYourApp CLI is published as @deploy-your-app/cli and installs a single binary named dya. This page covers installing it, signing in, and linking your first project.

Requirements

Requirement Value
Node.js 20.0.0 or newer
Package manager npm, pnpm, or yarn

The published package is a single pre-bundled file with no runtime dependencies, so a global install pulls nothing else in.

Install

npm install -g @deploy-your-app/cli

With pnpm or yarn:

pnpm add -g @deploy-your-app/cli
yarn global add @deploy-your-app/cli

Verify the install

dya --version
0.1.0

dya --help lists every command. dya <command> --help shows the flags for one command. Both exit with status 0.

Authenticate

Browser login

Run dya login with no flags. The CLI starts a callback server on the first free port from 9876 to 9895, then opens https://api.deployyour.app/api/auth/cli-auth in your browser, which redirects to the dashboard's CLI Authorization page.

dya login

Click Authorize CLI on that page. The dashboard sends the token back to the local callback, the CLI verifies it against the server, and prints:

✓ Logged in as ada@example.com

The callback is protected by a one-time state nonce, and the server only accepts http://localhost/callback or http://127.0.0.1/callback callback URLs. The minted session token is valid for 30 days. If the browser cannot be opened automatically, the CLI prints the URL for you to paste. The flow times out after 5 minutes.

If verification fails, the stored token is discarded and the command exits 1.

API key login

For CI, or any machine without a browser, pass an API key. Create one in the dashboard under Settings > API Keys — it is shown once.

dya login --api-key "$DEPLOY_YOUR_APP_API_KEY"
✓ Logged in with API key

The key is validated against the server before it is saved. A rejected key is not stored and the command exits 1. See CI/CD integration for pipeline examples.

Pointing at another environment

Skip this. dya login already targets deployyour.app with no configuration, and that is the service the CLI is built for.

--server exists for working against a different DeployYourApp API, such as a local server during development. The URL is persisted in the global config and used by every later command.

dya login --server http://localhost:3000

--server also works on dya setup.

Guided setup

For a Capacitor project, dya setup does the whole first-run in one interactive flow — it is the fastest path from a fresh install to a deployable project.

cd your-capacitor-app
dya setup

The wizard, in order:

  1. Applies --server if you passed it.
  2. Logs you in via the browser if no credentials are stored.
  3. Selects your organization, auto-selecting when you belong to exactly one.
  4. Checks for package.json and @capacitor/core, and warns before continuing if either is missing.
  5. Lists existing apps so you can pick one, or creates a new app from a name and app ID you supply.
  6. Prompts for a default channel and writes the .deployyourapp project config.
  7. Offers to generate RSA-4096 signing and encryption key pairs.
  8. Offers to install @deploy-your-app/capacitor-update-manager using the package manager detected from your lockfile.
  9. Writes plugins.DeployYourApp into capacitor.config.json, or prints a snippet to paste when your config is .ts/.js.
  10. Asks whether to embed the encryption private key in the Capacitor config. The default is no.
  11. Offers to run npx cap sync.

dya setup requires a TTY. In a pipeline it prints an error and exits 1 — script login, init, keys, and deploy instead.

Manual setup

If you would rather not use the wizard, or you are working on an Electron app:

dya login
dya init --app-id com.example.app
dya keys generate
npm run build
dya deploy --channel production

dya init writes .deployyourapp and auto-detects your built web assets. dya keys generate writes the key pairs and uploads the two public keys to the server. See the command reference for every flag.

Where credentials are stored

Credentials live in a per-user config file created with 0600 permissions, not in your project. dya logout clears the stored session token and API key. See Configuration for the exact path on each operating system.

Troubleshooting

dya: command not found — the npm global bin directory is not on your PATH. Find it with npm prefix -g and add that directory's bin (or the directory itself on Windows) to PATH.

Login times out — the flow allows 5 minutes between opening the browser and the callback. Re-run dya login.

"No free port found between 9876 and 9895" — 20 consecutive ports are occupied. Free one and retry.

Login callback state mismatch — the token came back without the nonce the CLI generated. Run dya login again.

Commands report "Not logged in" — run dya whoami to check which credential is stored, then dya login again.


Previous
Core Concepts
Next
Command Reference