Builder
packages/builder generates api/**/*.json from WCA Export TSV v2.
Pipeline
fetchExportInfo— compareexport_date(skips when unchanged unless--force)- Download + extract TSV zip (or
--from <dir>) - Load tables into
MemoryStoreand build inverted indexes - Emit entity JSON with paged overviews
- Write
version.json+manifest.json
CLI
bash
bun packages/builder/src/cli.ts build \
--out api \
--work .work \
[--from .work/export] \
[--only continent,country,event] \
[--person-shard] \
[--force] \
[--connections 4] \
[--tsv-url https://.../export.tsv.zip]Performance notes
- Bottlenecks are usually assembly/JSON CPU and small-file metadata I/O, not disk bandwidth.
- Person emission uses a concurrency pool (
mapPool). - Export download uses parallel HTTP Range chunks (
--connections, default 4) with per-chunk retries. On HTTP 429 it backs off longer and honorsRetry-After. Raise connections only if your origin allows it — the WCA export host rate-limits aggressive parallelism. - Use
--onlyduring development to iterate quickly. - Optional
--person-shardwritespersons/shard/{xx}/{id}.jsonto improve filesystem behavior on some hosts.
Tests
bash
bun test packages/builder