Haq/Knowledge base/Architecture
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.

Architecture guide

How Haq is built

Haq is a static web app with no server of its own. The law lives in open rule packs, a small engine compares your answers with those rules in your browser, and a watcher keeps the packs honest. Here is the whole path, from an official website to your phone.

Haq architecture: official sources become rule packs, are checked and built, served from Cloudflare and run in your browser; a watcher loops back to the sources. Official sources

India Code, RBI, ministries, apps

Rule packs

Open JSON: laws, routes, schemes, each with its source

Checks

Validate, tests, SHA-256 fingerprint per pack

Cloudflare

Static files, strict security headers

Your browser

Engine, packs, 3 languages, works offline

Watcher

Checks sources every week, flags changes

Swipe sideways to see the whole diagram.

Pink dots: a rule's path to your phone. Amber dot: the watcher looping back to the official sources.

The parts

Rule packs

Every law, platform policy and scheme is a JSON rule with a reference, a plain-language note, the conditions it applies under and a link to the official text.

Engine

A small JavaScript engine compares your answers with each rule's conditions (any, all, not) and shows which ones match, with its working.

Build and checks

On every change: pack validation, unit tests, a privacy-notice self-check, then a build that fingerprints each pack with SHA-256.

Delivery

Static files on Cloudflare with a strict Content Security Policy. A service worker caches the app so it works offline.

Translation

Hindi and Bengali are built in. Optional machine translation sends only the page's own text, never what you typed.

Watcher

A GitHub Action checks 126 official sources every week and opens an issue when one changes. Nothing changes in Haq without a person approving it.

Example: one rule, end to end

This is a real rule from the Report pack. If you said the abuse was verbal or online, the engine matches it and shows the note and the official source.

{
  "ref": "BNS 352",
  "old": "IPC 504",
  "title": "Intentional insult with intent to provoke breach of peace",
  "when": {
    "any": [
      "type:verbal",
      "type:online"
    ]
  },
  "note": "Rude or abusive words alone may not be enough: the insult must be likely to provoke a breach of peace.",
  "source": "https://www.indiacode.nic.in/handle/123456789/20062"
}

In the app it appears under Laws that may apply as BNS 352, with its note and a link to India Code. You read it and decide whether it fits.

Questions people ask#

Is there a server that sees my answers?

No. The app is static files on Cloudflare. Your answers, drafts and files are handled in your browser and never sent.

How does Haq know the packs weren't tampered with?

Each rule pack gets a SHA-256 fingerprint at build time. The app checks it before using a pack and refuses one that doesn't match.

How do laws stay up to date?

A watcher checks the official source of every law, rule and scheme every week. If a page changes, it opens an issue; a person reviews it and updates the pack in a pull request.

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.