src/holds the TypeScript application. Key areas includecore/(simulation engine),entities/,systems/,rendering/,ui/, andutils/.src/config.tsandsrc/config/define simulation parameters and defaults.tests/containsunit/andintegration/suites (e.g.,tests/unit/.../*.test.ts).public/is for static assets served by Vite;assets/stores repo images (logo, screenshots).docs/contains user and educational documentation; build output goes todist/.
npm run dev— start the Vite dev server for local development.npm run build— type-check (tsc) and build the production bundle.npm run preview— serve the production build locally.npm run start— run the Express server (server.js), honoringPORT(default 3000).npm run lint— run ESLint oversrc/.npm run test,npm run test:watch,npm run test:coverage— Vitest runs (CI, watch mode, coverage).
- TypeScript (ES modules) with
strictcompiler settings. Keep changes type-safe and avoid unused locals/params. - Indentation is 2 spaces; use semicolons and single quotes, matching existing files.
- Naming:
PascalCasefor classes/types,camelCasefor variables/functions,kebab-casefor docs paths, and*.test.tsfor tests.
- Tests use Vitest. Place unit tests under
tests/unit/and integration tests undertests/integration/. - Name tests after the target module (e.g.,
SpatialHash.test.ts). - Prefer adding coverage when modifying core simulation logic or UI behavior.
- Recent commits use conventional prefixes like
feat:andfix:; follow the same pattern (imperative, short subject). - PRs should include: a brief summary, testing notes (
npm run testor a rationale if skipped), and screenshots/GIFs for UI changes. - Link related issues when applicable and highlight any config changes (e.g.,
src/config.ts).
- The local server reads
PORT; no other environment variables are required. - When adjusting simulation behavior, document the change in
docs/orPreylife.mdif it affects user-facing behavior.