BUCKYVERSE

Synergetics Dictionary Loader — Design (Sub-project 3)

Date: 2026-07-06
Status: Approved for planning
Sub-project: SP3 of the Wiki.js → Astro migration (docs/superpowers/specs/2026-07-06-wikijs-to-astro-migration-program-design.md). SP1 (reader) + SP2 (library/home/downloads) are live at future.buckyverse.org.
App: apps/reader/ (Astro 5 + pnpm, deploy via wrangler pages deploy).


1. Goal & success criteria

Bring the Synergetics Dictionary — ~21,188 cross-referenced cards — onto the Astro site as a browsable, searchable, deep-linkable section, at full parity with what Wiki.js serves today, while staying fully static and under Cloudflare Pages' 20,000-file limit.

Done when:

2. Source of truth & the import artifact

3. Card model (from the source)

A card carries: id (C#####, immutable, global), term (title, e.g. "Zero = Normal"), letter (one of 24 groups: a–w plus a combined xyz), definition html (verbatim RBF text with citations), crossRefs (links to other card ids, with optional dates), prevId/nextId (dictionary reading order), an optional figure imageId (image at images/cards/<letter>/<id>.jpg), and tags.

Distribution: 24 letter-groups, 21,188 cards. Largest: s 2,293, c 1,747, t 1,638, p 1,593; smallest j 46.

4. Architecture — one loader, grouped static pages

dictionaryLoader (apps/reader/src/loaders/dictionaryLoader.ts), a new Astro content-layer collection sibling to bookLoader/catalogLoader:

Routes:

Page-weight mitigation (large letters): each card <section> uses content-visibility: auto with a contain-intrinsic-size estimate, so offscreen cards cost ~nothing to render. The heaviest page (s, 2,293 cards) stays a single static file but renders responsively on mobile. Images are loading="lazy".

File budget: 24 letter pages + 1 index + ~10 front-matter pages ≈ ~40 files added to the deploy (currently 8,545). Comfortably under 20k with headroom as books grow.

6. Images → R2

The ~21,193 card figures do not enter the Pages deploy. They are offloaded to R2 (the existing downloads/assets bucket pattern) and referenced by URL, loading="lazy". A one-time upload of images/cards/** to R2 is part of SP3; the loader emits imageId → R2 URL. This removes ~21k files from the deploy on its own.

7. Search — per-card Pagefind results

Pagefind indexes the built letter pages, but must return individual cards, not "the S page." Each card <section> is marked as its own Pagefind result body (data-pagefind-body on the section, with a per-card result title/meta = the term + id) so a query surfaces the specific card and links to its #<id> anchor. This is the primary search-quality tuning of SP3.

8. Scope

In: the 24 letter-group card pages, /dictionary/ index, the dictionary front-matter pages, cross-link rewriting, per-card Pagefind, card images→R2, the redirect map (definition), and (if chosen) the dict-repo JSON export script.

Out: cross-references from cards into book passages or .wiki/ concepts (that inter-corpus linking is SP5); the Wiki.js sync script retirement (SP6); dictionary content editing/review (that stays in the dict repo).

9. Testing

10. Risks

11. Definition of done

/dictionary/ is live on future.buckyverse.org: all 21,188 cards browsable by letter, deep-linkable by #<id>, cross-refs resolving, images loading from R2, Pagefind returning individual cards, the build fully static and ~40 files heavier, and the Wiki.js→Astro dictionary redirect map written for SP6.