Tool-Grounded Article Generator
A lightweight content generation system that combines AI, web search, and full-stack functionality.
π Live Demo
Access the deployed application here:
π https://article-generator-iota.vercel.app/login
Demo Credentials
- Username:
admin
- Password:
admin123
Features
- Content Query Input - Accept article topics via user query
- Web Search Integration - Uses LLM with web search grounding for research
- URL Context Support - Optionally provide URLs as additional context
- Structured Article Generation - Produces articles in JSON format
- SEO Metadata Generation - Automatically generates SEO-optimized metadata including Open Graph tags
- HTML Document Production - Creates polished HTML documents with styling
- Authentication - Simple login-based authentication (no sign-up required)
- Protected Routes - Frontend routes protected by authentication
- Article Display - Preview generated HTML with SEO metadata
- HTML Download - Download the generated article as an HTML file
- Rate Limiting Handling - Gracefully handles API rate limits and search throttling
Tech Stack
Backend
- FastAPI - Modern Python web framework
- OpenRouter - Article generation (uses xiaomi/mimo-v2-flash:free model)
- Google Search - Web search integration (with rate limiting handling)
- JWT - Authentication
- BeautifulSoup - Web scraping
- Requests - HTTP client
Frontend
- React - UI framework
- Vite - Build tool
- React Router - Routing
- Axios - HTTP client
Quick Start
Backend Setup
- Navigate to the backend directory:
- Install dependencies:
pip install -r requirements.txt
- Create environment file:
- Edit
.env and add your API key:
SECRET_KEY=your-secret-key-change-in-production
OPENROUTER_API_KEY=your-openrouter-api-key
-
Get an OpenRouter API key from https://openrouter.ai/
- Start the backend server:
uvicorn main:app --reload
Backend will run at http://localhost:8000
Frontend Setup
- Navigate to the frontend directory:
- Install dependencies:
- Start the development server:
Frontend will run at http://localhost:5173
Default Credentials
- Username: admin
- Password: admin123
Usage
- Open
http://localhost:5173 in your browser
- Login with default credentials
- Enter your article query (e.g., βWrite an article about Trump and the Venezuela attackβ)
- Optionally add a URL for additional context
- Click βGenerate Articleβ
- View the generated article with SEO metadata (including OG tags)
- Download the HTML file if desired
API Endpoints
Authentication
POST /api/login - User login
GET /api/me - Get current user
Article Generation
POST /api/generate-article - Generate article JSON
POST /api/generate-seo - Generate SEO metadata
POST /api/generate-html - Generate HTML document
POST /api/generate-full-article - Generate all at once
Project Structure
article-generator/
βββ backend/
β βββ main.py # FastAPI application
β βββ auth.py # Authentication logic
β βββ config.py # Configuration
β βββ models.py # Pydantic models
β βββ article_generator.py # Article generation
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment template
βββ frontend/
βββ src/
β βββ pages/ # Page components
β βββ components/ # Reusable components
β βββ context/ # React Context
β βββ api/ # API service
βββ package.json # Node dependencies
Notes
- The backend requires a valid OpenRouter API key for article generation
- The application uses OpenRouter with the xiaomi/mimo-v2-flash:free model
- Google Search may be rate-limited; the app handles this gracefully by continuing generation without search context
- In production, change the default
SECRET_KEY in .env
- The default user credentials are in
config.py - change for production