BUCKYVERSE

Buckyverse Reader (apps/reader)

Static Astro reader that turns Codexis-derived EPUBs into a chapter-navigable, deep-linkable, math-faithful reading site. Sub-project 1 of the Wiki.js → Astro migration.

How it works

src/lib/epub/parseEpub.ts (pure, unit-tested) unzips an EPUB → parses the OPF spine + NCX TOC → sanitizes each chapter's XHTML (preserving MathML/SVG, stripping scripts, rewriting intra-book links and asset refs). An Astro content-layer loader (src/loaders/bookLoader.ts) emits one chapters collection entry per chapter and writes figures to public/books/<slug>/assets/. Routes in src/pages/read/[book]/… render the reader; Pagefind indexes the built HTML.

Books are listed in books.config.ts (paths point at the imported EPUBs at the repo root).

Develop

pnpm --filter reader dev      # http://localhost:4321 (search is inert in dev — needs a build)
pnpm --filter reader test     # vitest: the parseEpub library
pnpm --filter reader build    # astro build + pagefind index → dist/

Deploy

Auto-deploy on push: a pre-push git hook (dev/git-hooks/pre-push, symlinked into .git/hooks/ — re-link with ln -sf ../../dev/git-hooks/pre-push .git/hooks/pre-push in a fresh clone) rebuilds and deploys in the background whenever main is pushed from this machine. Progress: tail -f apps/reader/.deploy.log. Skip with BV_SKIP_DEPLOY=1 git push. Overlapping deploys are skipped (push again after the running one finishes).

Manual deploy — local build → Cloudflare Pages (project buckyverse-future, r26D account, OAuth via npx --no-install wrangler).

pnpm --filter reader build
npx --no-install wrangler pages deploy dist --project-name buckyverse-future --branch main --commit-dirty=true
# or: pnpm --filter reader deploy

Custom domain (one-time): in the Cloudflare dashboard (Pages → buckyverse-future → Custom domains) add future.buckyverse.org, then add a CNAME future.buckyverse.org → buckyverse-future.pages.dev on Route 53 (mirror the existing graph.buckyverse.org record).

Notes