India's crowdsourced registry of what bribes really cost.
Anonymous reports, aggregated into department rankings, city breakdowns and service-level averages.
chaipaani.fyi · File a report · Open data · Roadmap · Contribute
Chai Paani is a public ledger of petty corruption. People report the bribes they were asked to pay (or refused to pay) for everyday government services: a driving licence, a police verification, a property registration, a birth certificate. The reports are anonymised, moderated, clustered for corroboration, and published as open data that anyone can audit.
No accounts. No ads. No tracking. Everything a reader sees can be downloaded as CSV or JSON.
The site is designed so that even its operators cannot identify a reporter.
- There are no user accounts and no cookies for visitors.
- The client IP is hashed with HMAC-SHA256 under a key generated fresh each UTC day and deleted after two days (
hash_keys). Raw IPs are never stored or logged. After the key is gone, the hash cannot be reversed or correlated. - Free-text notes are scrubbed for phone numbers, emails and identifiers before storage. Text that looks like it names a person is held for human review and never auto-published.
- Evidence files (UPI statements) are parsed in memory and never written to disk. Only the matched transaction's SHA-256 UTR hash, amount, date and normalised counterparty are kept.
POST /api/reports
validate (zod, field errors) lib/reporting/schema.ts
Turnstile (skipped when unset) lib/reporting/turnstile.ts
rate limit 3/day per hashed network lib/reporting/ratelimit.ts
PII scrub + possible-name detection lib/reporting/pii.ts
insert (public_id CP-XXXX) lib/reporting/submit.ts
corroborate lib/reporting/corroborate.ts
Every submission enters the moderation queue as held and appears publicly only after a moderator publishes it. Submissions return a one-time evidence_token; it is the only way to attach evidence later, and only its SHA-256 hash is stored.
Reports are never called "verified". The trust ladder is:
| Tier | Meaning |
|---|---|
reported |
A single anonymous report |
corroborated |
Three or more reports from distinct networks, same department, city, service and 30-day window |
evidence_backed |
A UPI statement matched the reported transaction with a score of 80+ |
Readers can vote (POST /api/vote, unique per report, kind and network hash); five fake flags exceeding helpful votes hold a report automatically. Anyone named in a report can file a takedown (POST /api/takedowns), which holds it immediately pending a moderator's decision.
- Statistics snapshots. Public pages never run aggregate SQL per request. Every number comes from the
stats_snapshotstable, one indexed row per statistic, refreshed by write triggers, a scheduled job andnpm run jobs:refresh-stats.GET /api/health?deep=1shows each snapshot's age. - Complaint letters.
POST /api/complaintdrafts a formal complaint addressed to the state Lokayukta / ACB and the CVC from a published report. - Open data.
GET /api/dump/latest.csv|jsonexports all published reports, public fields only. - Moderation.
/admin(HTTP Basic auth) lists held, published and removed reports with publish, remove and hold actions. Every action is written to an audit log.
- Evidence tokens. 32 random bytes, base64url, returned once at submission. Only
sha256(token)is stored; comparison is constant time; uploads are refused 30 days after filing. - Admin CSRF. State-changing admin requests must be same-origin (
Sec-Fetch-Site, with anOriginfallback). Redirect targets accept only relative same-origin paths. - Brute force. Failed admin logins are counted per client (10 per 15 minutes) and delayed. In production, pair with an edge rate-limiting rule on
/admin*. - File parsing. 5 MB cap, magic-byte sniffing, 30-page and 8-second PDF limits, 2 MB cap on extracted text.
- Search. ILIKE wildcards are escaped; terms are capped and length-checked.
- Takedown abuse. Takedowns have their own daily limit per network; after a rejection, repeat requests within 30 days are logged but do not re-hold the report.
npm install
npm run dev # http://localhost:3000, embedded PGlite, demo data seeded on first boot
npm test # vitest, 62 tests against in-memory PGlite
npm run buildNothing is required for local development. Copy .env.example to .env.local to configure:
| Variable | Purpose |
|---|---|
DATABASE_URL |
PostgreSQL connection string (falls back to embedded PGlite in dev) |
ADMIN_USER / ADMIN_PASSWORD |
Enables /admin |
TURNSTILE_SECRET |
Enforces the human check on submissions |
CRON_SECRET |
Authorises GET /api/cron/refresh-stats |
REQUIRE_APPROVAL |
Pre-moderation, on by default; set 0 to auto-publish |
Scripts: db:migrate (apply drizzle/*.sql), db:seed (taxonomy and demo reports, idempotent), db:generate (drizzle-kit diff after editing lib/db/schema.ts), jobs:corroborate (recompute clusters), jobs:dump (write open-data exports), jobs:refresh-stats (recompute statistics snapshots).
- Create
lib/evidence/parsers/<provider>.ts. For CSV exports extendGenericCsvParserwith a column map; for other formats implementTransactionParser(canParse,parse). - Register it in
lib/evidence/registry.tsbefore the generic parsers. - Add a synthetic fixture under
tests/fixtures/(no real statements) and a test case.
Next.js 14 (App Router), TypeScript, Tailwind CSS, Drizzle ORM on PostgreSQL (embedded PGlite for dev and tests), deployed serverless. Hand-written SQL migrations in drizzle/.
Yes, please. This is volunteer-built civic infrastructure, and the roadmap is longer than the hands available. The dev experience is deliberately frictionless: clone, npm install, npm run dev, and you have the whole site with an embedded database and demo data. No PostgreSQL, no Docker, no env vars.
Good entry points:
- Write a UPI parser (Paytm, BHIM, bank statement formats): self-contained, with a pattern to copy and the guide above.
- Verify complaint authority addresses in
lib/complaint/authorities.ts: no code required, directly improves the complaint letters. - Translate the report form into Hindi or a regional language.
Read CONTRIBUTING.md first; it covers setup, project layout, and the anonymity ground rules every PR is held to (no IP logging, no trackers, no exceptions). Security issues go through GitHub's private vulnerability reporting, never the public tracker.
AGPL-3.0. If you run a modified version of this software as a service, you must publish your changes. That is deliberate: a transparency site should itself be transparent.
A Fourth Echelon Initiative
