A real-time multiplayer implementation of the social deduction game Spyfall. Built with vanilla JavaScript and Firebase.
Spyfall is a game where players are assigned roles at a specific location, except for one player who is the "Spy". The Spy must figure out the location through conversation while other players try to identify the Spy.
- 28 unique locations with 7 occupations each (196 total roles)
- 3-10 player support with configurable round duration (5-10 minutes)
- Real-time synchronization across all players
- Session persistence (survives page refresh)
- Multi-round sessions with persistent lobbies
- Owner controls for game management
Frontend
- Vanilla JavaScript (ES6+)
- Web Components (Custom Elements + Shadow DOM)
- Vite
Backend
- Firebase Firestore (real-time database)
- Firebase Hosting
- Serverless architecture
# Clone and install
git clone <repository-url>
cd spyfall
npm install
# Development
npm run dev
# Production build
npm run build
# Deploy to Firebase
npm run build
firebase deploy- One player creates a game and shares the 4-character code
- Others join using the code
- Owner starts round (3-10 players required)
- Non-spies get location + occupation, Spy gets neither
- Players ask questions to identify the Spy or figure out the location
- Round ends when timer expires or owner ends it