A real-time multiplayer implementation of the card game Coup. The frontend is a React web application built with Material UI and Vite. The app communicates with the backend Express server via the WebSocket protocol (using Socket.IO), falling back to the HTTPS protocol if the socket connection fails. Game state is stored in a Redis database. Authentication is handled via Firebase (Google sign-in).
- Real-time multiplayer gameplay with WebSocket communication
- AI opponents with strategic decision-making
- In-game chat
- User profiles and leaderboard
- Multi-language support
- QR code game invites
This is a pnpm monorepo with three packages:
- client — React 19 single-page application
- server — Express 5 API and Socket.IO server
- shared — TypeScript types, game logic, and helpers used by both client and server
New languages can be added by doing the following:
- Define the new language in shared/i18n/availableLanguages.ts
- Add client translations in client/src/i18n/translations.ts
- Add server translations in server/src/i18n/translations.ts
Deployments are automated. To deploy a new version of the game, simply create a new Release.
| Variable | Description | Default |
|---|---|---|
EXPRESS_PORT |
Port the server listens on | 8008 |
REDIS_CONNECTION_STRING |
Redis connection URL | — |
FIREBASE_SERVICE_ACCOUNT_KEY |
Firebase Admin service account JSON | — |
FIREBASE_PROJECT_ID |
Firebase project ID | — |
| Variable | Description | Default |
|---|---|---|
VITE_API_BASE_URL |
Server API URL | http://localhost:8008 |
VITE_SOCKET_SERVER_URL |
WebSocket server URL | http://localhost:8008 |
VITE_SOCKET_SERVER_PATH |
WebSocket path | "" |
VITE_FIREBASE_API_KEY |
Firebase API key | — |
VITE_FIREBASE_AUTH_DOMAIN |
Firebase auth domain | — |
VITE_FIREBASE_PROJECT_ID |
Firebase project ID | — |
VITE_FIREBASE_STORAGE_BUCKET |
Firebase storage bucket | — |
VITE_FIREBASE_MESSAGING_SENDER_ID |
Firebase messaging sender ID | — |
VITE_FIREBASE_APP_ID |
Firebase app ID | — |
cd server
pnpm i
pnpm devcd client
pnpm i
pnpm startServer needs to be running for integration tests
cd server
pnpm testcd client
pnpm test
pnpm cypress open