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

# Installation

> Install the Law4Devs TypeScript SDK and make your first API call.

## Requirements

* **Node.js 18+** (uses the native `fetch` API — no polyfill needed)
* npm, yarn, or pnpm

<Note>
  The SDK uses the global `fetch` available in Node 18 and all modern browsers. No additional HTTP dependencies are required.
</Note>

***

## Install

```bash theme={null}
npm install law4devs
```

```bash theme={null}
yarn add law4devs
```

```bash theme={null}
pnpm add law4devs
```

***

## First Call

```typescript theme={null}
import { Law4DevsClient } from 'law4devs';

const client = new Law4DevsClient({
  apiKey: process.env.LAW4DEVS_API_KEY!,
});

const page = await client.frameworks.list();
console.log(`Found ${page.meta.total} EU regulatory frameworks`);

for (const fw of page.data) {
  console.log(`${fw.shortName}: ${fw.name}`);
}
```

***

## Constructor Options

```typescript theme={null}
const client = new Law4DevsClient({
  apiKey: process.env.LAW4DEVS_API_KEY!,
  baseUrl: 'https://api.law4devs.eu/v1',  // default
  timeout: 30_000,   // ms before request is aborted (default: 30000)
  maxRetries: 3,     // retries on 429/5xx (default: 3)
});
```

| Option       | Type     | Default        | Description                     |
| ------------ | -------- | -------------- | ------------------------------- |
| `apiKey`     | `string` | —              | **Required.** Your API key      |
| `baseUrl`    | `string` | Production URL | Override for dev environment    |
| `timeout`    | `number` | `30000`        | Request timeout in milliseconds |
| `maxRetries` | `number` | `3`            | Retries on 429/5xx              |

<Warning>
  Never hardcode your API key in source code or commit it to version control. Always use environment variables.
</Warning>

<Tip>
  Retries use exponential backoff. Timeouts are enforced via `AbortController` and work in both Node.js and browsers.
</Tip>
