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

# JavaScript SDK Overview

> Get started with the Limitem JavaScript SDK. Still just us.

## Installing the SDK

<Steps>
  <Step title="Install the SDK">
    <Tabs>
      <Tab title="Bun">
        ```bash theme={null}
        bun add limitem
        ```
      </Tab>

      <Tab title="pnpm">
        ```bash theme={null}
        pnpm add limitem
        ```
      </Tab>

      <Tab title="npm">
        ```bash theme={null}
        npm install limitem
        ```
      </Tab>

      <Tab title="Yarn">
        ```bash theme={null}
        yarn add limitem
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Initialize the client">
    <Tabs>
      <Tab title="With API key">
        ```typescript theme={null}
        import { limit } from "limitem";

        const limiter = new limit.em({
          token: "limitem_sk_...",
          namespace: "my-app",
          limit: 100,
          duration: "1h",
        });
        ```
      </Tab>

      <Tab title="From env">
        ```typescript theme={null}
        import { limit } from "limitem";

        // Reads LIMITEM_TOKEN or LIMITEM_KEY
        const limiter = new limit.em({
          namespace: "my-app",
          limit: 100,
          duration: "1h",
        });
        ```
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Quick start

```typescript theme={null}
const result = await limiter.limit("user:123");

if (result.allowed) {
  // do the work
} else {
  // result.retry_after is set on 429s from the API
}
```

`success` is an alias of `allowed`. Older Contiguity code used `success` — both work.

## Fail-open

If Limitem is down or the request times out (default **800ms**), the SDK returns `allowed: true` and `failover: true`.

<Note>
  Pass `fail_closed: true` if you'd rather deny the request when Limitem is unreachable.
</Note>

See [`limit.em`](/sdk/js/limit) for the full options list.
