Skip to main content

Installation

Prerequisites

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

SDK

Install the core SDK in your project:
pnpm add @policykit/sdk

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:
pnpm add @lit-protocol/lit-node-client @lit-protocol/constants @lit-protocol/auth-helpers

Required Dependencies

The SDK requires viem for Ethereum interactions:
pnpm add viem

CLI

Install the CLI globally:
pnpm add -g @policykit/cli
Verify the installation:
policykit --version

Smart Contracts

Install the Solidity contracts as a dependency for your own contracts:
forge install policy-kit/policykit
Then import the contracts in your Solidity code:
import { IPolicyEngine } from "@policykit/contracts/src/core/IPolicyEngine.sol";
import { IRuleEvaluator } from "@policykit/contracts/src/rules/IRuleEvaluator.sol";
If using Foundry with the npm package, add a remapping to your remappings.txt:
@policykit/contracts/=node_modules/@policykit/contracts/

Local Development

If you’re developing or extending the smart contracts themselves, you’ll need Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup
Then install contract dependencies:
cd contracts
forge install

Lit Actions

Install the Lit Actions package to get the pre-built policy evaluator bundle for off-chain rule evaluation:
pnpm add @policykit/lit-actions
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:
git clone https://github.com/policy-kit/policykit.git
cd policykit
pnpm install
pnpm build
Run tests across all packages:
pnpm test

Next Steps

Quickstart

Build and deploy your first policy.