# consent-kit documentation

> consent-kit keeps a website's cookie banner, its privacy documents and what the site really does in the browser in agreement, by generating all three from one file, privacy.registry.yaml.

consent-kit keeps a website's cookie banner, its privacy documents and what the site really does in the browser in agreement, by generating all three from one file, `privacy.registry.yaml`.

You describe every cookie, storage key, third-party script, iframe, pixel, endpoint, stylesheet, font and media file the site uses, each with its purpose and lawful basis. consent-kit validates that file, compares it with the last released version, and compiles it into the files the site needs. A browser audit then checks a running site against the same file.

> [!WARNING]
> consent-kit is tooling, not legal advice. It does not make a site compliant with the GDPR, the ePrivacy Directive or any other law. It cannot tell whether your registry is complete or your purposes are lawful. Read [FAQ and compliance notes](/docs/manual/faq/) before you rely on anything it generates.

## The pipeline

```mermaid
flowchart LR
  R[privacy.registry.yaml] --> C{consent-kit check}
  L[privacy.lock.json<br/>last release] --> C
  V[privacy.review.json<br/>human sign-off] --> C
  C --> B[consent-kit build]
  C --> D[consent-kit docs]
  C --> REL[consent-kit release]
  REL --> L
  B --> G1[CookieConsent config]
  B --> G2[Content-Security-Policy]
  B --> G3[inline guard]
  B --> G4[storage facade]
  B --> G5[receipt manifest]
  D --> P[privacy policy, cookie table,<br/>record of processing, ...]
  R --> A[consent-kit audit]
  S[running site] --> A
```

| Step | Command | What happens |
| --- | --- | --- |
| Validate and classify | `consent-kit check` | The registry is validated. Every change since the last release is classified as material or not. Material changes need a purpose version bump; some changes need a person's sign-off. |
| Generate | `consent-kit build` | Writes the [CookieConsent](https://github.com/orestbida/cookieconsent) v3 configuration, a strict Content-Security-Policy, the inline runtime guard, a typed storage module and, when receipts are kept, the receipt manifest. |
| Write documents | `consent-kit docs` | Writes the privacy policy, cookie table, record of processing activities, processor list, field notices and changelog entry, in English and German, as drafts. |
| Release | `consent-kit release` | Records the registry as released in `privacy.lock.json` and raises the consent revision when visitors have to be asked again. |
| Audit | `consent-kit audit <url>` | Drives the running site in Chromium and reports anything it does that the registry does not declare, or does before consent. |

## Sections

- **[Getting started](/docs/manual/getting-started/)**: a tutorial that takes a static site from an empty folder to a passing audit.
- **Concepts** explain how the parts fit and why they are built the way they are: [the registry model](/docs/manual/concepts/registry-model/), [how consent flows at runtime](/docs/manual/concepts/runtime-consent-flow/), [material changes and re-consent](/docs/manual/concepts/material-changes/), [consent receipts](/docs/manual/concepts/receipts/), [Global Privacy Control](/docs/manual/concepts/global-privacy-control/), [documents and phrase review](/docs/manual/concepts/documents-and-phrase-review/), [the threat model and known limits](/docs/manual/concepts/threat-model-and-limits/), and [data subject requests](/docs/manual/concepts/subject-requests/).
- **Guides** are task instructions. Each assumes you have a project that builds. To bring consent-kit into an app you already run, start with [add consent-kit to an existing app](/docs/manual/guides/add-to-an-existing-app/).
- **Reference** pages are complete and dry: [registry fields](/docs/manual/reference/registry/), [validation rules](/docs/manual/reference/validation-rules/), [change classifications](/docs/manual/reference/change-classifications/), [the CLI](/docs/manual/reference/cli/), [generated files](/docs/manual/reference/generated-files/) and the rest.
- **[FAQ and compliance notes](/docs/manual/faq/)**: what consent-kit establishes and what it does not.

## Where to start

| You are | Read, in this order |
| --- | --- |
| A developer integrating consent-kit | [Getting started](/docs/manual/getting-started/) (or, for an app that already runs, [add consent-kit to an existing app](/docs/manual/guides/add-to-an-existing-app/)), [the registry model](/docs/manual/concepts/registry-model/), [how consent flows at runtime](/docs/manual/concepts/runtime-consent-flow/), then the guides you need: [write a registry entry](/docs/manual/guides/write-a-registry-entry/), [add a vendor with a preset](/docs/manual/guides/add-a-vendor-with-a-preset/), [migrate to the storage facade](/docs/manual/guides/migrate-to-the-storage-facade/), [embed an iframe](/docs/manual/guides/embed-an-iframe/), [loosen the CSP](/docs/manual/guides/loosen-the-csp/), [run the audit in CI](/docs/manual/guides/run-the-audit-in-ci/), [release a policy change](/docs/manual/guides/release-a-policy-change/). |
| A product owner declaring purposes | [The registry model](/docs/manual/concepts/registry-model/), [material changes and re-consent](/docs/manual/concepts/material-changes/), the purposes part of [write a registry entry](/docs/manual/guides/write-a-registry-entry/), [release a policy change](/docs/manual/guides/release-a-policy-change/), [FAQ](/docs/manual/faq/). |
| A lawyer reviewing phrases and documents | [FAQ and compliance notes](/docs/manual/faq/), [documents and phrase review](/docs/manual/concepts/documents-and-phrase-review/), [record a legal review](/docs/manual/guides/record-a-legal-review/), [documents reference](/docs/manual/reference/documents/), [the threat model and known limits](/docs/manual/concepts/threat-model-and-limits/). |
| A contributor adding a preset | [Add a vendor with a preset](/docs/manual/guides/add-a-vendor-with-a-preset/), [contribute a preset](/docs/manual/guides/contribute-a-preset/), [presets reference](/docs/manual/reference/presets/). |
| An operator running the receipt endpoint | [Consent receipts](/docs/manual/concepts/receipts/), [deploy the receipt endpoint](/docs/manual/guides/deploy-the-receipt-endpoint/), [receipts and server reference](/docs/manual/reference/receipts-and-server/). |
| An operator receiving data subject requests | [Data subject requests](/docs/manual/concepts/subject-requests/), [receive data subject requests](/docs/manual/guides/receive-data-subject-requests/), [subject requests reference](/docs/manual/reference/subject-requests/). |

## Packages

| Package | What it provides |
| --- | --- |
| `@consent-kit/cli` | The command line tool (the `consent-kit` command). Also re-exports the helpers a site's build script needs. |
| `@consent-kit/schema` | Registry types, JSON Schema, validation, and the diff between two registry versions. |
| `@consent-kit/compiler` | Policy snapshot, CookieConsent config, guard manifest, Content-Security-Policy, consent-gated script tags and iframe placeholders. |
| `@consent-kit/guard` | The browser runtime guard, as an inline script or an installable function. |
| `@consent-kit/storage` | The typed, consent-aware storage facade, embed activation and the receipt sender. |
| `@consent-kit/eslint-plugin` | The `@consent-kit/no-raw-storage` rule. |
| `@consent-kit/documents` | The document generator and its English and German phrase library. |
| `@consent-kit/presets` | Versioned, sourced declarations of third-party tools. |
| `@consent-kit/audit` | The Playwright audit. An optional peer of `consent-kit`. |
| `@consent-kit/server` | The receiving end of consent receipts: a Fetch API handler and a Cloudflare D1 adapter. |

The published packages run on Node.js 22 or newer. Working on the repository itself needs Node.js 22.6 or newer and pnpm 10.
