- TypeScript 100%
AT Protocol PLC directory stats #
Overview #
Scripts behind the Sifa ID stats page at sifa.id/stats. They crawl the PLC directory, count identities per PDS, and build the JSON the stats page reads. The methodology is documented at sifa.id/stats#methodology.
This repository is an auto-synced copy. The Sifa codebase is the source of truth, and edits made here will be overwritten. To report a problem or propose a change, contact hello@sifa.id.
Scripts #
| File | Purpose |
|---|---|
scripts/fetch-plc-updates.ts |
Crawler. Pages through the PLC directory by seq, keeps state in SQLite, and writes CSV and migration output. Flags: --max-minutes, --limit. |
scripts/build-stats-data.ts |
Converts the CSV output into the stats JSON. |
scripts/check-reachability.ts |
Sampled handle-to-DID check for current accounts on hosts with 10 or more identities. Flags: --max-minutes, --concurrency. |
scripts/plc-provider.ts |
Groups endpoints into providers. |
scripts/plc-pagination.ts, scripts/reachability-sample.ts, scripts/reachability-estimate.ts, scripts/run-deadline.ts, scripts/retry-after.ts, scripts/util-error.ts |
Shared helpers. |
Quick start #
Requires Node.js 22.5 or later (for the built-in node:sqlite module) and tsx.
The scripts expect a data/ directory next to scripts/.
npx tsx scripts/fetch-plc-updates.ts
npx tsx scripts/build-stats-data.ts
The first run of fetch-plc-updates.ts is a full crawl. It processes roughly 130 million operations and takes hours. Later runs resume from the stored cursor.
Optionally, run the reachability check:
npx tsx scripts/check-reachability.ts
Output files #
| File | Contents |
|---|---|
data/plc-state.db |
Crawl state and cursor. |
data/plc-count-by-pds.csv |
Identities per PDS, with reachability. |
data/plc-count-by-pds-daily.csv |
Daily creates per PDS. |
data/plc-migrations.json |
Provider switches. |
data/plc-reachability-through.txt |
Date of the last reachability check. |
public/data/plc-stats.json |
Input for the stats page. |
Methodology #
The stats count every did:plc identity in the PLC directory, including bots and spam, grouped by the PDS where each identity was created. For details, see the methodology section on the stats page.
License #
MIT, Singi Labs. See LICENSE.