A full-stack web application for generating social media posts using Runpod.io's AI models. The system orchestrates multiple model calls to create complete posts with hooks, captions, and CTAs.
- Multi-Model Orchestration: Sequentially calls Phi-2 (Hook/CTA) and Mistral 7B (Caption) models
- Cost Tracking: Monitors and displays costs for each generation step (~$0.0005 per post)
- Full Dashboard: Modern React dashboard with input forms, output display, and history
- History Management: View, filter, and manage past generations
- Flexible Input: Support both topic/keywords and full prompt input modes
- Formatted Output: Ready-to-use post text with copy-to-clipboard functionality
- FastAPI REST API with async endpoints
- SQLite database for generation history
- Runpod.io API client with OpenAI-compatible endpoints
- Orchestration service for sequential model calls
- Cost tracking and monitoring
- Modern dashboard UI with TailwindCSS
- Input form with topic/prompt toggle
- Output display with component previews
- History view with pagination
- Real-time generation status
- Hook Generation (Phi-2, ~2s, $0.00011): Creates engaging introduction
- Caption Generation (Mistral 7B, ~5s, $0.00028): Generates main body text
- CTA Generation (Phi-2, ~1s, $0.00006): Creates call-to-action
- Merge & Output (~1s, $0.00005): Combines all components into final post
Total Cost: ~$0.0005 per post
- Python 3.8+
- Node.js 18+
- Runpod.io account with deployed models
-
Install Python dependencies:
pip install -r requirements.txt
-
Configure environment variables:
Create or edit your
.envfile and add your Runpod.io credentials:RUNPOD_API_KEY=your_runpod_api_key_here RUNPOD_PHI2_ENDPOINT_ID=your_phi2_endpoint_id_here RUNPOD_MISTRAL_ENDPOINT_ID=your_mistral_endpoint_id_here DATABASE_URL=sqlite:///./generations.db -
Run the backend server:
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
The API will be available at
http://localhost:8000API documentation:http://localhost:8000/docs
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Configure API URL (optional): Create
.env.local:NEXT_PUBLIC_API_URL=http://localhost:8000 -
Run the development server:
npm run dev
The frontend will be available at
http://localhost:3000
See RUNPOD_SETUP.md for detailed instructions on deploying models on Runpod.io.
- Open the dashboard in your browser
- Choose input type: Topic/Keywords or Full Prompt
- Enter your content
- Click Generate Post
- View the generated components and final output
- Copy the formatted post to clipboard
- Navigate to the History tab
- Browse past generations
- Click View to see full details
- Click Delete to remove a generation
POST /api/generate
Content-Type: application/json
{
"input_type": "topic" | "prompt",
"input_content": "your input here"
}
GET /api/history?page=1&page_size=10
GET /api/history/{id}
DELETE /api/history/{id}
- Hook Generation: $0.00011
- Caption Generation: $0.00028
- CTA Generation: $0.00006
- Merge & Output: $0.00005
- Total: ~$0.0005 per post
.
├── backend/
│ ├── main.py # FastAPI app entry point
│ ├── config.py # Configuration management
│ ├── models/
│ │ ├── database.py # Database models
│ │ └── schemas.py # Pydantic schemas
│ ├── services/
│ │ ├── runpod_client.py # Runpod.io API client
│ │ ├── orchestration.py # Generation orchestration
│ │ └── cost_tracker.py # Cost tracking
│ └── routers/
│ ├── generation.py # Generation endpoints
│ └── history.py # History endpoints
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js app directory
│ │ ├── components/ # React components
│ │ └── services/ # API client
│ └── package.json
├── requirements.txt
└── README.md
# Run with auto-reload
uvicorn backend.main:app --reload
# Run with custom port
uvicorn backend.main:app --port 8001cd frontend
npm run devThe database is automatically initialized on first run. To reset:
rm generations.db
# Restart the backend server- Database errors: Ensure SQLite is available and the database file is writable
- Runpod API errors: Verify your API key and endpoint IDs in
.env - Import errors: Ensure you're running from the project root directory
- API connection errors: Check that the backend is running and
NEXT_PUBLIC_API_URLis correct - Build errors: Run
npm installagain to ensure all dependencies are installed
- Verify endpoint IDs are correct
- Check that endpoints are active and running
- Ensure API key has proper permissions
- Review Runpod.io logs for model-specific errors
This project is open source and available under the MIT License.