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

# Installation

> Install the SDK from your own site, with one of its API keys.

**1. Point the @fetchski scope at your site**

Your own site serves the `@fetchski` packages, and any API key from it lets you in. In your
project's folder (beside its `package.json`), make a file named `.npmrc` holding these two lines:

```ini .npmrc theme={"dark"}
@fetchski:registry=https://acme.example/api/v1/sdk/npm/
//acme.example/api/v1/sdk/npm/:_authToken=fsk_acme_…
```

The first line says `@fetchski` packages come from your site; the second is the key to sign in with.
Put your site's address in both lines (set your site in the bar under this page's title and the
example shows it), and paste your whole key in place of `fsk_acme_…`. Write the key itself, never a
variable or a value from `.env`: npm and pnpm don't read `.env`, and pnpm refuses a variable here.

> [!NOTE]
>
> **Any API key from your site works**, the same one your app uses included: its scopes and signing
> mode don't matter for installing, only that it's switched on and not past its expiry date. No key
> yet? Make one in the CMS under **API Keys** ([Authentication](https://docs.fetchski-attract.com/authentication.md)).

Then keep the file out of git. Add this line to the project's `.gitignore` (make the file if
there isn't one):

```text .gitignore theme={"dark"}
.npmrc
```

> [!WARNING]
>
> **`.npmrc` now holds a key to your site: never commit it.** If git already tracks a `.npmrc`, stop
> tracking it with `git rm --cached .npmrc`. Keep these lines in this project's `.npmrc` only, never
> in the `.npmrc` in your home folder. In CI, write the same file from a secret before installing.

**2. Install**

In a terminal, in the same folder as the `.npmrc`, run the line for the package manager your
project uses:

```bash npm theme={"dark"}
npm install @fetchski/attract-cms-sdk
```

```bash pnpm theme={"dark"}
pnpm add @fetchski/attract-cms-sdk
```

```bash bun theme={"dark"}
bun add @fetchski/attract-cms-sdk
```

> [!TIP]
>
> **`401 Unauthorized`?** Your site refused the key in `.npmrc`: it's mistyped or cut short, switched
> off, or past its expiry date. Check too that `.npmrc` sits in the folder you ran the command in.

> [!TIP]
>
> **A release on its first day:** pnpm 11 skips any package published less than a day ago, so an
> install picks the release before it. Exempt the `@fetchski` packages to take each one at once:
>
> ```yaml pnpm-workspace.yaml theme={"dark"}
> minimumReleaseAgeExclude:
>   - '@fetchski/*'
> ```

**3. Give your coding agent the skill**

```bash theme={"dark"}
DISABLE_TELEMETRY=1 npx skills add ./node_modules/@fetchski/attract-cms-sdk/skills
```

The package's [Agent Skill](https://docs.fetchski-attract.com/agent-skills.md), installed for the agents you pick, so they call
the SDK the way these guides do.

## Requirements

> [card] Runtimes
>
> Node 26.12.1+, Bun, and browsers with `AbortSignal.any` (Chrome 116, Firefox 124,
> Safari 17.4).

> [card] TypeScript
>
> 5.4 and later, under `nodenext`, `node16` or `bundler` resolution.

> [card] No dependencies
>
> Only `fetch` and Web Crypto. ES modules; `require()` works on Node 26.12.1+ and Bun.

## Other setups

> [accordion] CI
>
> CI installs the same way: before the install, write the same `.npmrc` from a secret holding one of
> your site's API keys. In GitHub Actions, with the key in a repository secret named
> `ATTRACT_PACKAGES_KEY`:
>
> ```yaml .github/workflows/ci.yml theme={"dark"}
> - name: Point @fetchski at the site
>   run: |
>     echo "@fetchski:registry=https://acme.example/api/v1/sdk/npm/" > .npmrc
>     echo "//acme.example/api/v1/sdk/npm/:_authToken=$ATTRACT_PACKAGES_KEY" >> .npmrc
>   env:
>     ATTRACT_PACKAGES_KEY: ${{ secrets.ATTRACT_PACKAGES_KEY }}
> ```

> [accordion] In a browser bundle
>
> It weighs about half a megabyte minified: every method comes with the client. Never ship an
> API key or signing secret to a browser.

> [accordion] CommonJS
>
> `require('@fetchski/attract-cms-sdk')` works on Node 26.12.1+ and Bun. TypeScript before 5.8 refuses
> that import in a CommonJS file (TS1479): use ES modules there, or a newer TypeScript.

> [card] [Next: configuration](https://docs.fetchski-attract.com/typescript/configuration.md)
>
> Zero-config from the environment, or options.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.