A Chrome extension + FastAPI backend that analyzes Reddit threads and surfaces structured opinion insights directly on the Reddit page.
- Adds an
Analyzebutton to Reddit post action rows. - Sends the current post URL to a local backend (
http://127.0.0.1:3001). - Runs a multi-step AI pipeline to summarize discussion and viewpoints.
- Renders results inline on Reddit.
- Stores the latest analysis in extension local storage for popup viewing.
- Inline analysis UI on Reddit
- appears below post controls after clicking
Analyze - persists until page reload
- supports analyzing multiple posts on the same page
- appears below post controls after clicking
- Structured output
consensusmain_debateviewpoints(with sentiment)most_heatedgap(missing perspective)
- Popup support
- latest analysis is also visible from the extension popup
opinion-intelligence-system/
├── backend/
│ ├── main.py # FastAPI app (/test, /analyze)
│ ├── analyze.py # End-to-end orchestration
│ ├── pipeline.py # Scoring, clustering, sentiment, output shaping
│ ├── reddit_scraper.py # Reddit scraping logic
│ └── requirements.txt
├── extension/
│ ├── manifest.json # Chrome extension config (MV3)
│ ├── background.js # Service worker, calls backend
│ ├── content.js # Injects Analyze button + inline results
│ └── popup/
│ ├── popup.html
│ ├── popup.js
│ └── style.css
└── README.md
- Python 3.10+ (recommended 3.11/3.12)
- Google Chrome (or Chromium-based browser with extension support)
- API credentials compatible with your configured LLM endpoint
From project root:
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate backend/.env:
OPENAI_API_KEY=your_api_key
OPENAI_API_BASE=your_api_base_url
OPENAI_MODEL=your_model_nameRun backend:
python main.pyExpected:
- API on
http://127.0.0.1:3001 - Health check:
GET http://127.0.0.1:3001/test
- Open
chrome://extensions - Turn on Developer mode
- Click Load unpacked
- Select the
extension/folder - Keep backend running on
127.0.0.1:3001
- Open a Reddit page (
https://www.reddit.com/...) - Click
Analyzeon a post - Wait for analysis to finish
- View results inline under the post controls
You can click Analyze on multiple posts; each post keeps its own result panel.
POST /analyze
{
"reddit_url": "https://www.reddit.com/r/.../comments/..."
}{
"success": true,
"data": {
"consensus": "...",
"main_debate": "...",
"viewpoints": [
{
"title": "Viewpoint 1",
"summary": "...",
"sentiment": "positive|negative|neutral"
}
],
"most_heated": "...",
"gap": "...",
"metadata": {
"reddit_url": "...",
"post_title": "...",
"total_comments_analyzed": 0,
"num_clusters": 0
}
}
}{
"success": false,
"error": "error message"
}