Home/Projects/Haq/Integration guide
Read in your language

हिन्दीবাংলাEspañolFrançaisDeutschMore languages

Opens Google Translate, which sends this page's text to Google. The English is the reference. The Haq app itself has Hindi, Bengali, Spanish, French and German built in, offline.

Integration guide

Ways to build Haq into your own work, from a link to a CI compliance check, the JavaScript engines in your app, your own rule packs and a self-hosted copy.

Legal information, not legal advice Haq shows what the law says and where to go. Only the police and courts decide what an offence is. Check every result and act at your own discretion.

Haq is a set of plain files: HTML, JavaScript, Python and JSON rule packs. There is no server and no API key, so you can integrate it in several ways. Pick the lightest one that fits.

Permission first. Linking to Haq (option 1) is free for everyone. Options 2 to 5 use Haq's code or rule packs, which are all rights reserved: open an issue to ask for written permission before you start.

You want to Use
Point people to Haq from your site, app or helpdesk A link
Fail a build when your privacy notice misses a rule The CLI in CI
Show Haq's results inside your own app The JavaScript engines
Publish your company's rules, or add laws for your country Your own rule pack
Embed Haq, change it, or run it on your own domain A self-hosted copy

Each module has its own page. Link straight to the one people need:

Module Link
Home https://haq.abhisek-goswami.com/
Report abuse or harassment https://haq.abhisek-goswami.com/report.html
Government schemes https://haq.abhisek-goswami.com/benefits.html
Privacy notice checker https://haq.abhisek-goswami.com/compliance.html

The hosted copy cannot be shown inside an <iframe> on another site. Its security headers block framing, so nobody can wrap it in a look-alike page. To embed Haq, self-host it.

2. Check a privacy notice in CI#

The command-line checker exits with 1 when a rule is Missing, so a pipeline can stop a release until the notice is fixed. It needs Python 3.9 or later and nothing else.

python -m haq check PRIVACY.md --packs gdpr,dpdp --format md
Option Values
--packs gdpr, dpdp, both comma-separated, or a path to your own pack .json
--format text (default), md for a report, json for other tools

A GitHub Actions job:

name: Privacy notice check
on: [pull_request]
jobs:
  haq:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/checkout@v4
        with:
          repository: Abhisek-Goswami-personal/haq
          path: haq
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Check the privacy notice
        working-directory: haq
        run: python -m haq check ../docs/privacy.md --packs gdpr,dpdp --format md >> "$GITHUB_STEP_SUMMARY"

The report appears on the job's summary page. Pin the second checkout to a release tag (ref: v1.0.1) if you don't want rule changes to arrive without review.

3. Use the JavaScript engines#

The engines are small ES modules with no dependencies. They take a rule pack and some answers and return plain objects, so you can draw the results in your own design.

import { checkText } from "./engine.js";
import { buildReport, lawsFor, drafts } from "./report-engine.js";
import { matchSchemes } from "./benefits-engine.js";

const load = (p) => fetch(p).then((r) => r.json());

// Compliance: result.summary counts, and result.rules has one entry per rule
// (covered, partly, missing or not-found)
const gdpr = await load("packs/compliance/gdpr.json");
const result = checkText(noticeText, gdpr);

// Report: laws, routes and drafts for one incident
const india = await load("packs/report/india.json");
const uber = await load("packs/platforms/uber.json");
const answers = { place: "app", types: ["verbal"], victims: ["woman"], answers: { threat: true } };
const live = lawsFor(india, { ...answers, platform: uber }); // the live law panel
const report = buildReport({ pack: india, platform: uber, service: "rides", ...answers });
const text = drafts(report, { yourName: "…", date: "…", place: "…", whatHappened: "…" });
// report.laws and report.routes are plain objects to draw in your own design.
// text.platform, text.grievance, text.authority and text.police are { subject, body } drafts.

// Benefits: schemes sorted into likely, check and no
const schemes = await load("packs/benefits/india.json");
const { likely, check, no } = matchSchemes(schemes, { age: 32, sex: "woman", work: "unorganised", bank: true });

The answer values come from the pack: places, types, victims and questions in packs/report/india.json, and profile in packs/benefits/india.json. For who it happened to, use one of man, woman, child, transgender or unsaid, or group followed by who the group includes (for example ["group", "woman", "child"]), and add lgbtq when someone was targeted for being LGBTQ+. victimsFrom(who, group, lgbtq) in app/report-engine.js builds this list.

The Python engine (haq/engine.py) gives the same compliance results as engine.js. Both are tested against the same cases in tests/cases.json.

Keep the notice from DISCLAIMER.md wherever you show results: they are legal information as per law, not legal advice.

Checking packs you load#

Every build writes manifest.json, which lists each pack's version, review status and SHA-256 fingerprint. If you load packs from the hosted copy, compare the fingerprint before you use a pack, as common.js does. Builds can also be signed with Ed25519; the public key is in public-key.txt.

4. Write a rule pack#

Rule packs are JSON files under packs/. A company can publish its own platform pack, so that people using Haq see its real report steps and grievance contacts:

{
  "id": "platform-example",
  "name": "Example (India)",
  "short_name": "Example",
  "module": "platform",
  "version": "0.1.0",
  "status": "community-draft",
  "review": { "reviewed_by": "Your name", "reviewer_type": "self", "credential": "", "date": "2026-12-04" },
  "kind": "social",
  "category": "Social media",
  "intermediary": true,
  "ecommerce": false,
  "in_person": false,
  "rules": [{ "id": "EX-01", "title": "No harassment", "text": "…", "source": "https://…" }],
  "report": { "steps": ["Open the message", "Tap Report"], "url": "https://…" },
  "grievance": { "text": "…", "email": "grievance@example.com", "url": "https://…" },
  "sources": [{ "title": "…", "url": "https://…" }],
  "watch": ["https://…"]
}

Then:

  1. Run python -m haq.validate. It checks the shape, links, rule references and review fields.
  2. Open a pull request. Changes under packs/ need the code owner's approval.
  3. Pages listed in watch are checked every week. When one changes, an issue opens so the pack can be reviewed.

A pack can only be marked "verified" when its reviewer is a lawyer or a legal aid service. See Rule packs for every field, including compliance and benefits packs.

5. Self-host#

Want Haq on your own domain, embedded in your product, or with packs of your own? Self-hosting is set up with you: ask in GitHub Discussions, say what you want to build, and we will share what you need.

Haq is free to use. © Abhisek Goswami, all rights reserved. Suggestions, translations, legal reviews and feedback are welcome.

Still need help?

Email me directly and I'll reply myself, usually within two working days. Please don't include personal details of your case.