Examples
Working example projects showing OpenPolicy integrations across different frameworks.
Explore these complete example projects to see OpenPolicy in action. Each example is a minimal, runnable app you can clone and use as a starting point.
Astro
A static site built with Astro using the @openpolicy/astro integration to generate policy pages at build time.
Demonstrates: @openpolicy/astro integration, static site generation, policy pages as part of a marketing/landing site.
Next.js
A Next.js app that uses the @openpolicy/cli to generate policy documents as part of the build process.
Demonstrates: CLI usage, generating Markdown or HTML output, integrating generated policies into a Next.js app.
Vite + React (TanStack)
A Vite + React app using TanStack Router and the @openpolicy/vite plugin to compile policies at build time.
Demonstrates: Vite plugin setup, serving policy pages as routes in a single-page app.
SvelteKit
A SvelteKit app using the @openpolicy/vite plugin to compile policies at build time, imported as raw HTML strings and rendered with {@html}.
Demonstrates: Vite plugin setup in a SvelteKit project, outputting to src/lib/policies/, serving policy pages as SvelteKit routes.
Vue
A Vite + Vue app that uses @openpolicy/vue to compile and render policies at runtime from a unified openpolicy.ts config.
Demonstrates: OpenPolicy provider, PrivacyPolicy / TermsOfService / CookiePolicy components, route-based policy pages in Vue Router.