Getting Started

Rah6 is an npm-workspaces monorepo. One npm install at the root covers all three workspaces.

Layout

rah6/
├── engine/   Pure TypeScript reducer + bet catalog + chip registry. NO I/O.
├── server/   Express + ws + Postgres. The only thing that runs the reducer.
└── client/   React + Vite. Talks to the server over HTTP + WS only.

Strict one-way dependency flow: engine → server → client. See Architecture.

Run + test

npm install
npm run build --workspace engine          # build engine first; server/client import dist/
 
# Two terminals:
npm run dev:server                         # http://localhost:6336 — HTTP + WS
npm run dev:client                         # http://localhost:5173 — proxies /api + /ws to :6336
 
# Full test suite (engine + server + client)
npm test --workspaces
 
# Typecheck only
npm run lint --workspaces

Default port: 6336 (“hard six: 3+3 = 6, 6”). Set PORT to override.

Persistence (optional)

Postgres is optional — the server boots in memory-only mode if DATABASE_URL is unset (it warns at startup). To enable persistence:

cp server/.env.example server/.env   # then set DATABASE_URL
createdb rah6

The rooms table is created automatically on boot. See Persistence & Replay.

Verifying the running app (don’t skip for UI work)

npm test runs in jsdom — it proves component logic, not that the app renders and drives in a real browser. For client/UI changes, also run the real-browser smoke test:

npm run smoke-test --workspace client      # self-starts server + client, drives Chromium, cleans up

The script (client/scripts/smoke-test.mjs) is committed and self-contained: it starts the server (:6336) and client (:5173) if they’re down, drives a real Chromium, screenshots to the gitignored client/.smoke-test-screenshots/, and tears everything down. It needs Playwright (npm install --save-dev playwright && npx playwright install chromium), kept out of package.json deps so the default install stays lean.

  • --fresh frees :5173/:6336 and starts clean (the hard self-heal).
  • SMOKE_CLIENT_URL / SMOKE_SERVER_URL override the targets (e.g. when Vite auto-increments to :5174).

Conventions

  • Commit format: <type>(<scope>): <subject>. Types: feat, fix, chore, docs, refactor. Scope is engine / server / client / docs.
  • No emoji in code or commit messages unless asked.
  • Tests live next to source (*.test.ts(x)).
  • Verify with npm test --workspaces before committing.

3 items under this folder.