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

# Installation

> Install the @vela-event/sdk package, set up credentials, and verify your connection.

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @vela-event/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @vela-event/sdk
  ```

  ```bash yarn theme={null}
  yarn add @vela-event/sdk
  ```
</CodeGroup>

## Requirements

* **Node.js 18+** — the SDK uses the native `fetch` API added in Node 18
* Works in all modern browsers (Chrome 95+, Firefox 90+, Safari 15+)
* Compatible with edge runtimes: Cloudflare Workers, Vercel Edge Functions, Deno

If you need to use the SDK in Node.js 16 or earlier, pass a custom `fetch` implementation via the `fetchImpl` option:

```typescript theme={null}
import nodeFetch from 'node-fetch';
import { VelaIngestClient } from '@vela-event/sdk';

const ingest = new VelaIngestClient(process.env.VELA_API_KEY!, {
  fetchImpl: nodeFetch as unknown as typeof fetch,
});
```

## Set up credentials

<CodeGroup>
  ```bash Environment variables theme={null}
  # For management operations (apps, schemas, rules)
  export VELA_CLIENT_SECRET="vela_cs_..."

  # For event ingestion
  export VELA_API_KEY="vela_live_..."
  ```

  ```bash .env file theme={null}
  # .env — add this to .gitignore
  VELA_CLIENT_SECRET=vela_cs_...
  VELA_API_KEY=vela_live_...
  ```
</CodeGroup>

See the [credentials guide](/credentials/overview) for how to generate these values. Client secrets come from **Settings → Client Secrets** in the dashboard. API keys are generated when you create an app.

## Verify your setup

Run this to confirm the SDK can connect and your credentials are valid:

```typescript theme={null}
import { VelaManagementClient } from '@vela-event/sdk';

const client = new VelaManagementClient(process.env.VELA_CLIENT_SECRET!);

try {
  const apps = await client.apps.list();
  console.log(`Connected! ${apps.length} app(s) found.`);
} catch (err) {
  console.error('Connection failed:', err.message);
}
```

If you see `Connected! N app(s) found.`, you're ready.

## Self-hosted setup

If you're running Vela on your own infrastructure, pass the `baseUrl` option pointing to your instance:

```typescript theme={null}
import { VelaIngestClient, VelaManagementClient } from '@vela-event/sdk';

const ingest = new VelaIngestClient(process.env.VELA_API_KEY!, {
  baseUrl: 'https://vela.your-domain.com',
});

const client = new VelaManagementClient(process.env.VELA_CLIENT_SECRET!, {
  baseUrl: 'https://vela.your-domain.com',
});
```

## TypeScript configuration

The SDK ships with full type declarations. No `@types` package is needed.

Recommended `tsconfig.json` settings:

```json theme={null}
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true
  }
}
```

For CommonJS projects:

```json theme={null}
{
  "compilerOptions": {
    "target": "ES2019",
    "module": "CommonJS",
    "strict": true
  }
}
```
