Generate privacy and terms of service policies for your website or app. Define your policy config once in JSON, then generate well-structured HTML or Astro pages automatically.
npm install --save-dev policygenOr use directly with npx:
npx policygen initCreate a policygen.json config file in your project root:
npx policygen initThe init wizard walks you through policy-related questions. Pass --default to emit a blank config file instead.
The config file uses a JSON schema for editor autocompletion:
{
"$schema": "https://policygen.xyz/schemas/0.7/schema.json",
"output": {
"fileType": "html",
"cssFramework": "classes",
"locales": ["en"],
"privacyFilePath": "./privacy.html",
"termsFilePath": "./terms.html"
},
"entity": { "name": "Acme Inc.", "website": "https://acme.com", "address": "..." },
"privacy": { "..." : "..." },
"terms": { "..." : "..." }
}# Generate all policies
npx policygen generate
# Generate only privacy policy
npx policygen generate:privacy
# Generate only terms of service
npx policygen generate:terms- HTML — standalone HTML pages with configurable CSS framework support (plain classes, Tailwind, DaisyUI)
- Astro —
.astrocomponent files with optional layout wrapping and prop passing - Astro shells — optional nested shell components for shared navigation and footer chrome
Covers a wide range of compliance requirements:
- Platform support — web, mobile, desktop, and browser extensions
- Browser extension disclosures — permissions, host permissions, data collected, local vs. remote processing
- AI disclosures — providers, product uses, operator-supplied data handling, and automated decisions
- Regulatory compliance — GDPR, CCPA/CPRA, VCDPA, COPPA
- Cookie consent — consent mechanisms with named provider support
- Cross-border transfers — SCCs, BCRs, adequacy decisions
- Data breach notification — configurable notification timeframes
- Data Protection Officer — DPO contact details
- Third-party sharing and disclosure — analytics, advertising, processors
- Subscriptions & billing — auto-renewal, free trials, refund policies (none/full/prorated)
- User content — content licensing, DMCA takedown procedures
- Liability & disputes — liability caps, arbitration vs. litigation, mediation, governing law
- Service SLA — uptime targets, measurement timeframes, SLA refund types
- Force majeure — protection against events beyond your control
- Tax liability — jurisdiction-specific tax disclaimers
- Prohibited uses — crawling, spam, impersonation, illegal activity, and more
For full configuration reference and advanced usage, visit policygen.xyz.
The CI workflow tests the package and docs, then publishes an unpublished
packages/policygen/package.json version when changes land on main. Already
published versions are skipped. Registry failures fail the job rather than
being treated as an unpublished version. Bump the package version in the PR
when shipping a release; merging without a version bump does not release it.
Run pnpm build:policygen and commit the generated
packages/docs/public/schemas/<major>.<minor>/schema.json with that release.
CI rejects missing or outdated committed schemas. Before publishing, it verifies
the hosted schema matches the package's schema. If docs deployment has not
finished or fails, publication is blocked; retry CI after docs deploy successfully.
Publishing uses npm trusted publishing with provenance, without an npm token.
In the policygen package settings on npmjs.com, configure a GitHub Actions
trusted publisher with organization cosmicglue-io, repository policygen,
workflow filename ci.yml, and no environment. Allow direct npm publish.
See npm's trusted publishing guide.
To retry a failed release, run CI from the Actions tab using Run workflow
on main. Manual runs on other branches run checks but cannot publish.
PolicyGen is published and maintained by CosmicGlue.
MIT