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

# Deploy to production

> Get the two environment variables needed to use Elding in production.

In production there is no browser and no `elding login`. You need two environment variables:

```bash theme={null}
ELDING_REFRESH_TOKEN=eld_rt_...   # a long-lived service key
ELDING_SET_ID=...                  # the ID of the set to load
```

The SDK reads them automatically — your application code does not change between development and production.

## Method 1 — CLI (recommended)

Run once, locally, in your project folder:

```bash theme={null}
elding login     # if not already signed in
elding init      # if the project is not yet linked to a set
elding deploy
```

The CLI asks for an optional key name, creates the key, and prints the two variables:

```
✓ Key "My App Production" created.
  → Visible in your dashboard under API Keys tab.

Add these 2 environment variables to your host (Vercel, etc.):

  ELDING_REFRESH_TOKEN=eld_rt_...
  ELDING_SET_ID=...

⚠ The key is shown only once. Copy it now.
```

Paste them into your host's environment settings (Vercel → Settings → Environment Variables, Railway, Render, etc.).

<Warning>
  Do not run `elding deploy` in a CI pipeline with public logs. The token would be exposed.
  Always run it locally and paste the values manually into your host.
</Warning>

## Method 2 — Dashboard

1. Open [elding.app](https://elding.app) and go to **API Keys**.
2. Click **New key**, give it a name, and copy the `ELDING_REFRESH_TOKEN` shown once.
3. Open the target set. Its ID is in the URL: `elding.app/vault?set=<ELDING_SET_ID>`.
4. Add both variables to your host's environment.

## What to do with the variables

Once set on your host, the SDK works automatically with no code changes:

```js theme={null}
// Development: uses a placeholder injected by the local proxy
// Production:  retrieves the API key via ELDING_REFRESH_TOKEN + ELDING_SET_ID
// Same code, zero change.

import { configure } from "@elding/sdk";

const openai = new OpenAI(await configure("OPENAI_KEY", "https://api.openai.com"));
```

`DATABASE_URL`, `JWT_SECRET`, `REDIS_URL`, and other non-HTTP variables remain in your
host's environment variables.

## Revoke a key

Go to **API Keys** in the dashboard and click **Revoke** next to the key. The token is immediately invalidated — no deployment or code change needed.
