This project is a Flask-based application that generates SEO-optimized blog posts using OpenAI. Given a keyword, it fetches mock SEO metrics, generates a structured blog post, and saves the result as a Markdown file. A built-in scheduler can auto-generate one post per day.
- REST API to generate blog posts via
GET /generate?keyword=... - AI-generated content using OpenAI (GPT-4o)
- Mocked SEO data (search volume, difficulty, CPC)
- Daily post generation via scheduler (APScheduler)
- Dockerized setup with local volume mount
- Affiliate link placeholders automatically replaced
- Python
- Flask
- OpenAI API
- APScheduler
- Docker
- dotenv
git clone https://github.com/prateeksharma1809/ai-blog-generator-interview-prateeksharma.git
cd ai-blog-generator-interview-prateeksharmaadd the Open AI API key in format below
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
docker build -t ai-blog-generator .docker run -p 5000:5000 --env-file .env -v "$(pwd)/generated_posts:/app/generated_posts" ai-blog-generatorGenerates a blog post using the given keyword and returns JSON with SEO metrics and file path.
Example:
http://localhost:5000/generate?keyword=wireless%20earbuds
The app includes a built-in job that runs once per day and auto-generates a blog post using a predefined keyword.
To configure the keyword, set it in your .env file:
DAILY_KEYWORD=wireless earbudsThe job is managed via APScheduler, and the output is saved to the generated_posts/ folder automatically.
You can change the frequency or behavior in app.py by modifying the scheduler settings.