> ## Documentation Index
> Fetch the complete documentation index at: https://docs.overlayed.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> The command-line interface for Overlayed

## Installation

<CodeGroup>
  ```bash pnpm theme={null}
  pnpm i @overlayed/cli -g
  ```

  ```bash npm theme={null}
  npm i @overlayed/cli -g
  ```

  ```bash yarn theme={null}
  yarn add @overlayed/cli -g
  ```
</CodeGroup>

## Usage

```bash theme={null}
overlayed <command>
```

## Authentication

You can authenticate in two ways:

1. **Interactive login** - Run `overlayed login` to authenticate via browser
2. **Environment variable** - Set `OVERLAYED_API_KEY` for CI/CD or programmatic use

The environment variable takes precedence over stored credentials when both are present.

## Commands

### `overlayed login`

Authenticate with the Overlayed platform. This is required for local development.

### `overlayed logout`

Log out of the currently authenticated account.

### `overlayed whoami`

Display information about the currently authenticated user.

### `overlayed init`

Initialize your local development environment. This command:

* Fetches your application metadata from the Overlayed API
* Creates a `.overlayed/meta.json` file with cached application data
* Must be run after `overlayed login` and in a directory with an `overlayed.config.ts` file

This only needs to be run once per project.

### `overlayed bundle`

Bundles the app and site for deployment. This command looks for an [overlayed.config.ts](/packages/overlayed-config)
file in the current directory and bundles the app and site for deployment.

**Options:**

| Flag            | Description                                                                                             |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| `--app [name]`  | Bundle the app. Optionally provide a custom name (random if omitted).                                   |
| `--site [name]` | Bundle the site. Optionally provide a custom name (random if omitted).                                  |
| `--debug`       | Enable debug mode. Outputs bundled file paths and saves zips to `.overlayed/tmp/` instead of uploading. |
| `--no-wait`     | Skip waiting for bundle processing to complete.                                                         |

**Examples:**

```bash theme={null}
# Interactive - select bundles and enter names via prompts
overlayed bundle

# Bundle app with a specific name
overlayed bundle --app my-app-v1

# Bundle both with custom names
overlayed bundle --app my-app --site my-site

# Bundle app with random name (skip name prompt)
overlayed bundle --app

# Bundle and skip waiting for processing
overlayed bundle --no-wait
```

Read more about deploying your overlay [here](http://docs.overlayed.gg/deployment/introduction).

## Programmatic API

The CLI package exports functions for programmatic use. They have the same options and functionality as the CLI
commands.

```typescript theme={null}
import { bundle } from "@overlayed/cli";

// Bundle with options
await bundle({ debug: true });
```

This is useful for custom build scripts or tooling integration.
