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

# Installation

> Install the PolicyKit SDK and CLI

# Installation

## Prerequisites

* **Node.js** >= 18.0.0
* **pnpm** (recommended) or npm

## SDK

Install the core SDK in your project:

<CodeGroup>
  ```bash pnpm theme={null}
  pnpm add @policy-kit/sdk
  ```

  ```bash npm theme={null}
  npm install @policy-kit/sdk
  ```

  ```bash yarn theme={null}
  yarn add @policy-kit/sdk
  ```
</CodeGroup>

### Peer Dependencies

The SDK has peer dependencies for Lit Protocol integration. If you plan to use off-chain (Tier 3) rules, install them as well:

```bash theme={null}
pnpm add @lit-protocol/lit-node-client @lit-protocol/constants @lit-protocol/auth-helpers
```

### Required Dependencies

The SDK requires `viem` for Ethereum interactions:

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

## CLI

Install the CLI globally:

<CodeGroup>
  ```bash pnpm theme={null}
  pnpm add -g @policy-kit/cli
  ```

  ```bash npm theme={null}
  npm install -g @policy-kit/cli
  ```
</CodeGroup>

Verify the installation:

```bash theme={null}
policykit --version
```

## Smart Contracts

Install the Solidity contracts as a dependency for your own contracts:

<CodeGroup>
  ```bash Foundry theme={null}
  forge install paladini-ai/policykit
  ```

  ```bash npm theme={null}
  npm install @policy-kit/contracts
  ```

  ```bash pnpm theme={null}
  pnpm add @policy-kit/contracts
  ```
</CodeGroup>

Then import the contracts in your Solidity code:

```solidity theme={null}
import { IPolicyEngine } from "@policy-kit/contracts/src/core/IPolicyEngine.sol";
import { IRuleEvaluator } from "@policy-kit/contracts/src/rules/IRuleEvaluator.sol";
```

<Note>
  If using Foundry with the npm package, add a remapping to your `remappings.txt`:

  ```
  @policy-kit/contracts/=node_modules/@policy-kit/contracts/
  ```
</Note>

### Local Development

If you're developing or extending the smart contracts themselves, you'll need [Foundry](https://book.getfoundry.sh/):

```bash theme={null}
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

Then install contract dependencies:

```bash theme={null}
cd contracts
forge install
```

## Lit Actions

Install the Lit Actions package to get the pre-built policy evaluator bundle for off-chain rule evaluation:

<CodeGroup>
  ```bash pnpm theme={null}
  pnpm add @policy-kit/lit-actions
  ```

  ```bash npm theme={null}
  npm install @policy-kit/lit-actions
  ```
</CodeGroup>

The package includes:

* **Pre-built bundle** at `build/policyEvaluator.action.js` — upload this to IPFS and pass the CID to the SDK's `LitClient`
* **Source rules** in `src/rules/` — use as reference or starting points for custom rule implementations

## Monorepo Setup (Contributing)

To work on PolicyKit itself:

```bash theme={null}
git clone https://github.com/paladini-ai/policykit.git
cd policykit
pnpm install
pnpm build
```

Run tests across all packages:

```bash theme={null}
pnpm test
```

## Next Steps

<Card title="Quickstart" icon="rocket" href="/getting-started/quickstart">
  Build and deploy your first policy.
</Card>
