Skip to content

Module Catalog

This catalog is not an API dump. It is a navigation layer for readers who want to move from architectural concepts to real files without losing the plot.

Reading rule

When in doubt, prefer three questions over one giant search:

  1. Which file owns this behavior?
  2. Is it persistent state, runtime session state, mode-specific state, or UI / delivery infrastructure?
  3. Does the logic belong in an orchestrator or a deep module?

Primary runtime modules

AreaFile(s)Role
App shellindex.html, app.jsEntry point and top-level orchestration
Keys and shared primitivessrc/keys.js, src/utils.js, src/shared.jsKey naming, utility functions, validation helpers
Persistencesrc/storage.js, src/settings-manager.jsData normalization, localStorage CRUD, settings policy
Gameplay statesrc/game-state.js, src/game-manager.jsSession coordination and pair-matching state machine
Modessrc/modes.js, src/modes/*.js, src/modes/registry.jsMode logic, registration, and specialization
Mode-specific statesrc/nback-state.js, src/recall-state.js, src/daily.js, src/adaptive.jsSpecialized workflows and progression helpers
Progression and scoringsrc/stats.js, src/achievements.js, src/fsrs.jsMetrics, unlock logic, mastery scheduling
UI infrastructuresrc/ui.js, src/ui-events.js, src/ui/renderer.js, src/modal-manager.jsDOM bindings, event wiring, rendering, accessibility
Feedback and effectssrc/effects.js, src/timer.js, src/confetti.js, src/pools.jsTimers, audiovisual feedback, card-face pools
Completion pipelinesrc/pipeline/win-pipeline.jsOrdered post-win side effects
Offline deliverysw.js, manifest.webmanifestCaching, installability, and resilient asset delivery

Deep modules worth special attention

FileWhy it is deep
src/game-manager.jsA tiny interface hides match validation, board lock behavior, move counting, and win detection.
src/modal-manager.jsOpen/close looks simple, but the module also owns focus trapping, stack management, and focus restoration.
src/ui/renderer.jsIt packages DOM rendering concerns so orchestration code can request effects without hand-writing DOM mutations everywhere.
src/pipeline/win-pipeline.jsIt turns a many-step completion flow into an ordered, inspectable pipeline.
src/game-state.jsIt presents a unified session surface while delegating specialized responsibilities to deeper modules.

Module boundary notes

Persistence boundary

  • src/keys.js defines naming conventions.
  • src/storage.js performs low-level safe load/save/normalize work.
  • src/settings-manager.js adds policy, validation, notifications, and a higher-level interface.

Runtime state boundary

  • src/game-state.js owns the live session contract.
  • src/game-manager.js handles concentrated pair-matching logic.
  • src/timer.js handles timing behavior instead of turning GameState into a clock implementation.

Mode boundary

  • src/modes.js provides shared mode logic helpers.
  • src/modes/registry.js formalizes mode registration and switching.
  • src/modes/*.js and dedicated mode state files keep mode-specific code isolated.

UI boundary

  • src/ui.js is the source of truth for bound elements.
  • src/ui-events.js wires interactions.
  • src/ui/renderer.js turns state changes into DOM updates.
  • src/modal-manager.js centralizes accessibility-sensitive modal behavior.

Script loading order

The runtime is composed in index.html through ordered script tags. A condensed view:

text
src/keys.js → src/utils.js → src/shared.js → src/stats.js → src/achievements.js
→ src/modes.js → src/import-export.js → src/storage.js → src/settings-manager.js
→ src/fsrs.js → src/nback-state.js → src/recall-state.js → src/adaptive.js → src/daily.js
→ src/game-manager.js → src/modal-manager.js → src/game-state.js
→ src/modes/registry.js → src/modes/classic.js → src/modes/countdown.js → src/modes/daily.js
→ src/modes/nback.js → src/modes/recall.js → src/i18n.js → src/effects.js → src/pools.js
→ src/timer.js → src/confetti.js → src/ui/renderer.js → src/pipeline/win-pipeline.js
→ src/ui-events.js → src/ui.js → app.js

This order is part of the architecture, not incidental trivia.

Where to start for common edits

If you want to change...Start withCross-check
Match / flip rulessrc/game-manager.jssrc/game-state.js, tests
Persistent settingssrc/settings-manager.jssrc/storage.js, src/keys.js
Leaderboards / stats / achievementssrc/storage.js, src/stats.js, src/achievements.jswin pipeline and related UI
N-back behaviorsrc/nback-state.js, src/modes/nback.jssrc/modes.js
Recall behaviorsrc/recall-state.js, src/modes/recall.jssrc/modes.js
Offline deliverysw.jsmanifest.webmanifest, index.html
Docs structuredocs/.vitepress/config.ts and relevant docs pagebilingual counterpart page

Final orientation

The fastest way to get lost in Mind Gym is to treat it as a flat pile of files. The fastest way to understand it is to read it as a set of boundaries: shell, persistence, runtime state, mode state, UI infrastructure, and offline delivery.