Automated daily news digests with AI. Fetch, summarize, and deliver in under 60 seconds.
Incrux bundles a CLI pipeline and a Flask web app to turn raw news into concise, actionable digests. It can run headless on a schedule or serve multiple users with per-topic dashboards backed by SQLite.
Pipeline steps:
- Fetch the latest articles for a topic from NewsAPI
- Summarize to exactly 3 crisp bullets via OpenAI GPT or Google Gemini (with local fallback)
- Email an HTML digest with links (optional)
- Real-time NewsAPI fetching with topic + max-article control
- Dual AI providers (OpenAI or Gemini) with graceful local fallback
- Multi-user Flask web UI with sign-up/login and per-user topics
- HTML email digests plus plaintext, SMTP via Gmail
- CLI pipeline with switches for topic, recipient, max articles, and email toggle
- Scheduling-friendly (Task Scheduler/Cron); all secrets pulled from
.env
| Component | Technology |
|---|---|
| News source | NewsAPI |
| AI engine | OpenAI Chat Completions or Google Gemini |
| Web | Flask, Flask-Login, SQLAlchemy |
| Database | SQLite |
| Gmail SMTP (TLS) | |
| Language | Python 3.10+ |
incrux/
βββ main.py # CLI entry: fetch β summarize β email
βββ fetch_news.py # NewsAPI integration
βββ summarize.py # AI summarization + fallback
βββ emailer.py # HTML/plaintext email sending
βββ config.py # Env-driven configuration and validation
βββ requirements.txt
βββ webapp/
β βββ app.py # Flask app (auth, topics, dashboards)
β βββ migrate_db.py # DB migration helper
β βββ send_scheduled_emails.py
β βββ templates/ # UI templates (dashboard, login, news, etc.)
βββ README.md
- Python 3.10+ and git
- API keys: NewsAPI, plus OpenAI or Gemini
- Gmail account with an App Password for SMTP
git clone https://github.com/Lavu1807/Incrux.git
cd Incrux
python -m venv .venv
.venv\Scripts\activate # PowerShell
pip install -r requirements.txtCreate .env in the repo root:
# NewsAPI
NEWS_API_KEY=your_newsapi_key
# AI provider (OPENAI or GEMINI)
AI_PROVIDER=OPENAI
OPENAI_API_KEY=your_openai_key
OPENAI_MODEL=gpt-3.5-turbo
# GEMINI_API_KEY=your_gemini_key
# GEMINI_MODEL=gemini-1.5-flash
# Email
[email protected]
EMAIL_PASSWORD=your_app_password
[email protected]
# Defaults
NEWS_TOPIC=Indian Startups
MAX_ARTICLES=10
# Flask (web app)
FLASK_SECRET_KEY=change-me-in-productionpython main.py # default topic + email
python main.py --topic "AI" # custom topic
python main.py --max-articles 20
python main.py --no-email # skip SMTP (test mode)
python main.py --recipient [email protected]# Windows (PowerShell)
$env:PORT=5050
python webapp/app.py
# macOS/Linux
PORT=5050 python webapp/app.py
# Then open http://localhost:5050 in your browser
# Sign up, log in, add topics, and view personalized news summariesThe first run creates newsflash.db automatically. Each user can manage their own topics and article limits.
Note: The app defaults to port 5000, but you can override it with the PORT environment variable if port 5000 is already in use.
- Windows Task Scheduler: point to
python main.pyinside the repo directory. - Cron (Linux/Mac):
0 8 * * * cd /path/to/Incrux && /usr/bin/python3 main.py.
For automated email delivery to web app users at their preferred times:
Windows Task Scheduler (run as Administrator):
$python = "C:\Users\HP\Desktop\news_crux\.venv\Scripts\python.exe"
$script = "C:\Users\HP\Desktop\news_crux\incrux\webapp\send_scheduled_emails.py"
$action = New-ScheduledTaskAction -Execute $python -Argument $script
$trigger = New-ScheduledTaskTrigger -Hourly
Register-ScheduledTask -TaskName "NewsFlash-SendEmails" -Action $action -Trigger $trigger -RunLevel HighestCron (Linux/Mac):
# Run every hour
0 * * * * cd /path/to/Incrux/webapp && /usr/bin/python3 send_scheduled_emails.pyMake sure to set valid Gmail credentials in .env for email delivery to work.
- Keep
.envout of version control (already in.gitignore). - Use Gmail App Passwords (not your regular password) when SMTP auth is enabled.
- Set a strong
FLASK_SECRET_KEYin production and switch Flaskdebugoff for deployment.
Subject: ποΈ News-Flash | Indian Startups
π KEY HIGHLIGHTS:
β’ Indian fintech startups raised $120M this week...
β’ Government announced new incentives for early-stage SaaS companies...
β’ Tech layoffs declined by 18% YoY...
π FULL ARTICLES:
- "India's Startup Funding Hits $15B in 2023..." - TechCrunch
- "GST incentives for SaaS startups..." - LiveMint
- "Tech Job Market Stabilizes..." - YourStory
Solution:
- Ensure all required keys exist in
.env - AI provider key must match
AI_PROVIDERsetting (OPENAI or GEMINI) - For NewsAPI: Get key at newsapi.org
- For OpenAI: Get key at platform.openai.com
- For Gemini: Get key at aistudio.google.com
Solution:
- Verify you copied the key correctly (no extra spaces)
- Check that the key has not been revoked in the provider's dashboard
- For OpenAI/Gemini: Ensure you have an active payment method
Solution:
- Another service may be using port 5000
- Run the app on an alternate port:
$env:PORT=5050 python webapp/app.py
- Then open http://127.0.0.1:5050
Solution:
- Update
.envwith real Gmail credentials (currently has placeholders):EMAIL_SENDER=[email protected] EMAIL_PASSWORD=your_16_char_app_password EMAIL_RECIPIENT=[email protected]
- Ensure
send_scheduled_emails.pyis scheduled in Task Scheduler/Cron - Test the script manually:
cd "C:\Users\HP\Desktop\news_crux\incrux\webapp" python send_scheduled_emails.py - Check that user has email enabled and preferred time is set in profile
Solution:
- The system automatically tries multiple Gemini models (latest first) and falls back to local summary if all fail
- If you see "404 models/... not found": this is normal, the script will retry with alternate models
- Consider using OpenAI instead by setting
AI_PROVIDER=OPENAIin.env
Solution:
- NewsAPI free tier has 100 requests/day limit. Check usage at newsapi.org/account
- Try a more common topic (e.g., "Technology", "Business")
- Increase
--max-articlesparameter - Verify NewsAPI key is valid
Solution:
- OpenAI: Upgrade plan or reduce request frequency
- NewsAPI: Wait 24 hours or upgrade plan
- Gemini: Public API has quotas; check Google Cloud Console
- Improved Gemini fallback: Automatically tries multiple Gemini model versions if the primary fails
- Configurable web app port: Use
PORTenvironment variable to avoid conflicts - Fixed scheduled email script: Now correctly finds database and initializes tables
- Better error handling: Graceful fallback to local summaries when APIs are unavailable or rate-limited
- Multi-topic support (fetch news on 3+ topics)
- Database storage (SQLite) for article history
- Web dashboard to view past digests
- Customizable summary length
- Topic-specific prompts (finance, tech, healthcare)
- Newsletter format with archives
- Slack/Teams integration
- Multiple recipient support
- Cloud deployment (AWS Lambda, Google Cloud)
- Advanced caching to reduce API costs
MIT License - feel free to use this for your portfolio!
- NewsAPI - Real-time news data
- OpenAI - GPT-3.5-turbo API
- Python Community - Excellent libraries
Found a bug or have suggestions? Open an issue or contact me!
Made by Lavanya Verma
P.S. - This project went from zero to production in one afternoon. Imagine what we can build together. π