npm package: @galaxy-cloud/cli
Description: Official Galaxy Platform CLI - Deploy and manage your applications
Author: Galaxy Team
Latest version: 1.0.6

# Galaxy CLI

Official command-line interface for deploying and managing applications on [Galaxy](https://galaxycloud.app).

## Quick Start

```bash
# 1. Authenticate with Galaxy
npx @galaxy-cloud/cli login

# 2. Initialize your project
npx @galaxy-cloud/cli init

# 3. Deploy
npx @galaxy-cloud/cli deploy
```

That's it! Your app is now live on Galaxy.

> Using `npx` ensures you always have the latest version.

## Global Installation (Optional)

If you prefer shorter commands:

```bash
npm install -g @galaxy-cloud/cli

galaxy login
galaxy init
galaxy deploy
```

## Commands

### Authentication

| Command  | Description                              |
| -------- | ---------------------------------------- |
| `login`  | Authenticate with Galaxy (opens browser) |
| `logout` | Clear local credentials                  |
| `whoami` | Show current user and organization       |

### Deployment

| Command         | Description                                    |
| --------------- | ---------------------------------------------- |
| `init`          | Create a new app and link it to your directory |
| `link <app-id>` | Link directory to an existing app              |
| `deploy`        | Deploy your application                        |
| `logs`          | Stream application logs                        |
| `config`        | Show current configuration                     |

### Environment Variables

Galaxy uses a staged deployment workflow for environment variables - changes are saved but not applied until you deploy them.

| Command                   | Description                    |
| ------------------------- | ------------------------------ |
| `variables`               | List all environment variables |
| `variables --env .env`    | Import variables from a file   |
| `variables:set KEY value` | Set a variable                 |
| `variables:unset KEY`     | Delete a variable              |
| `variables:deploy`        | Apply pending variable changes |
| `variables:status`        | Check for pending changes      |

**Example workflow:**

```bash
# Set multiple variables
npx @galaxy-cloud/cli variables:set DATABASE_URL postgresql://localhost/mydb
npx @galaxy-cloud/cli variables:set API_KEY secret123

# Apply all changes at once
npx @galaxy-cloud/cli variables:deploy
```

## Configuration Files

### `.galaxy/config.json` (Auto-generated, gitignored)

Links your local directory to a Galaxy app. Created automatically by `init` or `link`.

```json
{
  "appId": "your-app-id"
}
```

### `galaxy.json` (Optional, can be committed)

Deployment configuration. If not present, Galaxy uses your app's default settings.

```json
{
  "commands": {
    "install": "npm ci",
    "build": "npm run build",
    "start": "npm start"
  },
  "health": {
    "path": "/health"
  },
  "deploy": {
    "rootDirectory": "./"
  }
}
```

### `.galaxyignore` (Optional)

Exclude files from deployment, similar to `.gitignore`:

```
node_modules/
.git/
*.log
.env
```

Default patterns are applied automatically even without this file.

## Team Collaboration

When a teammate clones your repository:

```bash
# Get the app ID from the Galaxy dashboard or a teammate
npx @galaxy-cloud/cli link <app-id>

# Deploy
npx @galaxy-cloud/cli deploy
```

The `galaxy.json` file can be committed to share deployment settings, while `.galaxy/config.json` stays local to each developer.

## Requirements

- Node.js >= 18.0.0

## Support

- **Documentation:** [docs.galaxycloud.app](https://docs.galaxycloud.app)
- **Support:** [help.galaxycloud.app](https://help.galaxycloud.app/en/)

## License

MIT