Skip to content

feat: add multiplayer typing races (@jhonsfranky17) - #8340

Open
jhonsfranky17 wants to merge 2 commits into
monkeytypegame:masterfrom
jhonsfranky17:feat/multiplayer-races
Open

feat: add multiplayer typing races (@jhonsfranky17)#8340
jhonsfranky17 wants to merge 2 commits into
monkeytypegame:masterfrom
jhonsfranky17:feat/multiplayer-races

Conversation

@jhonsfranky17

@jhonsfranky17 jhonsfranky17 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • Real-time multiplayer racing: create a private room, share the room code/link, race the same word list live against friends, and see ranked results at the end
  • Socket.IO layer attached to the existing Express server, authenticated via the existing Firebase token verification (verifyIdToken)
  • Room/player state lives in Redis, fully isolated from the results/PB/XP pipeline — races never affect real stats or leaderboards
  • Every player sees the identical word sequence (host generates it once, server relays it verbatim), a blurred in-game countdown overlay before the race starts, and a synchronized timer start (forced at "go" instead of each player's own first keystroke)
  • New /multiplayer and /multiplayer/:roomCode pages, socket client, and Solid state module on the frontend; new packages/schemas/packages/contracts multiplayer definitions on the shared side; new Socket.IO + Redis layer on the backend

Out of scope / follow-ups

  • Public matchmaking, spectator mode, rematch brackets beyond the current room reset
  • Horizontal-scaling Redis pub/sub adapter for Socket.IO (fine for a single backend instance)
  • Production-grade anti-cheat on live progress (matches the existing solo-test posture, where real anti-cheat is a private module not in this repo)
  • Automated test coverage for the new Redis room logic and socket auth

Test plan

  • tsc --noEmit and oxlint --type-aware --type-check clean across schemas, contracts, backend, and frontend
  • Exercised the REST endpoints directly (create room, get room, 404/422/401 paths) against a local Mongo+Redis backend
  • Exercised the socket auth layer (missing/invalid token rejection)
  • Manually tested the full flow end-to-end in two browser sessions with real Firebase accounts: create room → invite link → join → ready up → synchronized countdown → race → ranked results → rematch

Adds a real-time multiplayer mode: create a private room, share the
room code or link, race the same word list live against friends, and
see ranked results at the end.

- Socket.IO layer attached to the existing Express server, authenticated
  via the existing Firebase token verification
- Room state lives in Redis, isolated from the results/PB/XP pipeline
  so races never affect real stats or leaderboards
- Race results are ephemeral and shown once per race, with a rematch
  option that resets the room back to the lobby
- Countdown and word list are synchronized: every player sees the
  identical sequence, sees a blurred countdown overlay in-game before
  the race starts, and has their WPM timer force-started at the same
  instant instead of on their own first keystroke
- New /multiplayer and /multiplayer/:roomCode pages, socket client,
  and Solid state module on the frontend
@monkeytypegeorge monkeytypegeorge added backend Server stuff frontend User interface or web stuff api A change to the Application Programming Interface (API) packages Changes in local packages labels Aug 12, 2026
@socket-security

socket-security Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsocket.io-client@​4.8.31001008383100
Addedsocket.io@​4.8.310010010083100

View full report

@github-actions

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for update Pull requests or issues that require changes/comments before continuing labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A change to the Application Programming Interface (API) backend Server stuff frontend User interface or web stuff packages Changes in local packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants