Beta. consent-kit is at 0.x: expect breaking changes between releases, and treat everything it generates as a draft. Report a problem or share feedback.

Open-source privacy tooling for web developers

Your privacy policy says one thing. Does your app do the same?

Declare cookies, browser storage, and third-party resources in one YAML file. Generate consent settings and privacy-policy drafts, then audit the running site in Chromium to catch unexpected behavior.

Runs in CI on every deploy, and fails when the site does something the registry does not declare.

npm install --save-dev @consent-kit/cli

Already have an app? Follow the integration guide.

Open source, MIT. No hosted service, no account, nothing sent to us.

Live demo: change consent and watch what the page is allowed to do. Open it on demo.consent-kit.com (new tab)

What the audit catches

Privacy drifts in three places: a tag pasted into the page, a storage key a new feature writes, a policy written once at launch. Here is the first, as the audit reports it.

FailCheck 6: Undeclared drift

Finding
An undeclared script was requested.
When
Before any consent decision, on /.
Resource
tags.analytics.example/tag.js
Next step
Remove it, or declare it in the registry with its purpose. The audit prints the entry to paste, with the purpose left as TODO.
Show the full audit output
$ npx consent-kit audit http://localhost:4180 --page /
consent-kit audit of http://localhost:4180/
Pages: /

PASS  1. Pre-consent silence
PASS  2. Reject means reject (no purpose asks for consent)
PASS  3. Grant activates exactly what is declared
PASS  4. Withdrawal cleans up
PASS  5. GPC honoured
FAIL  6. Undeclared drift
      error    script https://tags.analytics.example/tag.js is not declared in the registry; it was requested before any decision on /. Remove it, or add to privacy.registry.yaml:
                 - id: tags-analytics-example-tag-js
                   kind: script
                   src: "https://tags.analytics.example/tag.js"
                   processor: TODO
                   purposes: [TODO]
PASS  7. Banner UX (no purpose asks for consent)
…     6 more checks (5 pass, 1 warns) and the policy summary, cut here
Coverage: 0 of 2 declared artefacts observed; 1 undeclared; 0 used without consent; 0 with attribute drift.

Audit FAILED: 11 checks passed, 1 with warnings, 1 failed (3.9s).
Real output of consent-kit audit with this site's registry, against a page carrying one stray analytics tag. The line marked … stands for the lines cut.

Run the audit in CI

How it works

You write privacy.registry.yaml: what the app stores and loads, why, and on what lawful basis. consent-kit build and consent-kit docs generate the rest from it, and consent-kit audit checks what the running site does against it.

privacy.registry.yamlpurposes: - id: site-operation basis: legitimate_interestartefacts: - kind: storage key: starlight-themeBanner configurationCookieConsent v3, when consent is neededbuildContent-Security-PolicyAdmits only the origins you declaredbuildRuntime guardChecks writes against consent in the pagebuildTyped storage moduleAn undeclared key does not compilebuildPrivacy documentsPolicy, cookie table, records: as draftsdocsBrowser auditRuns the site in Chromium against the fileauditprivacy.registry.yamlWhat you store and why: the only file you writeBanner configurationCookieConsent v3, when consent is neededbuildContent-Security-PolicyAdmits only the origins you declaredbuildRuntime guardChecks writes against consent in the pagebuildTyped storage moduleAn undeclared key does not compilebuildPrivacy documentsPolicy, cookie table, records: as draftsdocsBrowser auditRuns the site in Chromium against the fileaudit

How the registry is built up

Add it to an existing app

consent-kit does not take over your stack. Each part of the application gets one piece, and you can wire them in one at a time.

Part of the applicationWhat you integrate
BuildGenerate files from the registry. consent-kit build && consent-kit docs
BrowserLoad the generated consent config, guard and storage facade.
HostingServe the generated policy and Content-Security-Policy header.
CIRun the browser audit against the app. consent-kit audit <url>

Compatibility: the consent banner is CookieConsent v3, configured from the registry. It replaces the banner you have now, and choices visitors made in that banner are not carried over. Everything before the banner works without it.

Each stage works without the ones after it: start with the registry and the generated documents, add the Content-Security-Policy header, then the banner, storage facade and guard where something needs consent, and the audit in CI.

Read the guide

You might not need a banner. This site has none.

A banner is for things that need consent. If nothing in your registry is based on consent, consent-kit generates no banner, and the audit fails if one appears anyway.

consent-kit.com is that case. It keeps your colour theme in localStorage and the sidebar's state for the tab, and it frames the demo from our own subdomain. Its registry is public, and every deploy is audited against it.

Whether a purpose may go without consent is a legal question. consent-kit enforces the basis you choose; it does not judge the choice.

website/privacy.registry.yaml excerpt
purposes:
  - id: site-operation
    basis: legitimate_interest
    retention: 30d

artefacts:
  - id: theme
    kind: storage
    area: local
    key: starlight-theme
    purposes: [site-operation]
    description:
      en: Remembers whether you chose the light,
        the dark or the automatic theme.

Additional capabilities

The core workflow is declare, generate, verify. These parts are optional: add them when your app needs them.

  • Consent receipts

    Keep a record of each banner decision, naming the policy and the purpose versions it was made on.

    Consent receipts
  • Generated records

    Get the record of processing activities and the processor list from the registry, as drafts.

    Documents and phrase review
  • Data subject requests

    Receive access and erasure requests on your own domain, with a record and a deadline reminder.

    Data subject requests

What the checks verify

consent-kit is a tool. It does not make your app compliant with the GDPR, the ePrivacy Directive or any other law. Here is what its checks can show, and what they cannot.

Not legal advice

What they establish

  • The generated files share one registry, so they describe the same declarations.
  • On pages served with the generated policy, the browser blocks loads from origins the registry does not declare. Any loosening is listed as a deviation.
  • On the pages the audit ran, the site did nothing undeclared and nothing consent-bound before consent.

What they do not

  • That your registry is complete or true. It knows what you declared.
  • That your lawful bases hold, or that your consent is valid in law.
  • That your documents are sufficient. They are drafts until someone qualified reviews them.
  • Anything about your servers, logs or what your processors do.

FAQ and compliance notes, with the condition each statement depends on

Get started

The tutorial takes about half an hour. It takes a small static site from an empty folder to a passing browser audit and a first release. Everything runs on your machine.

  1. Install the CLI

    Node.js 22 or newer.

    npm install --save-dev @consent-kit/cli
  2. Write privacy.registry.yaml

    Every cookie, storage key, script, iframe and endpoint, with its purpose and lawful basis.

    npx consent-kit check
  3. Generate the rest

    Banner configuration, CSP, guard, storage module, then the documents.

    npx consent-kit build && npx consent-kit docs
  4. Audit the running site

    In Chromium, locally and in CI. Install @consent-kit/audit first: it brings Playwright.

    npx consent-kit audit http://localhost:4173