OpenPolicy()

POLICY-AS-CODE

The First Policy Framework for Busy Founders and Developers

Register Interest

README.md

Create legal policies the way developers build software. Our platform lets you generate privacy policies, terms of service, and other legal agreements directly from code—making them fast, accurate, and easy to maintain.

FEATURES.md

TypeScript-first

Define policies in the language you already know.

Multi-format output

Generate HTML, PDF, and Markdown at build time.

Vite integration

Drop into your existing build pipeline in minutes.

GDPR & CCPA ready

Built-in templates for the regulations that matter.

Version controlled

Policies live in your repo and ship with your code.

Always in sync

Regenerated on every build — never out of date.

Multi-jurisdiction

US, EU, UK and more supported out of the box.

Audit trail

Every policy change is tracked in git, reviewable in PRs.

Framework agnostic

Works with React, Vue, Svelte, or plain HTML.

GETTING-STARTED.md

Define your policies in TypeScript, then let the Vite plugin generate compliant HTML and PDF documents at build time. No lawyers, no templates—just code.

policy.ts
import { definePrivacyPolicy } from '@openpolicy/sdk'

export default definePrivacyPolicy({
    effectiveDate: '2026-01-01',
	company: {
		name: 'Acme Inc.',
		legalName: 'Acme Incorporated',
		address: '123 Market St, San Francisco, CA 94105',
		contact: 'privacy@acme.com',
	},
	dataCollected: {
		account: ['email', 'name', 'password'],
		usage: ['ip_address', 'browser', 'pages_visited'],
		payment: ['billing_address', 'last_4_digits'],
	},
	legalBasis: 'legitimate_interest',
	retention: {
		account: '3 years after account closure',
		logs: '90 days',
	},
	cookies: {
		essential: true,
		analytics: true,
		marketing: false,
	},
	thirdParties: [
		{ name: 'Stripe', purpose: 'payment processing' },
		{ name: 'PostHog', purpose: 'product analytics' },
	],
	userRights: ['access', 'rectification', 'erasure', 'portability'],
	jurisdiction: 'US',
})
vite.config.ts
import { defineConfig } from 'vite'
import { openPolicy } from '@openpolicy/vite'

export default defineConfig({
  plugins: [
    openPolicy({
		formats: ['jsx', 'pdf', 'markdown'],
	}),
  ],
})
routes/privacy-policy.tsx
import { PrivacyPolicy } from '@openpolicy/generated/privacy'

export default function Route() {
	return (
		<PrivacyPolicy />
	);
}

LLMS.md

OpenPolicy ships an llms.txt so AI coding assistants — Claude, Cursor, Copilot — understand the SDK. Paste this prompt into your assistant to generate a policy.ts from your existing codebase:

prompt.txt
Read this codebase carefully, then generate a policy.ts using the OpenPolicy SDK.

SDK reference: https://openpolicy.sh/llms.txt

Your output should capture:
- Every category of data collected and why
- All third-party services integrated and their purpose
- The applicable jurisdiction (US, EU, UK, etc.)
- Legal basis for processing
- User rights supported

Output only a single policy.ts using definePrivacyPolicy(). No explanations.