This document describes how aphgames-web (package name aphgames-web) is structured, what it ships at runtime, and how it connects to external repositories and services. It is aimed at engineers and coding agents onboarding onto the project.
The site is a static documentation and teaching hub for APHGames: learning materials (Markdown/MDX), embedded interactive examples (canvas games/demos), Reveal.js HTML slides, course pointers, a student project gallery, and ancillary pages (e.g. Czech-only curated links). There is no application server in this repo; production is static files (typically hosted behind a CDN or static host). Build-time Node scripts fetch large binary artifacts; the running site only needs those files under static/.
| Area | Choice |
|---|---|
| Framework | Docusaurus 2.0.0-beta.17 (@docusaurus/core, @docusaurus/preset-classic) |
| UI | React 17, MDX v1 (@mdx-js/react) |
| Styling | Global SCSS (docusaurus-plugin-sass, src/css/global.scss) + CSS modules for pages |
| Search | Vendored @cmfcmf/docusaurus-search-local under plugins/docusaurus-search-local (Lunr-based local search) |
| TypeScript | Used for authoring src/ and some docs; Docusaurus does not rely on tsc for its main build (see tsconfig.json comment) |
| Tooling | ESLint (Airbnb), fork-ts-checker-webpack-plugin in dev |
Important: Locale and site URL are chosen at config load time from the CLI (--locale), not from Docusaurus’s multi-locale runtime. Each production language is effectively a separate build (see §5).
flowchart TB
subgraph build [Build time Node]
DC[Docusaurus webpack build]
DL[scripts/download_data.js]
WEB[web.config.js]
WEB --> DC
WEB --> DL
DL -->|ZIP| EX[static/examples]
DL -->|ZIP| SL[static/slides]
DL -->|JSON| TI[static/tiscali.json]
end
subgraph repos [External GitHub releases]
ER[APHGames/examples release.zip]
SR[APHGames/slides release.zip]
TG[support tiscali JSON]
ER --> DL
SR --> DL
TG --> DL
end
subgraph output [Static site output]
HTML[HTML / JS bundles]
HTML --- EX
HTML --- SL
end
DC --> HTML
subgraph runtime [Browser]
DOC[Docs MDX pages]
CAN[APHCanvas + window.APH examples bundle]
SLV[Reveal slides as static HTML under /slides/]
GAL[Gallery links to gallery.aphgames.io]
DOC --> CAN
DOC --> SLV
end
HTML --> runtime
- Docusaurus turns
docs/,blog/,src/pages/, and theme overrides into a SPA + static assets. download_datapulls versioned release ZIPs for examples and slides (URLs and versions live inweb.config.js), plus a filtered JSON dump for the Czech “artifacts” page.- Examples ship as a prebuilt JS bundle consumed in the browser (
static/examples/); they are not compiled from this repo’s TypeScript sources. - Slides ship as static Reveal.js HTML, icons, and
slides-info.json; listing UIs read that JSON and link to/slides/*.html.
| Path | Role |
|---|---|
docusaurus.config.js |
Main Docusaurus config; merges web.config.js into customFields; wires plugins, navbar, i18n single-locale mode, docs sidebar generator hook |
web.config.js |
Domains, GitHub URLs, examples / slides release coordinates, gallery_url, tiscali_url |
sidebars.js |
Single autogenerated sidebar: tutorialSidebar → docs/learning |
docs/ |
Primary Markdown/MDX content (learning/, courses/, brand.md, …) |
i18n/cs/, i18n/en/ |
Per-locale strings (code.json, news.json), translated doc copies under docusaurus-plugin-content-docs/current/, and locale-specific React (components/About.tsx) |
src/pages/ |
Custom pages: home (index.tsx), gallery.tsx, Czech artifacts.tsx |
src/APHCanvas.tsx |
Bridge from MDX to the examples bundle (window.APH[name]) |
src/theme/ |
Swizzled theme pieces (DocPaginator, NavbarItem/NavbarNavLink) |
src/css/, src/components/ |
Shared styles and small UI helpers |
src/internals/ |
Data modules (gallery-data.ts, resources-data.ts, Prism themes, …) |
static/ |
Images and other static assets; examples/, slides/, tiscali.json are gitignored and produced by download_data |
plugins/docusaurus-search-local/ |
Local search plugin copy |
scripts/download_data.js |
Downloads and extracts external ZIPs + JSON |
web.config.jsdefinesurls.csandurls.en(e.g. aphgames.cz vs aphgames.io).docusaurus.config.jsreadsprocess.argvfor--localeand sets:i18n.defaultLocaleandi18n.localesto only that locale (the other language is on another domain, not bundled as a second locale in one artifact).
- NPM scripts mirror this:
start_cs/build_cs/deploy_csvsstart_en/build_en/deploy_en.
- Navbar labels, keywords, and many UI strings come from
i18n/<locale>/code.json. - Home page news is loaded from
i18n/<locale>/news.json. - The About block on the home page is loaded via
react-loadablefromi18n/<locale>/components/About.tsx(so copy/layout can diverge per language).
- Canonical English docs live under
docs/. - Czech overrides live under
i18n/cs/docusaurus-plugin-content-docs/current/(mirrored paths). - Per-doc language gating:
sidebarItemsGeneratorindocusaurus.config.jsfilters out docs whose front matter includesexclude_csorexclude_enfor the active build. Examples in tree:docs/courses/aph.mdanddocs/learning/03-aph-requirements.mduseexclude_en: true(Czech-oriented course material).
- Navbar injects Artifacts and a YouTube icon link only when
currentLocale === 'cs'(docusaurus.config.js). src/pages/artifacts.tsxis a Czech-facing page backed bystatic/tiscali.json.
- Sidebar:
sidebars.jsautogenerates from folderdocs/learningonly. Other doc routes (e.g.docs/courses/,docs/brand.md) are reached via explicit links/nav, not the main tutorial sidebar. - MDX: Docs can import React/TSX modules (e.g.
@site/docs/learning/lectures.tsx,@site/src/APHCanvas.tsx). - Intro + slides index:
docs/learning/01-intro.mdembeds<Lectures />fromdocs/learning/lectures.tsx, which readsstatic/slides/slides-info.jsonand groups slides for the current locale, excluding course-tagged rows (!sl.course). - Course slides:
docs/courses/aph.mdembedsdocs/courses/aph_lectures.tsx, filteringslides-info.jsonforlocalematch andcourse === 'APH', with optional locked tiles (locked === 'true'string from JSON).
- Not the TypeScript sources. At build/dev time,
npm run download_datadownloadsrelease.zipfrom the configured GitHub releases asset and extracts it tostatic/examples/(ignored by git).
src/APHCanvas.tsxruns only in the browser (typeof window !== 'undefined').- On first use it sets
window.BASE_URL = '../../../../examples'andwindow.parcelRequire = null, thenrequire('@site/static/examples/examples')to load the bundle. - It instantiates
new window.APH[name](config), calls.init(canvasDomElement), and.destroy()on unmount. - MDX pages pass a string
namematching an exported example class (e.g.<APHCanvas name={'Tetris'} />).
- The examples bundle is built from the examples repository; those demos are described in copy as using COLF.io (minigame layer on PixiJS). This site documents and embeds them; it does not list
colf.ioas an npm dependency.
- Bump
examples_versioninweb.config.jsto match a published APHGames/examples release, then rerunnpm run download_data.
- ZIP extracted to
static/slides/: HTML decks (e.g.tutorial_….html),slides-info.json,icons/, assets. Path is gitignored.
- Direct static URLs:
/slides/<file_name>.htmlwith query variants?print-pdfand?presentation(Reveal.js conventions). - Discovery UI:
lectures.tsx(general) andaph_lectures.tsx(APH course) render cards fromslides-info.json(group,name,file_name,locale,category,course,locked, …).
docs/learning/misc/slides.mddocuments Reveal keyboard shortcuts and expectations.
- Bump
slides_versioninweb.config.js, runnpm run download_data.
- Implemented in
src/pages/gallery.tsxwith data fromsrc/internals/gallery-data.ts. - Game tiles link to
gallery_urlfromweb.config.js(e.g.https://gallery.aphgames.io) with paths like{galleryUrl}/{item.id}/; screenshots are expected at{galleryUrl}/{item.id}/screenshot.jpg. - The gallery is not stored in this repo; this project only links out.
- Configured in
docusaurus.config.jsas a file path plugin:plugins/docusaurus-search-local. - Indexes docs, blog, and pages; Lunr
languageis set to["en", "ru"]where Russian is used as a stand-in tokenizer config for Czech (comment in config: cs not supported out of the box). style: undefinedavoids injecting default plugin CSS (custom styling expected elsewhere).
DocPaginator: swizzled to rendernull— prev/next doc footer navigation is disabled site-wide.NavbarNavLink: small customization aroundLink/ active class behavior.- Color mode: default dark, switch disabled (comment: avoiding maintaining two diagram themes).
- Prism: custom light/dark themes under
src/internals/prism-aph-*.js.
npm installnpm run download_data— downloads examples ZIP, slides ZIP, andtiscali.json(Node 18+ built-inhttp/https).npm run start_enornpm run start_cs— Docusaurus dev server.
npm run build_en/npm run build_cs— outputs underbuild/(gitignored).
docusaurus deployscripts exist per locale; hosting is static (see README: aphgames.io / aphgames.cz).
npm run linttargetssrc,i18n,docs.
| Field | Purpose |
|---|---|
urls.cs / urls.en |
Canonical site origins per language build |
owner, org |
Branding / copyright |
github, youtube |
External links (navbar) |
examples_url, examples_version |
GitHub repo + release tag for examples ZIP |
slides_url, slides_version |
GitHub repo + release tag for slides ZIP |
gallery_url |
Base URL for hosted student games |
tiscali_url |
JSON for artifacts page |
All of the above are spread into Docusaurus siteConfig.customFields for use in React (useDocusaurusContext).
- Docusaurus beta.17 is dated; upgrading will touch webpack, MDX, i18n, and the swizzled theme APIs.
APHCanvasdepends on globals and a Parcel-style examples bundle; changing the examples build output may require edits toBASE_URL,requirepath, or constructor names.download_datausesSSL_VERIFYPEER: false— acceptable only in a trusted controlled environment; revisit for CI security policy.- Course / intro links in navbar point to
/docs/learning/intro; the on-disk intro file isdocs/learning/01-intro.md— confirm URL aliases or fix links when changing doc slugs.
| Term | Meaning here |
|---|---|
| Examples | Prebuilt JS bundle from APHGames/examples, embedded via APHCanvas |
| Slides | Reveal.js HTML decks from APHGames/slides, served as static files |
| COLF.io | External engine/library used by examples and gallery Pixi titles (documented, not vendored as source in this repo) |
customFields |
web.config.js merged into Docusaurus config for runtime access |
Document generated to reflect the repository as of the project state when authored. When in doubt, treat docusaurus.config.js, web.config.js, and scripts/download_data.js as the source of truth for wiring and versions.