krahets/hello-algo
The system has two coupled halves: (1) a MkDocs Material documentation site whose source lives in docs/ with theme overrides in overrides/ and build config in mkdocs.yml, and (2) a multi-language code corpus in codes/ organized as chapter_* directories mirroring the book chapters. Four locale trees (en/, ja/, ru/, zh-hant/) replicate the whole structure, each with its own mkdocs.yml that uses INHERIT to extend the root config. The Dockerfile is the deployment entrypoint: it builds all five locale sites into a single site/ tree and serves it with python -m http.server on port 8000 via docker-compose. There is no runtime backend, database, or service layer — the only external integrations are CDN-loaded assets (MathJax, giscus) and GitHub Discussions for comments.
- Root mkdocs.yml defines the MkDocs Material site 'Hello 算法' v1.3.0 with docs_dir=build/docs, site_dir=site, theme 'material' with custom_dir=build/overrides — the staged build/ layout is produced by copying docs/ and overrides/ before building.
- Dockerfile is the deployment entrypoint: FROM python:3.10.0-alpine, installs mkdocs-material==9.5.5 and mkdocs-glightbox, runs 'mkdocs build' once for the root site and once per locale (zh-hant, en, ja, ru), then serves /hello-algo/site via 'python -m http.server 8000'.
- docker-compose.yml exposes the single 'hello-algo' service on host port 8000; there is no other service, volume, or network configuration.
- docs/ contains the Simplified Chinese source of the book: ~120 markdown files in chapter_* directories, plus per-page image directories named <page>.assets/, a minimal index.md stub, and a hand-written index.html landing page.
- codes/ holds 16 language subdirectories (c, cpp, csharp, dart, go, java, javascript, kotlin, python, pythontutor, ruby, rust, swift, typescript, zig, plus docker assets); each language dir mirrors the book with chapter_* folders of self-contained runnable samples.
- Each locale tree (en/, ja/, ru/, zh-hant/) is a near-complete copy of docs/ + codes/ with a locale mkdocs.yml that uses 'INHERIT: ../mkdocs.yml' config inheritance and overrides site_name, site_url, docs_dir (../build/<locale>/docs) and site_dir (../site/<locale>).
- Per-language manifests anchor each code subproject: codes/go/go.mod (module github.com/krahets/hello-algo, go 1.19), codes/rust/Cargo.toml (package hello-algo-rust with a [[bin]] entry per sample), codes/typescript/package.json (script 'check': tsc) + tsconfig.json (noEmit), codes/csharp/hello-algo.csproj, codes/c/CMakeLists.txt + codes/cpp/CMakeLists.txt, codes/zig/build.zig.
- CI is 13 per-language GitHub Actions workflows in .github/workflows/ (c, cpp, dart, dotnet, go, java, javascript, kotlin, python, ruby, rust, swift, typescript), each path-filtered to codes/<lang>/ and en/codes/<lang>/ and matrixed across ubuntu/macos/windows.
- The theme is customized through overrides/: main.html extends base.html to render a per-language announcement banner, and partials/{actions,comments,content}.html override Material's edit/view buttons, giscus comment injection, and prev/next footer.
- Comments are provided by giscus (GitHub Discussions backend): overrides/partials/comments.html injects the giscus.app client script with data-repo='krahets/hello-algo' and giscus.json whitelists the hello-algo.com origins.
- overrides/zensical/ is a parallel, second theme/toolchain configuration (zensical.toml with its own extra_css/extra_javascript) for the Zensical static site generator, including an animation_player.js not present in the MkDocs theme — indicating an in-progress migration target. (inferred)
- Shared helper code lives in per-language utility packages: codes/python/modules/ (ListNode, TreeNode, Vertex, print_util), codes/javascript/modules/, codes/typescript/modules/, codes/go/pkg/, codes/rust/src/include/ (via src/lib.rs 'pub mod include'), codes/c/utils/.