OpenPolicy

Overview

Generate policy files from your openpolicy.ts config

OpenPolicy can compile your policy config to Markdown, HTML, or PDF files. This is useful for serving policies as static files, checking them into your repo, or sending them to legal.

See the Quick Start to render policies as React components instead.

How it works

At build time (or on demand via the CLI), OpenPolicy reads your openpolicy.ts config and compiles each section into a document. Each present section produces its own output file:

SectionOutput filename
privacyprivacy-policy.{ext}
termsterms-of-service.{ext}
cookiecookie-policy.{ext}

Output formats

FormatExtensionNotes
markdown.mdDefault
html.htmlStandalone HTML document
pdf.pdf

Options

  • Vite plugin — generates files automatically at build time; watches for changes in dev
  • Astro integration — wraps the Vite plugin for Astro projects
  • CLI — generate on demand, useful outside of a Vite build

On this page