A high-performance, cloud-native multiplayer implementation of the classic social deduction game Werewolf/Mafia.
Written by AI.
Home Screen Game Lobby
- Backend: Python 3.11 with FastAPI (REST + WebSockets).
- Frontend: React 19 + TypeScript with Vite, TanStack Query, and Jotai.
- Persistence: Redis (Game state persistence).
- Infrastructure: Google Cloud (Terraform) - Cloud Run & Compute Engine.
backend/: FastAPI application code (Modular router structure, Pydantic schemas).frontend/: React application (Components, Store, Hooks).terraform/: Infrastructure as Code (GCP resources).scripts/: Helper scripts for local development and deployment.
- Docker
- Node.js & Python 3.11+
uv(Fast Python package installer)
Docker Compose (Recommended)
./scripts/start_compose.shAccess the game at http://localhost:3000.
Backend:
cd backend
uv venv
source .venv/bin/activate
uv pip install -e .
uvicorn app.main:app --reloadFrontend:
cd frontend
npm install
npm run dev- Real-time interaction via WebSockets.
- Flexible role assignment algorithm.
- Robust state management with Redis.
- Immersive Experience: Dynamic atmospheric backgrounds, sound effects, and phase timers.
- PWA Support: Installable as a native-like app on mobile devices.
- Type-safe, production-ready code structure.