A futuristic, browser-based multiplayer colour-matching card game. Original YOU KNOW branding, a complete classic deck, solo AI, local pass-and-play, and server-authoritative online rooms.
No cloud database. This deployment intentionally does not connect to Supabase or any other external account/database service. Profiles live in browser storage; public arena data lives in the Node process. The Supabase SDK has been removed from both packages and no Supabase keys are read.
npm run install:all
npm run dev
Open the frontend at http://localhost:5173. The backend starts alongside it at http://localhost:3001.
npm run dev uses concurrently to run both packages. Vite proxies /api and /socket.io to the backend, so the browser can use same-origin URLs during development.
npm run build
npm start
npm run build creates frontend/dist. npm start runs backend/server.js, which serves that build and the API/Socket.IO layer from a single origin on port 3001.
npm test
Runs the shared rules-engine, AI, and room-manager suites with Node’s built-in test runner.
The shared engine in shared/game-engine.js is the single source of truth for solo, local and online play.
you know/
├── frontend/
│ ├── src/
│ │ ├── components/ UI, game table, brand, layout
│ │ ├── context/ AuthContext (local-only), SoundContext
│ │ ├── game/ useLocalGame, useOnlineRoom
│ │ ├── pages/ Landing, Play, Game, Profile, Leaderboard, Info
│ │ ├── services/ api, profile, audio, socket
│ │ └── styles/ design system, game and page CSS
│ ├── public/ favicon and static assets
│ └── vite.config.js dev proxy for /api and /socket.io
├── backend/
│ ├── game/rooms.js authoritative room lifecycle and actions
│ ├── routes/api.js public REST endpoints
│ ├── sockets/index.js Socket.IO event handlers and flood guard
│ ├── lib/store.js in-memory leaderboard and match archive
│ └── server.js Express + Socket.IO + production static hosting
├── shared/
│ ├── game-engine.js pure rules engine and redacted views
│ ├── constants.js deck, colours, values, scoring
│ └── ai.js opponent decision-making
├── tests/ Node test suites
└── package.json root scripts
getPlayerView(..., { revealAll: false }) so only the active player’s hand is visible behind the privacy overlay.RoomManager validates every action against the canonical engine and broadcasts redacted state via getPlayerView. Opponent hand arrays are never sent.shared/ai.js module.All variables are optional for local development.
| Variable | Used by | Purpose |
|---|---|---|
PORT |
backend | API/Socket.IO port, default 3001 |
CLIENT_ORIGIN |
backend | Comma-separated allowed origins for CORS. Recommended in production. |
VITE_API_URL |
frontend | Absolute REST base URL when frontend and API are on different origins. Default: same origin. |
VITE_SOCKET_URL |
frontend | Absolute Socket.IO URL when frontend and API are on different origins. Default: same origin. |
Example production .env for the backend:
PORT=3001
CLIENT_ORIGIN=https://your-domain.example
Do not add Supabase URLs or keys. They are not read and no cloud client exists in this codebase.
| Method | Path | Description |
|---|---|---|
| GET | /api/health |
Uptime and service health |
| GET | /api/leaderboard?range=all\|daily\|weekly&limit=25 |
Public leaderboard from the arena cache |
| GET | /api/stats |
Public totals plus live rooms/players |
| POST | /api/matches |
Best-effort update to the in-memory arena archive |
| GET | /api/profile |
Returns 410; personal profiles are local-only |
Match payload example:
{
"result": "win",
"mode": "online",
"score": 420,
"points": 28,
"username": "CyanRift42",
"avatar": "◈",
"color": "cyan"
}
Client → server:
| Event | Payload | Purpose |
|---|---|---|
room:create |
{ name, maxPlayers, targetScore, turnTimer } |
Create a private room |
room:join |
{ code, name } |
Join by room code |
room:reconnect |
{ code, token } |
Restore a seat after refresh/drop |
room:leave |
— | Leave/forfeit the room |
room:ready |
{ ready } |
Toggle readiness |
room:addBot / room:removeBot |
{ difficulty } / { botId } |
Host bot controls |
room:start / room:rematch / room:voteRematch |
— | Lifecycle controls |
game:play |
{ cardId, color, declareUno } |
Play a card; color required for wilds |
game:draw / game:pass / game:uno |
— | Draw, pass, declare UNO |
game:catchUno / game:challenge |
{ targetId } |
Catch missed UNO / challenge +4 |
game:declineChallenge |
— | Target declines the challenge window |
game:nextRound / game:forfeit |
— | Continue match / forfeit |
Server → client:
| Event | Purpose |
|---|---|
session:ready |
Guest session acknowledgement |
room:state |
Redacted room + game state for this viewer |
room:error |
Validation/rate-limit errors with codes |
game:fx |
Animation cues (deal, play, draw, wild colour, UNO, victory, etc.) |
The socket layer applies an 8 KB payload ceiling and a coarse per-socket rate limit.
localStorage — guest profile, stats, history, sound/music/volume preferences.sessionStorage — room reconnect token, online intent, local game setup, boot flag.Nothing is persisted to disk by the application, and no third-party database or auth provider is contacted. Clearing browser storage removes the local profile; restarting the backend clears rooms and arena totals.
npm run install:all
npm run build
CLIENT_ORIGIN=https://your-domain.example PORT=3001 npm start
Point your reverse proxy at http://127.0.0.1:3001. Keep WebSocket upgrade support enabled for /socket.io.
frontend/dist from any static host/CDN.VITE_API_URL and VITE_SOCKET_URL to the backend origin.CLIENT_ORIGIN on the backend to the frontend origin.CLIENT_ORIGIN explicitly in production.