andhbhakt README

The project's README from github.com/JCRYDER3/andhbhakt. As one markdown file: README.md.

Andhbhakt.org

A civic accountability platform that cross-references official government announcements against Comptroller and Auditor General (CAG) audit findings — so citizens can see the gap between political promises and ground reality.

Live site: andhbhakt.org


What it does

Stack

Layer Tech
Monorepo pnpm workspaces
Runtime Node.js 24, TypeScript 5.9
API Express 5 (artifacts/api-server)
Frontend React 19 + Vite + Tailwind CSS (artifacts/govlens)
Database PostgreSQL + Drizzle ORM (lib/db)
Validation Zod v4 + drizzle-zod (lib/api-zod)
API codegen Orval — OpenAPI spec → typed hooks + Zod schemas (lib/api-spec)
Bot protection Cloudflare Turnstile + HMAC-signed session cookie

Quick start

# Requires pnpm — https://pnpm.io
pnpm install

# Copy env vars and fill in your values
cp .env.example .env

# Create tables
pnpm --filter @workspace/db run push

# Load seed data (schemes, CAG audits, PIB entries — ~800 rows)
psql "$DATABASE_URL" -f lib/db/seed.sql

# Start the API server (port from $PORT env var)
pnpm --filter @workspace/api-server run dev

# Start the frontend (separate terminal)
pnpm --filter @workspace/govlens run dev

Environment variables

See .env.example for the full list. Minimum required:

Variable When Description
DATABASE_URL Always PostgreSQL connection string
PORT Always API server port (Replit sets this automatically)
SESSION_SECRET Production 64-char hex — signs session cookies. Generate: openssl rand -hex 32
ADMIN_TOKEN Production Token for /api/admin/* routes (X-Admin-Token header)
TURNSTILE_SECRET_KEY Production Cloudflare Turnstile bot-check secret
ALLOWED_ORIGIN Production CORS origin (e.g. https://govlens.in)

Where things live

artifacts/
  api-server/src/
    routes/          Express route handlers
    middlewares/     Auth, rate-limiting, cache, session
    jobs/            Background jobs (news fetcher)
  govlens/src/
    pages/           Frontend page components
    data/            Static civic data — schemes, state facts, ministers, manifestos, CAG reports
lib/
  db/                Drizzle schema + migrations
  api-zod/           Auto-generated Zod schemas
  api-spec/          OpenAPI 3.1 spec (openapi.yaml)

Architecture decisions

Static data in source files — scheme details, state facts, minister profiles, manifesto promises, and CAG report narratives live as TypeScript constants in artifacts/govlens/src/data/. This makes every data point auditable, diff-able, and contribution-friendly without a CMS. Only dynamic data (live PIB entries, CAG audit records, news) lives in the database.

Session cookie, not JWT — The Turnstile gate issues an HMAC-signed cookie. The server refuses to start in production without SESSION_SECRET.

Cloudflare in front — Production traffic passes through Cloudflare Turnstile + CF-Connecting-IP check + optional origin secret (CF_ORIGIN_SECRET). The cloudflareOnlyMiddleware is a no-op in development.

Admin via header only — X-Admin-Token is the only valid admin auth mechanism. Query-string tokens are rejected (they appear in server logs and browser history).

Data sources

All civic data is sourced from public documents:

Contributing

  1. Fork the repo and clone locally.
  2. Copy .env.example → .env and fill in DATABASE_URL, SESSION_SECRET, and ADMIN_TOKEN.
  3. Run pnpm install then pnpm --filter @workspace/db run push.
  4. Data corrections go in artifacts/govlens/src/data/ — each file has inline source citations.
  5. Open a PR with the source URL for any data change.

License

MIT

andhbhakt (JCRYDER3/andhbhakt)

Searching Database…

这是什么?Andhbhakt.org 是一个公民问责平台,它把印度政府的官方公告(PIB)与 CAG 审计结果及独立调查数据交叉比对,展示政治承诺与实际现状之间的差距。
这是一个在线网站,还是要我自己安装运行的东西?它主要是一个在线网站(andhbhakt.org),但完整源码是一个 pnpm monorepo,包含 Express API 和 React + Vite + Tailwind 前端,你也可以自行部署。
如何在本地运行这个项目?Fork/克隆仓库,把 .env.example 复制为 .env 并填入 DATABASE_URL、SESSION_SECRET 和 ADMIN_TOKEN,然后运行 pnpm install,再运行数据库推送脚本。
运行之前需要准备什么?至少需要 Node.js 24、pnpm(由 preinstall 检查强制要求)和一个 PostgreSQL 数据库连接字符串;生产部署还需要 64 字符的 SESSION_SECRET 和 Cloudflare Turnstile 密钥。
部署时最大的坑是什么?生产环境下若未设置 SESSION_SECRET,服务器会拒绝启动;管理路由只接受 X-Admin-Token 请求头——查询字符串形式的令牌会被明确拒绝,因为它们会泄露到日志和浏览器历史记录里。
这个网站面向谁?面向跟踪政府计划落实情况和各邦治理的印度公民、记者和研究人员,因为数据和界面都是双语的,并配有完整的印地语翻译。
计划评分卡是怎么构建的?2014 年以来的每一项重大政府计划,都会对照 PIB 新闻稿、CAG 审计结果,以及 NFHS-5、NCRB、MOSPI、ASER 等独立数据集进行评级。
什么是 Manifesto 追踪器?它把 2014、2019 和 2024 年竞选宣言中的承诺逐届与实际兑现证据进行对照。
公民数据来自哪里?公开文件:通过 ADR/myneta.info 获取的 ECI 财产申报、来自 cag.gov.in 的 CAG 报告、来自 pib.gov.in 的 PIB 新闻稿,以及全国调查数据(NFHS-5、NCRB、MOSPI、ASER)。
数据如何保持可信且可编辑?计划详情、各邦事实和部长档案等静态数据以 TypeScript 常量的形式存放,并附带内联来源引用,而不是用 CMS,因此每个数据点都可以做 diff,也便于通过 pull request 贡献。
Creator
JCRYDER3
Size
9.2 MB
Stars
151
Updated
CommitAug 13
Age
2mo
Commits · 90 Days