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

# Environment

> Platform variables and sibling URLs injected into your app.

# Environment

Kazzle injects a small set of platform variables into app processes. Your own credentials come from the vault through `kazzle.config.ts`.

## Process variables

| Variable         | Description                             | Example                  |
| ---------------- | --------------------------------------- | ------------------------ |
| `PORT`           | The port your process should listen on  | `3000`                   |
| `HOST`           | The host to bind to                     | `0.0.0.0`                |
| `KAZZLE_API_URL` | Base URL used by Kazzle runtime helpers | `https://api.kazzle.app` |

`PORT`, `HOST`, and `KAZZLE_API_URL` are set for process components. Kazzle does not create API keys automatically for app processes; add explicit credentials only when your app actually needs them.

Your process should bind to `HOST:PORT`. Kazzle handles preview routing and production domains on top of that.

## Sibling component URLs

When an app has multiple components, Kazzle can inject URLs that let one component reach another:

| Variable                          | Description                            |
| --------------------------------- | -------------------------------------- |
| `KAZZLE_APP_COMPONENT_{NAME}_URL` | URL for a sibling component at runtime |

The name comes from the component's `name` field: uppercased, non-alphanumeric characters become underscores. A sibling named `API Server` becomes `KAZZLE_APP_COMPONENT_API_SERVER_URL`.

These URLs point to the deployed sibling when one exists. Otherwise they point to the current development address for that sibling component.

## App credentials

App credentials reach a component through a secret collection + environment. Store the secret in the vault with the name you want as the env var key (for example `KAZZLE_API_KEY`), then point the component at that collection + environment:

```typescript theme={"theme":"material-theme-darker"}
export default defineConfig({
  components: [
    {
      name: 'server',
      type: 'process',
      path: './server',
      env: {
        collection: 'my-app',
        environment: 'default'
      }
    }
  ]
});
```

Use `KAZZLE_API_KEY` for calls to Kazzle's `/ai/*` endpoints from a generated app. Never expose private keys through `VITE_*`; those values are bundled into browser code.
