npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-legal

v2.0.0

Published

Generate world-class legal policy Astro pages from a single config file

Readme

astro-legal

Comprehensive legal policy generation for Astro sites

astro-legal is a static‑first Astro integration that scaffolds professional legal policy pages from a single config file.

It exists for one reason:

Give every site a clear, editable legal foundation without starting from zero.

No runtime middleware.
No policy overwrites.
No guessing.
No forced legal claims.


What this plugin does

On astro dev, the plugin:

  • Ensures a legal.config.json file exists (first run only)
  • Loads and normalises configuration safely (fail‑closed)
  • Generates src/generated/legal.ts (the @legal runtime module)
  • Scaffolds enabled policy routes exactly once
  • Augments src/env.d.ts with @legal types
  • Watches config-files/legal.config.json and generates new routes when you enable them

What this plugin does NOT do

  • ❌ No runtime middleware
  • ❌ No policy overwrites
  • ❌ No legal guarantees or advice
  • ❌ No auto‑publishing or deployment
  • ❌ No layout‑less policy pages in v1

If configuration is invalid or disabled, no policies are generated.


Installation

npm install astro-legal

Setup

Run the interactive initializer:

npx astro-legal init

It will:

  • Write config-files/legal.config.json
  • Patch astro.config.* with the integration when it finds a standard Astro config file

After that, edit config-files/legal.config.json manually to turn on the policies you want and fill in the organisation, contact, and layout values. Saving the file during astro dev will create any newly enabled policy routes without forcing a restart.


Usage

Add the integration to your Astro config:

import { defineConfig } from "astro/config";
import astroLegal from "astro-legal";

export default defineConfig({
  integrations: [
    astroLegal()
  ]
});

Configuration location

On first run, the plugin ensures this file exists:

config-files/legal.config.json

Example configuration

{
  "enabled": true,
  "paths": {
    "base": "/legal",
    "layout": "/src/layouts/Layout.astro"
  },
  "effectiveDate": "2026-01-10",
  "contacts": {
    "legalEmail": "[email protected]",
    "privacyEmail": "[email protected]",
    "abuseEmail": "[email protected]",
    "lawEnforcementEmail": "[email protected]",
    "securityEmail": "[email protected]"
  },
  "organisation": {
    "name": "Example Company Ltd",
    "jurisdiction": "United Kingdom",
    "address": "123 Example Street, London, UK",
    "companyNumber": "12345678"
  },
  "policies": {
    "terms": true,
    "privacy": true,
    "csam": true,
    "abuse": true,
    "harassment": true,
    "content-moderation": true,
    "trust-safety": true,
    "security": true,
    "law-enforcement": true,
    "transparency": true,
    "vulnerability-disclosure": true,
    "incident-response": true,
    "gdpr": true,
    "ccpa": false,
    "uk-dpa": true,
    "data-retention": true,
    "data-processing": true,
    "subprocessors": false,
    "refunds": false,
    "billing": false,
    "pricing": false,
    "chargebacks": false,
    "financial-compliance": false,
    "dmca": true,
    "copyright": true,
    "trademark": true,
    "open-source": true,
    "user-content-license": true,
    "code-of-conduct": true,
    "ethics": true,
    "modern-slavery": true,
    "whistleblowing": true,
    "equal-opportunities": true,
    "api-usage": false,
    "ai-usage": false,
    "training-data": false,
    "automation": false,
    "third-party-services": true,
    "cookies": true,
    "acceptable-use": true,
    "disclaimer": true,
    "governing-law": true
  }
}

Generated output

On first run with enabled policies, the plugin scaffolds:

  • src/pages/<base>/<policy>/index.astro
  • src/generated/legal.ts

Each policy page:

  • Uses your required Astro layout
  • Includes an effective date
  • Exposes organisation and contacts from @legal

Policy registry

Only policies registered in the template registry can be generated. To add a policy:

  1. Create a renderer in src/templates/policies/
  2. Register it in src/templates/index.ts
  3. Enable it in legal.config.json

Failure behaviour

This plugin is intentionally fail‑closed.

If any of the following occur:

  • Config file missing
  • JSON invalid
  • enabled: false
  • paths.layout invalid

➡️ No policies are generated

Your dev server will continue normally.


License

MIT © Velohost UK Limited


Author

Built and maintained by Velohost UK Limited
https://velohost.co.uk/

Project homepage:
https://velohost.co.uk/plugins/astro-legal/