> For the complete documentation index, see [llms.txt](https://docs.clusters.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clusters.xyz/getting-started/javascript.md).

# Javascript

{% stepper %}
{% step %}

### Install the SDK

Using npm:

```bash
npm install @clustersxyz/sdk viem
```

Or yarn:

```bash
yarn add @clustersxyz/sdk viem
```

{% endstep %}

{% step %}

### Get an optional API Key

You can get an API Key by visiting <https://clusters.xyz/developer>
{% endstep %}

{% step %}

### Create your Clusters client

**Import**

```typescript
import { Clusters } from "@clustersxyz/sdk"

// 3 different examples
const clusters = new Clusters();

// with testnet enabled
const clusters = new Clusters({ isTestnet: true }) 

// with api key
const clusters = new Clusters({ apiKey: "abc123" });
```

{% endstep %}
{% endstepper %}

***

## Helper functions & variables

<table data-header-hidden><thead><tr><th width="250"></th><th></th></tr></thead><tbody><tr><td><code>validNameRegex</code></td><td>The regex for a valid cluster name</td></tr><tr><td><code>getImageUrl(name)</code></td><td>Get's the profile pfp url of a specific cluster name</td></tr><tr><td><code>getProfileUrl(name)</code></td><td>Get's the profile url of a cluster name</td></tr><tr><td><code>normalizeName(name)</code></td><td>Will clean up the name for onchain submission</td></tr><tr><td><code>isNameValid(name)</code></td><td>Checks if the name is a valid name and will be accepted on chain</td></tr></tbody></table>
