OpenPolicy is a free, open source compliance & risk management project written in TypeScript and released under Apache-2.0. It has 163 GitHub stars, 8 forks and 0 open issues, and was last pushed 7 days ago. On this registry it ranks #45 of 45 tracked projects in Compliance & Risk Management, with 5 head-to-head comparisons available.

What is OpenPolicy?

PolicyStack is an open-source, AI-first toolkit that turns one typed TypeScript configuration into a privacy policy, a cookie policy and the consent state that gates the cookies those documents describe, rendering them inside a React, Vue, Svelte, Solid or Angular app rather than a third-party iframe, and it is built for front-end and product teams who need policy text and cookie consent to stay in sync with the code they actually ship.

What it is

PolicyStack is an open-source toolkit distributed as a monorepo of TypeScript packages published under the @policystack/* scope, all versioned together. It provides three building blocks. Policy is your privacy and cookie policy expressed as a typed config and rendered as components or Markdown. Consent is a headless consent state machine with a core under 4kb and adapters for React, Vue, Solid, Svelte and Angular. Cloud is an optional hosted control plane for versioning, audit trails and consent analytics that sits on top of the open-source pieces. Everything except Cloud is licensed under Apache-2.0. The project lives in the JavaScript and TypeScript web ecosystem, with the repository tagged for Astro, React, Vite and CLI use.

The concrete problem it solves is drift and outsourcing. Policies and cookie consent are normally maintained in a vendor dashboard or embedded through a third-party iframe, so the text that is published and the cookies the application sets can disagree without anyone noticing. PolicyStack replaces that arrangement by treating a single typed config as the source of truth for the policy, the cookie policy and the consent that gates the cookies. A Vite plugin compiles the config at build time and scans for undeclared third parties, and the consent scanner fails the build when it finds an ungated cookie, so a mismatch becomes a build error rather than a compliance problem discovered later.

Key capabilities

  • One typed config drives the privacy policy, the cookie policy and the consent state that gates the cookies those documents describe.
  • @policystack/sdk exposes the public API, including defineConfig() and renderLlmsTxt().
  • @policystack/renderers provides a shared Markdown, HTML and PDF render layer for the generated documents.
  • The consent runtime is a headless state machine with a core under 4kb, shipped through the ./consent subpath of @policystack/core.
  • Framework adapters cover React (./policy, ./consent, ./provider), Vue (./policy, ./consent), Svelte (./policy, ./consent), Solid (./consent) and Angular (./consent).
  • @policystack/vite compiles the config at build time, scans for undeclared third parties and fails the build on an ungated cookie.
  • @policystack/scripts supplies consent-gated third-party script loaders, and @policystack/cli covers install, configure and validate.
  • The optional Cloud control plane adds versioning, audit trails and consent analytics without being required for any of the open-source packages.

Who uses it and how

  • Front-end teams on React, Vue, Svelte, Solid or Angular render policy components directly into the application, so no third-party iframe appears in the page.
  • Teams already building with Vite or Astro adopt the plugin so policy compilation and the third-party scan run inside the existing build pipeline.
  • Teams that want their own banner rather than a vendor's use the headless consent machine and build the interface from their own components, since no UI is bundled.
  • Teams with audit or reporting requirements add the optional Cloud control plane for versioning, audit trails and consent analytics while keeping the open-source packages underneath.
  • Contributors working in the monorepo follow CONTRIBUTING.md, which documents setup, layout and the release flow for the jointly versioned packages.

Getting started

Run bunx @policystack/cli init. It installs the right packages for your stack, writes a starter policystack.ts and prints a prompt you can hand to a coding agent, with the full walkthrough in the quick start documentation.

How it compares

This registry entry does not list competing commercial products, and the project documentation does not name comparable open-source alternatives. On the facts available, PolicyStack stands alone in this registry.

When to use it — and when not to

PolicyStack is a good fit when your application already lives in a TypeScript or JavaScript build, because the open-source packages need no server of your own — only the build toolchain that compiles the config and runs the consent scanner. Two honest limits apply. No consent banner UI is bundled, so you must build and style that interface yourself, and the hosted Cloud control plane is not covered by the Apache-2.0 licence that applies to everything else, so teams needing versioning, audit trails or consent analytics should confirm the terms of Cloud before depending on it. PolicyStack also states plainly that it does not provide legal advice, so a lawyer should review the generated policies before publication; teams without a TypeScript front-end, or those expecting a finished banner and ready-made legal text out of the box, should look elsewhere.

project readme (upstream, from github) — read inline

PolicyStack

PolicyStack

Open-source, AI-first primitives for adding privacy policies and consent to your app. One typed config drives your privacy policy, your cookie policy, and the consent that gates the cookies they describe — all rendered directly into your React/Vue/Svelte/Solid/Angular app, never a third-party iframe.

Three building blocks

  • Policy — your privacy and cookie policy as a typed config, rendered as components or Markdown. A Vite plugin compiles it at build time and scans for undeclared third parties.
  • Consent — a headless consent state machine. Sub-4kb core, adapters for React, Vue, Solid, Svelte, and Angular, and a Vite plugin that fails the build on an ungated cookie. No bundled UI — you build the banner with your own components.
  • Cloud — an optional hosted control plane for versioning, audit trails, and consent analytics. It sits on top of the OSS pieces; you never need it to use them.

Everything except Cloud is Apache-2.0.

Quick start

bunx @policystack/cli init

init installs the right packages for your stack, writes a starter policystack.ts, and prints a prompt you can hand to a coding agent. See the quick start for the full walkthrough.

Packages

All packages publish under the @policystack/* scope and version together.

Package What it is
@policystack/sdk Public API — defineConfig(), renderLlmsTxt()
@policystack/core Compilation engine + consent runtime (./consent subpath)
@policystack/vite Vite plugin + opt-in consent scanner
@policystack/cli Install / configure / validate CLI
@policystack/renderers Shared Markdown / HTML / PDF render layer
@policystack/scripts Consent-gated third-party script loaders
@policystack/react React adapters — ./policy, ./consent, ./provider
@policystack/vue Vue adapters — ./policy, ./consent
@policystack/svelte Svelte adapters — ./policy, ./consent
@policystack/solid Solid adapter — ./consent
@policystack/angular Angular adapter — ./consent

Contributing

See CONTRIBUTING.md for setup, the monorepo layout, and the release flow. Apache-2.0 — issues and PRs welcome.

Not legal advice. PolicyStack generates policy documents from your config. It does not provide legal advice. Have a lawyer review your policies before publication. See the legal notice.

Contributors

Stargazers

RepoStars

More by Jamie

Name Description Website Repo
PolicyStack Privacy policies and cookie consent driven by the same configuration. policystack.dev GitHub
Sidequest A personal task manager designed with ADHD in mind. sdqst.app GitHub
Capd A private Mac app for saving and finding links, notes, and images. capd.jxd.dev GitHub
htomd Focused Markdown and metadata from messy HTML, in pure Python. GitHub

Frequently asked questions

Is OpenPolicy free to use?

OpenPolicy is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does OpenPolicy do?

Generate legal policies directly from TypeScript code

What is OpenPolicy written in?

OpenPolicy is primarily written in TypeScript. Its source is publicly available at https://github.com/jamiedavenport/openpolicy, and it has 163 GitHub stars.