COMPLIANCE AS CODE FRAMEWORK

Consent isn't a checkbox.
It's a system.

OpenPolicy is the consent and compliance layer for your app. Privacy policy, cookie banner, and consent log — generated from your TypeScript, versioned with your code.

v0.0.32 · Apache-2.0

Svelte

OpenPolicy with Svelte

Native Svelte components for displaying OpenPolicy-generated legal pages in any Svelte 5 or SvelteKit app.

Install

bun add @openpolicy/sdk @openpolicy/svelte

Define your policy

// src/openpolicy.ts
import { definePrivacyPolicy } from "@openpolicy/sdk";

export default definePrivacyPolicy({
	company: { name: "Acme Inc.", website: "https://acme.com" },
	contact: { email: "privacy@acme.com" },
	compliance: { gdpr: true, ccpa: true },
});

Render in a route

<!-- src/routes/privacy/+page.svelte -->
<script lang="ts">
import { OpenPolicy, PrivacyPolicy } from "@openpolicy/svelte";
import config from "../../openpolicy";
</script>

<svelte:head>
	<title>Privacy Policy</title>
</svelte:head>

<main>
	<OpenPolicy {config}>
		<PrivacyPolicy />
	</OpenPolicy>
</main>

Why OpenPolicy for Svelte

  • Native Svelte 5 components — runes-ready, no ?raw HTML imports
  • Slot-friendly overrides — swap any heading, paragraph, or table renderer with a snippet
  • Works with SvelteKit SSR — renders cleanly server-side for instant first paint
  • Version controlled — policy text lives in your repo, not a third-party dashboard
  • GDPR & CCPA built in — flip compliance flags in your config, not in manual prose

SEE-ALSO.md