npm.io
1.0.1 • Published 8h agoCLI

ribil

Licence
UNLICENSED
Version
1.0.1
Deps
5
Size
89 kB
Vulns
0
Weekly
0

ribil

Run the Ribil land-records API backend (village maps + RTC) on any machine and expose it at https://api.ribil.co through a Cloudflare tunnel.

The Karnataka land-records site only accepts requests from Indian IPs, so the scraping API runs on a machine in India while the frontend is hosted elsewhere.

Install

npm i -g ribil

Requires Node 18+. cloudflared is used from your PATH if installed, otherwise it is downloaded to ~/.ribil/bin on first run.

Setup (once per machine)

ribil config set token <cloudflare-tunnel-token>
ribil config set convex-url https://<deployment>.convex.cloud
ribil doctor

Settings are stored in ~/.ribil/config.json (mode 600). Environment variables with the same names (RIBIL_TUNNEL_TOKEN, CONVEX_URL, ...) override the file.

For token mode, the tunnel's public hostname (api.ribil.cohttp://localhost:3001) must be configured in the Cloudflare dashboard. Creds-file mode (creds-file or creds-b64) generates the ingress rules locally.

Usage

ribil serve              # API + tunnel + latest-wins lease
ribil serve --quick      # temporary *.trycloudflare.com URL, no account needed
ribil serve --no-tunnel  # localhost only
ribil status             # check local and public API
ribil stop               # stop a backend started on this machine
ribil logs tunnel        # recent tunnel log
ribil help

When convex-url is set, only one machine serves at a time: starting ribil serve on a new machine takes over, and the previous machine shuts down automatically.

Browser-based endpoints (/api/download-pdf, /api/prefetch, forcePuppeteer) need Puppeteer, which is not bundled to keep the install small. The endpoints the app uses (/api/extract, /api/get-pdf-url, /api/rtc, /api/rtc/options, /api/pdf) are HTTP-only.

Keywords