Project Info
This project did not submit a demo video on Devpost.
Inspiration
This game is based on the popular social deduction game Mafia or Werewolf, taking the game to a new level. This game solves a key problem with the classic games: The need for a human moderator who has to sit out to narrate.
What it does
Super Mafia uses AI to host the game, allowing everyone to play. Its key features include: Pass-the-phone gameplay and online multiplayer. AI Host with several unique voices, narrating the game with personalities like serious, funny, or even a rhyming rapper. 2 different game modes, classic and judge, which involve voice interaction between the players and the AI host, as they must convince the AI to choose who to vote out. The classic mode uses Baseten and janitor.ai for the personality and ElevenLabs for the voice. Players have to discuss with each other to find out who the werewolf is In the online mode, each player talks to the Baseten AI or janitor.ai. Their goal is to convice the AI to vote out who they think the werewolf is
How we built it
TypeScript is the fundamental logic of the game. TailwindCSS for the styling of the game. LiveKit for the fast and efficient streaming of text-to-speech responses. Janitor AI and Baseten for unique personalities. ElevenLabs API to introduce different voices.
Challenges we ran into
Handling bad user input, as there were many different debugging tests we had to do, especially with player management. Creating a friendly UX, as we had to ensure the privacy of the players and make it clear whose turn it was.
Accomplishments we're proud of
We are very proud of the overall design of the app, as its simple and fun style made the game pretty engaging and accessible. Lessons learned We learned how to use multiple API's together. We also learned how to create an online multiplayer game.
What's next
Fixing bugs with the multiplayer mode. Video showing judge mode (main video only shows classic mode): https://www.youtube.com/watch?v=8hDipFwG1qk
Made at CalHacks 2025
Play SuperMafia at: https://mafia-but-high.tech/
SuperMafia - AI-Hosted Werewolf Game
Mobile-first, pass-the-phone Werewolf game with AI host personality and realtime voice.
Setup
1. Install Dependencies
npm install
2. Configure API Keys
Copy .env.local.example to .env.local and fill in your API keys:
LiveKit (for realtime voice)
- Go to https://cloud.livekit.io
- Create a free account
- Create a new project
- Copy your credentials:
- WebSocket URL:
wss://your-project.livekit.cloud - API Key: Found in project settings
- API Secret: Found in project settings
- WebSocket URL:
Add to .env.local:
LIVEKIT_WS_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret
JanitorAI (for host personality)
- Go to https://janitorai.com
- Create an account
- Get your API key from settings
- Create or find a character for your host
- Copy the character ID from the URL
Add to .env.local:
JANITOR_AI_API_KEY=your_janitor_api_key
JANITOR_AI_CHARACTER_ID=your_character_id
Note: The app works without these keys using Web Speech API and a mock host. LiveKit and JanitorAI are optional enhancements.
3. Run Development Server
npm run dev
Features
- Pass-the-phone gameplay: One device for the whole table
- AI Host: Narrates game events and answers questions
- Voice interaction: Push-to-talk to ask the host questions
- Roles: Villager, Werewolf, Seer, Medic
- Mobile-optimized: Designed for handheld play
- Privacy: Role reveals are private, night actions are hidden
How to Play
- Add 5+ players with names and photos
- Configure roles (optional)
- Choose theme and host personality
- Start game
- Pass phone for role reveals (in order players were added)
- Night Phase: Pass to each special role in order
- Medic protects someone (if they're killed, protection saves them)
- Werewolves choose a target
- Seer peeks at someone's role
- Day Phase: Discuss and vote to eliminate suspects
- Win when all werewolves are eliminated (villagers) or werewolves equal villagers (werewolves)
Role Abilities
- Medic: Protect one player each night (werewolves can still target them, but protection saves them)
- Werewolf: Choose one player to eliminate each night
- Seer: Peek at one player's role each night
- Villager: No special ability, but crucial for voting
Tech Stack
- Next.js 14 + React 18
- TypeScript (strict mode)
- TailwindCSS for styling
- Zustand for state management
- LiveKit for realtime voice (optional)
- JanitorAI for AI host personality (optional)
- Web Speech API for fallback STT/TTS
Architecture
- Client-side first: Game state managed in browser
- Offline-capable: Works without internet (using Web Speech API)
- Progressive enhancement: LiveKit and JanitorAI add features when configured
- Type-safe: Full TypeScript coverage with strict mode
API Integration
LiveKit
- Automatically used when
LIVEKIT_WS_URLis configured - Falls back to Web Speech API if unavailable
- Provides lower latency and better quality voice
JanitorAI
- Automatically used when
JANITOR_AI_API_KEYis configured - Falls back to mock host if unavailable
- Provides personality-driven responses
Both integrations work together seamlessly - LiveKit handles voice, JanitorAI handles personality.
License
MIT
Analysis
View
Metric
- 21
- 6
- 3
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- JavaScriptIn code
- Next.jsIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
7 of 7 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
241 KB
Source files
32
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
Vishvenugopal/SuperMafiaCalHacks
53 files · 644 KB · @ 119465a
Structure
Interface
6 files · 11%Screens, components and styles rendered to the user.
API & routing
9 files · 17%Request entry points: routes, handlers and controllers.
Application logic
18 files · 34%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript86%
- Python9%
- Markdown3%
- CSS2%
- YAML0%
- JavaScript0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
package.json
npm · 13- autoprefixer
- livekit-client
- livekit-server-sdk
- next
- postcss
- react
- react-dom
- tailwindcss
- zustand
- +4 more
agent/requirements.txt
pypi · 3- livekit
- python-dotenv
- requests
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.