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

# Install the Figranium JavaScript SDK

> Install @figranium/sdk with npm, yarn, pnpm, or bun. Requirements, module formats, and CommonJS versus ESM guidance for the Figranium SDK.

The Figranium JavaScript SDK installs from npm as `@figranium/sdk`. It ships parallel ESM and CommonJS builds with bundled TypeScript declarations, so most projects need no additional configuration.

## Requirements

* Node.js `18` or newer (for the built-in global `fetch`), or a modern browser.
* A running Figranium server that the client can reach at its `baseUrl`. Local installs default to `http://localhost:11345`.

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @figranium/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @figranium/sdk
  ```

  ```bash yarn theme={null}
  yarn add @figranium/sdk
  ```

  ```bash bun theme={null}
  bun add @figranium/sdk
  ```
</CodeGroup>

The package has no runtime dependencies, so it adds nothing to your dependency tree beyond itself.

<Tip>
  Use Node.js 18 or newer so the SDK can rely on the built-in global `fetch`. Older Node versions require a polyfill.
</Tip>

## Import styles

The SDK works with both `import` and `require`.

<CodeGroup>
  ```ts ESM / TypeScript theme={null}
  import { Figranium } from "@figranium/sdk";

  const figranium = new Figranium({ apiKey: process.env.FIGRANIUM_API_KEY! });
  ```

  ```js CommonJS theme={null}
  const { Figranium } = require("@figranium/sdk");

  const figranium = new Figranium({ apiKey: process.env.FIGRANIUM_API_KEY });
  ```
</CodeGroup>

## Verify the install

Call `health.check()` to confirm the SDK can reach your Figranium server.

```ts verify.ts theme={null}
import { Figranium } from "@figranium/sdk";

const figranium = new Figranium({
  baseUrl: "http://localhost:11345",
  apiKey: process.env.FIGRANIUM_API_KEY!,
});

const status = await figranium.health.check();
console.log(status);
```

A healthy Figranium instance returns a JSON object with `status: "ok"`.

## Browsers and bundlers

The SDK is `sideEffects: false`, so bundlers like Vite, webpack, esbuild, and Rollup tree-shake unused resources. In the browser, use a session-authenticated client (`{ session: true }`) so cookies are sent. See [Authentication](/docs/sdk/js/authentication).

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/docs/sdk/js/quickstart">
    Save and run your first task with the SDK.
  </Card>

  <Card title="Client configuration" icon="sliders" href="/docs/sdk/js/client-configuration">
    Configure `baseUrl`, timeouts, custom `fetch`, and default headers.
  </Card>
</CardGroup>
