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

# Getting started

> Log in, configure your project, and start using Westyx from the terminal.

## Prerequisites

* `westyx` installed - see [Installation](/cli/installation)
* A Nexus account - request access at [nexus.westyx.dev](https://nexus.westyx.dev)

## 1. Log in

```bash theme={null}
westyx login
```

A browser window opens for authentication. On headless machines (SSH, Docker, CI), the device
flow is used automatically - the CLI prints a short URL and code to enter in your browser.

```
Open https://auth.westyx.dev/realms/westyx/device
Enter code: WSTX-K7MN
Waiting for browser authentication...
```

To force device flow on a machine with a browser:

```bash theme={null}
westyx login --no-browser
```

After login, the CLI auto-selects your first tenant and project. Check what was picked:

```bash theme={null}
westyx tenant list
westyx project list
```

## 2. Set your active tenant and project

```bash theme={null}
westyx tenant set acme-digital
westyx project set backend
```

The active context is saved to `~/.config/westyx/config.json` and used as the default for all
subsequent commands. You can override it for a single command with `--tenant` / `--project`.

## 3. New project - migrate from `.env`

If you have an existing `.env` file, `westyx analyze` classifies each entry and writes a `.wx`
file ready to push:

```bash theme={null}
westyx analyze .env
```

Review the generated `.westyx/.wx` file, then push it to your personal Nexus dev environment:

```bash theme={null}
westyx dev push
```

## 3. Existing project - pull from Nexus

If the project is already in Nexus, pull the current state:

```bash theme={null}
westyx dev pull
```

This creates `.westyx/.wx` with all services, secrets, configs, and flags.

## 4. Start your app with Nexus values

With scripts defined in `.westyx/config`:

```bash theme={null}
westyx dev run           # default script
westyx dev run dev       # e.g. hot reload with air
westyx dev run test      # run tests
```

Without scripts, override the command directly:

```bash theme={null}
westyx dev run -- go run main.go
westyx dev run -- npm start
```

Nexus values are injected as environment variables. If Nexus is unreachable, cached values from
`.westyx/.wx` are used automatically.

## Developer WIF (optional)

For a tighter local setup, configure Developer WIF so the Nexus SDK in your app detects
credentials automatically - no `api_key` in your local config:

```bash theme={null}
westyx dev setup --service=my-api
```

After setup, start your app normally. The SDK picks up the credentials from
`~/.config/westyx/dev-credentials.yaml`.

Check credential status:

```bash theme={null}
westyx dev status
```

Remove when done:

```bash theme={null}
westyx dev teardown --service=my-api
```

## New machine workflow

For a developer joining a project that already uses Westyx:

```bash theme={null}
git clone <repo>
westyx login
westyx dev pull
westyx dev setup --service=my-api
westyx dev run
```

## Next steps

<CardGroup cols={2}>
  <Card title="Command reference" icon="book" href="/cli/reference">
    Full reference for every command and flag.
  </Card>

  <Card title="CI/CD" icon="gear" href="/cli/ci-cd">
    Use the CLI in automated pipelines.
  </Card>
</CardGroup>
