Turn Internet Rage into Poetry with AI!
A fun and interactive web application that transforms real Reddit rants into beautiful, AI-generated poetry using advanced language models. Experience the magic of turning digital frustration into artistic expression with the power of artificial intelligence!
- 🤖 AI-Powered Poetry: Real poetry generated by Gemini AI language model
- 🎰 Live Reddit Integration: Fetches real rants from active subreddits
- 🎭 Intelligent Fallbacks: Graceful degradation if AI or Reddit APIs are unavailable
- 📋 Copy to Clipboard: Easily copy rants or poems to share
- 📱 Responsive Design: Works beautifully on all devices
- 🎨 Beautiful UI: Stunning gradients and smooth animations
- ⚡ Fast Performance: Built with Vite for lightning-fast development
- 🔄 Spin Counter: Track how many times you've spun the wheel
- 🎯 Reset Functionality: Start fresh anytime
- 📊 Smart Status Indicators: Shows when using AI vs fallback content
- Click "SPIN THE RANT!" - Watch the magical spinning animation
- Real Reddit Data - The app fetches a live rant from subreddits like r/rant, r/mildlyinfuriating
- AI Poetry Generation - Gemini AI transforms the raw emotion into beautiful verse
- Instant Results - See both the original rant and AI-generated poem side by side
- Copy & Share - Share your favorite AI-generated poetry creations!
- Framework: React 18.3.1 with TypeScript
- Build Tool: Vite 5.4.2
- Styling: Tailwind CSS 3.4.1
- Icons: Lucide React 0.344.0
- Development: ESLint, PostCSS, Autoprefixer
- Framework: Flask 2.3.3 (Python)
- AI Model: Gemini AI
- Reddit API: PRAW 7.7.1
- HTTP Client: Requests 2.31.0
- Web Scraping: BeautifulSoup4 4.12.2
- Environment: python-dotenv 1.0.0
- CORS: Flask-CORS 4.0.0
- Model: Gemini AI
- Endpoint: OpenAI-compatible chat completions
- Fallback: Template-based poem generation
- Frontend: Node.js (version 16 or higher), npm or yarn
- Backend: Python 3.7+, pip
- AI: Gemini account and API token
-
Clone the repository
git clone https://github.com/aleeya2903/bolt_project.git cd bolt_project -
Frontend Setup
# Install frontend dependencies npm install # or yarn install
-
Backend Setup
# Navigate to backend directory cd backend # Install Python dependencies pip install -r requirements.txt # Set up environment variables cp env_template.txt .env # Edit .env with your API credentials (see Configuration below)
-
API Configuration
Edit your
.envfile with the following:# Required for AI poem generation HF_TOKEN=your_huggingface_token_here # Optional for live Reddit data (app works with fallback data) REDDIT_CLIENT_ID=your_client_id_here REDDIT_CLIENT_SECRET=your_client_secret_here REDDIT_USER_AGENT=RedditRantRoulette/1.0
-
Start Both Servers
Terminal 1 - Backend (API Server):
cd backend python app.py # Backend will run on http://localhost:5001
Terminal 2 - Frontend (React App):
# From project root npm run dev # or yarn dev # Frontend will run on http://localhost:5173
-
Test the Integration
# In backend directory python test_integration.py -
Open your browser
Navigate to http://localhost:5173
If you only want to run the frontend with hardcoded rants:
npm install
npm run devThe app will work with 8 pre-written rant/poem pairs without needing the backend.
| Command | Description |
|---|---|
npm run dev |
Start development server on port 5173 |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run lint |
Run ESLint for code quality |
| Command | Description |
|---|---|
python app.py |
Start Flask API server on port 5001 |
python test_api.py |
Test the API endpoints |
python test_integration.py |
Test AI poem integration |
python reddit_scraper.py |
Test Reddit scraping functionality |
python aiPoem.py |
Test AI poem generation directly |
bolt_project/
├── frontend/
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── App.tsx # Main React component (updated with AI integration)
│ │ ├── main.tsx # React entry point
│ │ ├── index.css # Global styles
│ │ └── vite-env.d.ts # Vite type definitions
│ ├── index.html # HTML template
│ ├── package.json # Frontend dependencies
│ ├── vite.config.ts # Vite configuration
│ ├── tailwind.config.js # Tailwind CSS configuration
│ └── tsconfig.json # TypeScript configuration
├── backend/
│ ├── app.py # Flask API server (with AI endpoints)
│ ├── aiPoem.py # AI poem generation logic
│ ├── reddit_scraper.py # Reddit data scraping logic
│ ├── test_integration.py # Integration testing script
│ ├── start_server.py # Alternative server starter
│ ├── test_api.py # API testing utilities
│ ├── requirements.txt # Python dependencies
│ ├── env_template.txt # Environment variables template (updated)
│ ├── README.md # Backend-specific documentation
│ └── REDDIT_SETUP.md # Reddit API setup guide
├── .gitignore # Git ignore rules
└── README.md # This file
interface RantData {
id: number;
rant: string;
poem: string;
source?: string; // Shows Reddit source info
isAI?: boolean; // Indicates if poem is AI-generated
}- Live Reddit Integration: Real rants from active subreddits
- AI Poetry Generation: Mistral-7B creates unique poems for each rant
- Smart Fallbacks: Template-based poems if AI is unavailable
- State Management: React hooks for UI state
- Responsive Layout: Two-column grid for rants and poems
- Interactive Animations: Spinning wheels, hover effects, and transitions
- Gradient Backgrounds: Beautiful purple-to-blue gradients
- Animated Text: Pulsing rainbow headers
- Card Layouts: Distinct styling for rants (red/orange) vs poems (green/teal)
- AI Indicators: Visual cues showing "🤖 AI POEM" vs "🎭 THE POEM"
- Source Attribution: Shows Reddit source and upvote count
- Hover Effects: Scale transforms and shadow effects
- Loading States: Spinning animations during AI generation
- Mobile-First: Responsive design that works on all screen sizes
- React plugin enabled
- Development server on port 5173
- Optimized for
lucide-reactpackage
- Custom gradient configurations
- Responsive breakpoints
- Animation utilities
-
Create Hugging Face Account
- Go to Hugging Face
- Sign up for a free account
-
Generate API Token
- Visit HF Settings > Tokens
- Click "Create new token"
- Choose "Read" permissions
- Copy your token
-
Configure Environment
cd backend cp env_template.txt .envEdit
.envfile:# Required for AI functionality HF_TOKEN=hf_your_actual_token_here # Optional for live Reddit data REDDIT_CLIENT_ID=your_14_character_client_id REDDIT_CLIENT_SECRET=your_27_character_secret REDDIT_USER_AGENT=RedditRantRoulette/1.0
For live Reddit data (app works with sample data if not configured):
-
Create Reddit App
- Go to Reddit Apps
- Click "Create App" or "Create Another App"
- Choose "script" as the app type
- Fill in the form:
- Name:
Reddit Rant Roulette - Description:
AI poetry generator from internet rants - Redirect URI:
http://localhost:8080
- Name:
-
Add credentials to
.env(see above)
| Endpoint | Method | Description |
|---|---|---|
/api/rant |
GET | Get a single random rant from Reddit |
/api/rants?count=3 |
GET | Get multiple rants |
/api/poem |
POST | Generate AI poem from provided rant text |
/api/rant-and-poem |
GET | Main endpoint: Get rant + AI poem |
/api/health |
GET | Health check + AI/Reddit status |
/api/setup-info |
GET | Configuration status and setup instructions |
GET /api/rant-and-poem - The primary endpoint used by the frontend:
{
"success": true,
"rant": {
"title": "Why do people...",
"content": "Full rant text...",
"subreddit": "rant",
"score": 1234,
"url": "https://reddit.com/..."
},
"poem": "AI-generated poem text...",
"using_live_data": true
}Run the comprehensive integration test:
cd backend
python test_integration.pyThis tests:
- ✅ Health check endpoint
- ✅ Setup configuration status
- ✅ Reddit rant fetching
- ✅ AI poem generation
- ✅ Combined rant-and-poem endpoint
- ✅ Environment variable validation
-
Test AI directly:
cd backend python aiPoem.py -
Test Reddit scraping:
cd backend python reddit_scraper.py -
Test API endpoints:
cd backend python test_api.py
Build for Production:
npm run buildThe build files will be generated in the dist/ directory.
Frontend Hosting Options:
- Vercel: Zero-config deployment for React apps
- Netlify: Drag-and-drop deployment with continuous integration
- GitHub Pages: Free hosting for static sites
- Cloudflare Pages: Fast global CDN deployment
Backend Hosting Options:
- Heroku: Easy Python app deployment
- Railway: Modern platform with Git integration
- DigitalOcean App Platform: Managed container hosting
- AWS EC2: Full control virtual private servers
- Google Cloud Run: Serverless container platform
Environment Variables for Production:
# Required for backend deployment
HF_TOKEN=your_production_hf_token
REDDIT_CLIENT_ID=your_production_client_id
REDDIT_CLIENT_SECRET=your_production_secret
REDDIT_USER_AGENT=RedditRantRoulette/1.0
FLASK_ENV=productionFor a complete deployment, you'll need:
- Backend API deployed and accessible via HTTPS
- Frontend configured to point to your backend API URL
- Environment variables properly configured for production
- CORS settings updated for your frontend domain
Example Production Setup:
- Backend:
https://your-api.herokuapp.com - Frontend:
https://your-app.vercel.app - Update frontend API calls to use production backend URL
The app features both AI-generated and fallback content covering topics like:
- 🚶 Slow walkers in hallways
- 🍕 Pineapple on pizza debates
- 🚗 Turn signal etiquette
- 🧽 Household chores
- 🎵 Loud music on public transport
- 🍽️ Dining manners
- 🎬 Movie theater behavior
- 🏧 ATM efficiency
- 🎯 And real-time Reddit rants on any topic!
- "Error: Hugging Face API token not found":
- Ensure HF_TOKEN is set in your
.envfile - Verify the token is valid at HF Settings
- Ensure HF_TOKEN is set in your
- "The muses are silent" errors:
- Hugging Face API might be busy
- Model could be loading (first request takes longer)
- Check your internet connection
- AI poems seem generic:
- This uses template fallback, check if HF_TOKEN is configured
- Verify the backend logs for AI errors
- Port 5173 already in use: Kill the process with
lsof -ti:5173 | xargs kill -9 - Module not found: Run
npm installto ensure all dependencies are installed - Build fails: Check Node.js version (requires 16+)
- API connection fails: Ensure backend server is running on port 5001
- "No rant found" errors:
- Reddit API might be hitting rate limits
- Try again in a few minutes
- Verify Reddit API credentials in
.envfile
- CORS errors:
- Ensure Flask server is running on port 5001
- Check if both frontend and backend servers are running
- Import errors:
- Install dependencies:
pip install -r requirements.txt - Check Python version (3.7+ required)
- Install dependencies:
- Port 5001 already in use: Find and kill the process using the port
- Backend not connecting:
- Backend server must be running before frontend
- Check
http://localhost:5001/api/healthin browser - Verify no firewall is blocking the connection
- AI not working but app loads:
- Check
http://localhost:5001/api/setup-infofor configuration status - Run
python test_integration.pyfor detailed diagnostics
- Check
-
Hugging Face Token (Required for AI features)
- Free tier available
- Get from: https://huggingface.co/settings/tokens
- Permissions needed: "Read"
-
Reddit API (Optional for live data)
- Free with rate limits
- Get from: https://www.reddit.com/prefs/apps
- App type: "script"
- Never commit
.envfiles to version control - Use environment variables in production
- Rotate API keys regularly
- Monitor usage to avoid rate limits
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
# Frontend development
npm run dev
# Backend development
cd backend
python app.py
# Run tests
python test_integration.pyThis project is open source and available under the MIT License.
- AI Model: Uses Mistral-7B-Instruct-v0.3, a state-of-the-art language model
- Poetry Style: AI generates unique, contextual poems for each rant
- Rant Sources: Live data from 10+ active Reddit communities
- Performance: Optimized for smooth animations and quick loading
- Fallback System: 3-tier system (AI → Templates → Hardcoded) ensures it always works
- Color Psychology: Red/orange for anger, green/teal for tranquility
Made with 💀, ☕, and 🤖 for maximum internet chaos
Transform your daily frustrations into beautiful art with the power of AI - one rant at a time! 🎭✨