diff --git a/.env.example b/.env.example index f4d6fa1..2b735a0 100644 --- a/.env.example +++ b/.env.example @@ -96,6 +96,19 @@ SEO_PRODUCT_JSONLD=1 # so reviews the old site published to snort/primal were invisible to it. RELAYS=wss://relay.cashumints.space,wss://nos.lol,wss://relay.azzamo.net,wss://relay.snort.social,wss://relay.primal.net +# How many events a backfill has to read before it counts as having read anything. +# +# A backfill asks every relay above for the whole history of four kinds; on a working +# relay list that is thousands of events. Under this floor, discovery logs +# `ERROR discovery starvation suspected` and /api/health answers 503 with +# `discovery_starved: true` until the next backfill clears it. +# +# This exists because a RELAYS list missing the relay that carries the announcement +# archive returned about thirty events per backfill for a year, reported ok=true every +# time, and left the index at eight mints with every health signal green. Lower it only +# for a private or test relay that genuinely holds less; 1 disables the check. +#BACKFILL_MIN_EVENTS=200 + # Profile relays for the BUILD (kind 0, prerendered reviewer names on the home # page). A wider pool than RELAYS on purpose: relay.cashumints.space holds no kind # 0 at all and snort/primal hold almost none, so the two aggregators below are what diff --git a/.gitignore b/.gitignore index fbdefa8..ac50c20 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ node_modules/ dist/ .astro/ api/data/ -deploy/ *.log .DS_Store .env diff --git a/README.md b/README.md index cb7d38e..776ee63 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,15 @@ rating encoding, and the bugs this rebuild fixes. ## Requirements -- Node 22.18 or newer (native TypeScript type stripping, so no build step for the API) +- Node 20.18 or newer to build and to run what a build produces +- Node 22.18 or newer to *develop*: `pnpm dev`, `pnpm seed` and the `api` test scripts + run `src/*.ts` through node directly, which needs native type stripping - pnpm 9 or newer +`engines.node` is the first of those, not the second, on purpose: it is the floor a +deployment has to clear, and a production host should never be told it needs a newer +Node than the compiled service actually runs on. + ## Setup ```bash @@ -286,7 +292,56 @@ pnpm typecheck pnpm build ``` -Output lands in `web/dist/`. Every page is prerendered once per language, so ~55 mints +Three packages in order, and the order is a dependency chain rather than a habit: +`shared` emits the types and the warning copy both other packages import, `api` compiles +`api/src` to `api/dist`, and `web` prerenders against a running API. + +Output lands in `api/dist/` and `web/dist/`. + +### Live lists + +The prerendered mint list is a snapshot of what `GET /api/mints` said when the build ran. +It used to stay that until the next build, which is why there was a nightly timer: a mint +indexed at noon was reviewable at once — the 404 resolver saw to that — and had no card on +`/mints` until 03:30, beside cards whose ratings and statuses were equally old. + +`/mints`, `/fedimints`, `/lnurl-mints` and the home page's three top-six strips now refetch +that endpoint once, after paint, and rebuild their grids from the answer. One request per +page, no relays involved: card counts have always come from the API's ingested review +aggregates, and review *bodies* remain a mint page and `/reviews` concern. + +**The prerendered cards stay.** They are the first paint, they are what a crawler indexes, +and they are the whole page for a reader with no JavaScript — `