AI Roast Battle is a browser-based comedy game where you challenge an AI in a timed roast battle.
Enter something about yourself, receive an AI-generated roast, and get 30 seconds to write a comeback. An AI judge then evaluates your response based on creativity, comedy, and damage.
https://ai-battel-g.onrender.com/
- Start a battle.
- Enter something about yourself.
- Receive an AI-generated roast.
- Write a comeback within 30 seconds.
- Submit your response.
- AI evaluates your comeback.
- View your battle result.
- AI-generated roast battles
- 30-second timed comebacks
- AI-powered comeback judging
- Multiple heat levels: Mild, Spicy, Savage
- Standard, Chaos, and Developer battle modes
- Input and AI response validation
- Fallback handling for AI failures
- Protection against duplicate and expired submissions
Only features currently enabled in the deployed application should be considered available.
| Layer | Technology |
|---|---|
| Frontend | React + TypeScript |
| Build Tool | Vite |
| Backend | TypeScript |
| AI | Gemini |
| Styling | CSS |
| Deployment | Render |
| Version Control | Git + GitHub |
Player
|
v
React Frontend
|
v
Application Server
|
+--> Validation & Safety
|
+--> AI Roast Generation
|
+--> AI Judging
|
v
Battle Result
AI requests are handled server-side so API credentials are not exposed in the browser.
The application follows a simple gameplay pipeline while keeping AI processing and validation on the server.
flowchart TD
A["Player"] --> B["Battle Arena"]
B --> C["Select Battle Mode"]
C --> D["Configure Heat Level"]
D --> E["Enter Personal Prompt"]
E --> F["Input Validation"]
F -->|Valid| G["Roast Generation"]
F -->|Invalid| E
G --> H["AI Roast Engine"]
H --> I["Display Generated Roast"]
I --> J["Start 30-Second Timer"]
J --> K["Write Comeback"]
K --> L["Submit Response"]
L --> M{"Round Valid?"}
M -->|Yes| N["AI Judge"]
M -->|Expired| O["Round Expired"]
N --> P["Evaluate Creativity"]
N --> Q["Evaluate Comedy"]
N --> R["Evaluate Damage"]
P --> S["Battle Score"]
Q --> S
R --> S
S --> T["Battle Result"]
O --> T
T --> U{"Play Again?"}
U -->|Yes| B
U -->|No| V["Return to Arena"]
flowchart LR
A["Browser Client"] --> B["Application Server"]
B --> C["Request Validation"]
C --> D["Safety Checks"]
D --> E["AI Roast Service"]
E --> F["AI Provider"]
F --> G["AI Response"]
G --> H["Response Validation"]
H -->|Valid| I["Return Roast"]
H -->|Invalid| J["Fallback Handler"]
I --> K["Browser"]
J --> K
K --> L["Player Comeback"]
L --> B
B --> M["AI Judge Service"]
M --> F
F --> N["Evaluation Response"]
N --> O["Result Validation"]
O --> P["Battle Result"]
P --> K
External AI services can fail or return unexpected data. The application therefore validates external responses before allowing them to affect the game state.
flowchart TD
A["AI Request"] --> B{"Response Received?"}
B -->|No| C["Timeout / API Failure"]
B -->|Yes| D["Response Validation"]
D --> E{"Response Valid?"}
E -->|Yes| F["Continue Battle"]
E -->|No| G["Fallback / Error Handler"]
C --> G
G --> H["Controlled Recovery"]
H --> I["Preserve Game State"]
F --> J["Continue Gameplay"]
I --> J
src/
├── components/
├── utils/
├── App.tsx
├── main.tsx
└── types.ts
server/
├── auditEngine.ts
├── db.ts
├── fallbackRoasts.ts
├── gemini.ts
├── safety.ts
└── types.ts
server.ts
vite.config.ts
package.json
.env.example
Never commit API keys or other secrets to Git.
Use environment variables for sensitive configuration:
AI_API_KEY=your_api_key_hereSee SECURITY.md for security guidelines.
git clone <your-repository-url>
cd <project-directory>
bun installCreate .env, configure your API key, then run:
bun run devOpen the local URL shown by the development server.
The application is designed to handle:
- AI timeouts
- API failures
- Rate limits
- Empty or malformed AI responses
- Invalid input
- Expired rounds
- Duplicate submissions
- Prompt injection attempts
This project is licensed under the MIT License. See LICENSE.