Say something. Get roasted. Fire back.
AI Roast Battle is a browser-based comedy game where you challenge an AI in a timed roast battle.
Give the Roast Machine something to work with. The AI fires the first roast. You get a limited amount of time to write your comeback. An AI judge then evaluates the exchange and presents the result.
The goal is simple:
Make the AI regret starting the fight.
AI Roast Battle turns an ordinary AI interaction into a competitive comedy game.
Instead of asking an AI to simply answer a question, the player enters a battle:
- Give the AI a topic, statement, or personal prompt.
- The Roast Machine generates a roast.
- The player gets a limited time to respond.
- The comeback is submitted.
- The AI judge evaluates the response.
- The player sees the battle result.
- Play again or try another mode.
The experience is designed around short rounds, quick reactions, humor, and replayability.
The main game loop:
Prompt โ AI Roast โ Timed Comeback โ AI Judgement โ Result
The player has a limited amount of time to respond to the AI roast.
The timer creates pressure and prevents players from spending forever trying to write the perfect joke.
The application can use an AI model to generate the opponent's roast.
AI provider configuration is kept on the server rather than exposed directly to the browser.
The comeback can be evaluated across dimensions such as:
- Creativity
- Comedy
- Damage
The judge also produces a final battle verdict.
The project is structured around multiple game modes:
| Mode | Description |
|---|---|
| Standard Battle | The normal AI roast battle |
| 30 Seconds Chaos | A faster, time-pressure format |
| Developer Mode | A technical/developer-themed battle experience |
| Daily Challenge | A challenge format designed around a daily prompt |
Only advertise modes that are enabled and working in the deployed version.
Players can choose the tone of the battle:
- Mild
- Spicy
- Savage
The selected level influences the intended roast intensity.
The project includes server-side handling intended to reduce unsafe or inappropriate AI output and to handle problematic input/output.
AI output should always be treated as untrusted external data.
The project is designed with failure cases in mind, including:
- AI timeouts
- API failures
- Rate limits
- Empty AI responses
- Malformed AI responses
- Invalid user input
- Expired rounds
- Duplicate submissions
- Prompt injection attempts
flowchart TD
A["๐ Home / Arena"] --> B["๐ฎ Start Battle"]
B --> C["๐ Player enters a prompt"]
C --> D["๐ฅ Roast Machine generates roast"]
D --> E{"AI response valid?"}
E -- "No" --> F["๐ก๏ธ Fallback / Error handling"]
F --> D
E -- "Yes" --> G["๐ Player reads the roast"]
G --> H["โฑ๏ธ Timed comeback"]
H --> I["โ๏ธ Player writes response"]
I --> J{"Time remaining?"}
J -- "Yes" --> K["๐ Submit comeback"]
J -- "No" --> L["โ Round expires"]
K --> M["โ๏ธ AI Judge"]
L --> M
M --> N["๐ Evaluate comeback"]
N --> O["๐ Battle Result"]
O --> P{"Play again?"}
P -- "Yes" --> B
P -- "No" --> A
flowchart LR
U["๐ค Player"] --> FE["๐ Browser / React UI"]
FE --> API["โ๏ธ Application Server"]
API --> SAFETY["๐ก๏ธ Safety & Validation"]
API --> ROAST["๐ฅ Roast Generation"]
API --> JUDGE["โ๏ธ AI Judging"]
ROAST --> LLM["๐ค AI Provider"]
JUDGE --> LLM
API --> FALLBACK["๐งฏ Fallback Roast Logic"]
API --> DATA["๐พ Application Data"]
FE --> TIMER["โฑ๏ธ Battle Timer"]
SAFETY --> ROAST
SAFETY --> JUDGE
A typical battle request follows this pattern:
Player
โ
โผ
Browser UI
โ
โผ
Application Server
โ
โโโ Validate input
โ
โโโ Apply safety checks
โ
โโโ Request AI roast
โ โ
โ โผ
โ AI Provider
โ โ
โ โผ
โ AI response
โ
โโโ Validate AI response
โ
โผ
Display Roast
โ
โผ
Start / Continue Timer
โ
โผ
Player submits comeback
โ
โผ
Application Server
โ
โผ
AI Judge
โ
โโโ Creativity
โโโ Comedy
โโโ Damage
โ
โผ
Battle Result
The repository is organized around a frontend, server-side game logic, AI integration, safety handling, and supporting utilities.
A simplified view:
AI Roast Battle
โ
โโโ src/
โ โโโ App.tsx
โ โโโ main.tsx
โ โโโ types.ts
โ โ
โ โโโ components/
โ โ โโโ BattleScreen.tsx
โ โ โโโ ChaosModeScreen.tsx
โ โ โโโ DailyChallengeModal.tsx
โ โ โโโ DeveloperModeScreen.tsx
โ โ โโโ HowToPlayModal.tsx
โ โ โโโ Navbar.tsx
โ โ โโโ ResultScreen.tsx
โ โ โโโ StatsModal.tsx
โ โ
โ โโโ utils/
โ โโโ audio.ts
โ
โโโ server/
โ โโโ auditEngine.ts
โ โโโ db.ts
โ โโโ fallbackRoasts.ts
โ โโโ gemini.ts
โ โโโ safety.ts
โ โโโ types.ts
โ
โโโ index.html
โโโ package.json
โโโ server.ts
โโโ tsconfig.json
โโโ vite.config.ts
โโโ .env.example
The structure above describes the project organization currently used by the application. If files are renamed or removed later, update this section with the repository structure.
| Layer | Technology |
|---|---|
| Frontend | React + TypeScript |
| Build Tool | Vite |
| Backend | TypeScript server |
| AI Integration | Gemini-compatible server-side integration |
| Styling | Project CSS |
| Package Management | Bun / project lockfile |
| Data / Utilities | Server-side application modules |
| Version Control | Git + GitHub |
The AI layer is intentionally kept behind the server.
sequenceDiagram
participant P as Player
participant B as Browser
participant S as Server
participant V as Validation
participant AI as AI Provider
P->>B: Enter prompt
B->>S: Send battle request
S->>V: Validate input
V-->>S: Valid
S->>AI: Generate roast
AI-->>S: Roast response
S->>V: Validate AI response
V-->>S: Safe / valid response
S-->>B: Return roast
B-->>P: Display roast
P->>B: Submit comeback
B->>S: Send comeback
S->>V: Validate comeback
S->>AI: Judge comeback
AI-->>S: Evaluation
S-->>B: Return result
B-->>P: Display result
API credentials should never be embedded directly into browser JavaScript.
The server provides a boundary where the application can:
- Protect API credentials
- Validate requests
- Apply safety rules
- Handle timeouts
- Handle rate limits
- Validate model responses
- Provide fallback behavior
- Log failures safely
Create your local environment file from the example:
cp .env.example .envOn Windows, you can also create .env manually.
Example:
GEMINI_API_KEY=your_api_key_hereUse the exact variable names required by the current .env.example.
Do not commit:
.env
or any file containing a real API key.
Only commit safe placeholders such as:
.env.example
Install:
- Node.js
- Bun (if required by the current project scripts)
- Git
- An AI provider API key if AI generation is enabled
Check your installations:
node --version
bun --version
git --versiongit clone https://github.com/Devputta/connect.git
cd connectIf the project uses Bun:
bun installIf the project scripts/documentation specify npm instead:
npm installUse the package manager expected by the current lockfile and project configuration.
Create:
.env
and configure the required AI credentials.
Do not put API keys into frontend source files.
Use the script defined in package.json.
For example:
bun run devor:
npm run devOpen the local URL shown by the development server, commonly something similar to:
http://localhost:5173
Enter the arena and start a battle.
Type something the Roast Machine can roast.
Examples:
I am a software engineer.
I drink three coffees before breakfast.
My code works on my machine.
The AI generates the opening roast.
Read the roast and write your comeback before the timer expires.
The AI judge evaluates your comeback.
Possible evaluation dimensions include:
Creativity
Comedy
Damage
The result screen presents the outcome of the round and lets you continue playing.
AI Roast Battle is intentionally designed to feel like a real indie game, not a generic AI dashboard.
The UI should prioritize:
- Strong visual hierarchy
- Personality
- Humor
- Readability
- Fast interaction
- Purposeful animation
- Memorable microcopy
- Mobile usability
Avoid:
- Generic AI gradients
- Excessive glassmorphism
- Endless rounded cards
- Badge-heavy interfaces
- Decorative animations without purpose
- Fake statistics
- Stock-looking AI illustrations
- Repetitive AI-generated copy
- Excessive icons
- Every element being placed inside a box
Before shipping a feature, ask:
Would this look believable in a real indie game?
Does this interaction have a purpose?
Does the copy sound like a person wrote it?
Is anything here present only because an AI commonly generates it?
Does the game have its own identity?
Does the feature actually work?
The game should be tested against both normal and failure scenarios.
Test:
- Starting a battle
- Submitting a prompt
- Receiving a roast
- Starting the comeback timer
- Submitting a comeback
- Timer expiration
- Receiving a result
- Starting another battle
Test:
- AI timeout
- AI provider unavailable
- Rate limit
- Empty response
- Malformed response
- Unexpected response format
- Invalid API credentials
Test:
- Empty prompt
- Very long prompt
- Unexpected characters
- Repeated submissions
- Invalid requests
- Prompt injection attempts
Test:
- Desktop
- Mobile
- Small screens
- Slow network
- Loading states
- Error states
- Long AI responses
A game that works only when every external service behaves perfectly is not production-ready.
The application should consider:
flowchart TD
A["Request"] --> B["Validate Input"]
B --> C{"Valid?"}
C -- "No" --> D["Return Clear Error"]
C -- "Yes" --> E["Call AI"]
E --> F{"AI Available?"}
F -- "No" --> G["Fallback / Recover"]
F -- "Yes" --> H["Validate AI Response"]
H --> I{"Response Valid?"}
I -- "No" --> G
I -- "Yes" --> J["Continue Battle"]
G --> K["Safe Failure State"]
J --> L["Return Result"]
Important failure cases include:
- Network failures
- Provider failures
- Timeout
- Rate limiting
- Invalid AI output
- Expired battle
- Duplicate submission
- Unexpected server errors
The player should receive a useful message rather than a raw stack trace.
Security is particularly important because the application accepts user-generated content and communicates with an external AI service.
The project should:
- Keep API keys server-side
- Validate user input
- Limit excessive input
- Treat AI output as untrusted
- Validate structured AI responses
- Protect system prompts
- Handle prompt injection attempts
- Use server-side timers/expiry where appropriate
- Prevent duplicate submissions
- Avoid exposing stack traces to players
- Avoid logging secrets
- Keep dependencies updated
See:
for the project's security reporting guidance.
Contributions are welcome.
Before making a large change, review:
Typical workflow:
git checkout -b feature/my-feature
git add .
git commit -m "Add my feature"
git push origin feature/my-featureThen open a Pull Request.
| Document | Purpose |
|---|---|
README.md |
Project overview and setup |
CONTRIBUTING.md |
Contribution guidelines |
SECURITY.md |
Security reporting and practices |
LICENSE |
Project license |
.env.example |
Environment variable template |
Potential areas for future development include:
- More battle formats
- Better daily challenges
- Additional judging strategies
- Improved fallback behavior
- Battle history
- Shareable results
- More topic categories
- Improved accessibility
- More robust automated tests
- Better observability and failure diagnostics
Future features should be evaluated against the game's core identity rather than added simply to increase the number of features.
AI Roast Battle is an evolving personal portfolio/game project.
Features may change as the game is tested and improved.
The README should be updated whenever major gameplay, architecture, setup, or security behavior changes.
This project is released under the MIT License.
See LICENSE for details.
Mahadevu M P
GitHub:
https://github.com/Devputta
Don't build another AI dashboard. Build a game people actually want to play.
AI Roast Battle โ Say something. Get roasted. Fire back.