Cockatrice/webclient
2026-04-20 22:17:32 -05:00
..
architecture cleanup testing utilities, documentation, and AI commentary 2026-04-18 15:32:50 -05:00
integration Comprehensive review changes 2026-04-20 18:58:40 -05:00
public migrate from CRA to vite 2026-04-12 18:35:13 -05:00
src fix tests 2026-04-20 22:17:32 -05:00
.env harden 2026-04-18 01:36:37 -05:00
.env.development migrate from CRA to vite 2026-04-12 18:35:13 -05:00
.env.production migrate from CRA to vite 2026-04-12 18:35:13 -05:00
.env.test migrate from CRA to vite 2026-04-12 18:35:13 -05:00
.gitignore refactor typescript wiring 2026-04-15 15:46:17 -05:00
.npmrc Webatrice: update deps (#4700) 2022-11-01 12:41:42 -05:00
buf.gen.plugin.mjs more integration tests 2026-04-16 12:40:47 -05:00
buf.gen.yaml refactor typescript wiring 2026-04-15 15:46:17 -05:00
eslint.boundaries.mjs implement gameboard v1 2026-04-19 23:21:42 -05:00
eslint.config.mjs more integration tests 2026-04-16 12:40:47 -05:00
index.html migrate from CRA to vite 2026-04-12 18:35:13 -05:00
package-lock.json improve testing speed 2026-04-20 00:01:25 -05:00
package.json improve testing speed 2026-04-20 00:01:25 -05:00
prebuild.js migrate to Protobuf ES 2026-04-13 15:03:57 -05:00
README.md cleanup testing utilities, documentation, and AI commentary 2026-04-18 15:32:50 -05:00
tsconfig.json implement gameboard v1 2026-04-19 23:21:42 -05:00
vite.config.ts improve testing speed 2026-04-20 00:01:25 -05:00
vitest.integration.config.ts improve testing speed 2026-04-20 00:01:25 -05:00

Webatrice

The Cockatrice web client — a React/TypeScript SPA that connects to a Servatrice server over a WebSocket.

Application Architecture

Application Architecture

For the full set of diagrams (detailed layer map + command/response/event sequence) and the npm run diagram scripts that regenerate them, see architecture/. For prose — WebSocket layering, Redux store shape, test conventions — see .github/instructions/webclient.instructions.md.

Stack

React 19 + TypeScript, built with Vite 8. State via Redux Toolkit + RxJS, UI via MUI v9, tests via Vitest, protobuf bindings generated by buf into Protobuf-ES.

Prerequisites

  • Node.js and npm
  • Run every command below from the webclient/ directory

Getting started

npm install
npm start

npm start boots the Vite dev server and opens a browser tab at http://localhost:5173 automatically (configured via server.open in vite.config.ts). The first start runs proto:generate and prebuild.js via the prestart hook, so give it a moment.

Scripts

Dev & build

  • npm start — start the Vite dev server (runs proto:generate + prebuild.js first via prestart)
  • npm run build — production build into build/ (also runs the prebuild hooks)
  • npm run preview — serve the built build/ output locally to smoke-test a production build

Tests

  • npm test — one-shot Vitest run (unit specs)
  • npm run test:watch — Vitest in watch mode
  • npm run test:integration — integration specs via vitest.integration.config.ts
  • npm run test:coverage / npm run test:integration:coverage — the above with v8 coverage

Quality

  • npm run lint / npm run lint:fix — ESLint over src/
  • npm run goldenlint + test + test:integration; the CI-equivalent gate to run before declaring work done

Codegen & i18n

  • npm run proto:generate — regenerate Protobuf-ES bindings from ../libcockatrice_protocol via buf generate
  • npm run translate — re-run the i18n merge only (prebuild.js -i18nOnly)

Generated files

Produced by proto:generate and prebuild.js on every npm start / npm run build. Don't edit them by hand:

File Tracked? Notes
src/generated/proto/** Gitignored Protobuf bindings. Regenerate with npm run proto:generate; only appears after a first local run.
src/server-props.json Gitignored Build metadata including the current git SHA. Written by prebuild.js; only appears after a first local run.
src/i18n-default.json Committed Merged i18n catalog. Regenerate with npm run translate and commit whenever it changes.

Further reading