Skip to content

Search Stack Overflow from the terminal. Get clean HTML with human-friendly cards and LLM-ready text. No hallucinated answers.

Notifications You must be signed in to change notification settings

peterdunson/renderstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 renderstack

renderstack lets you search Stack Overflow from the terminal and render results into a clean HTML page with two views:

  • 👤 Human View — beautifully formatted questions and answers (title, score, tags, body preview, answers)
  • 🤖 LLM View — plain-text block you can copy-paste into ChatGPT/Claude/etc.

No more hallucinated Stack Overflow answers from LLMs — everything comes straight from the Stack Overflow API.

Inspired by Andrej Karpathy's rendergit and renderscholar.


✨ Why renderstack?

The problem: When you ask ChatGPT/Claude about debugging issues, they sometimes make up fake Stack Overflow posts or give outdated answers.

The solution: Search real Stack Overflow questions/answers, then feed the clean results to your AI assistant. Get accurate, up-to-date solutions with proper context.


🔧 Installation

You'll need Python 3.10+. Then install directly from GitHub:

pip install git+https://github.com/yourusername/renderstack.git

Or clone and install locally:

git clone https://github.com/yourusername/renderstack.git
cd renderstack
pip install -e .

🚀 Usage

Basic search

Search Stack Overflow from the terminal:

renderstack "react useEffect memory leak"

This will:

  1. Search Stack Overflow API for relevant questions
  2. Fetch the top answers for each question
  3. Rank and filter results
  4. Generate an HTML file
  5. Auto-open it in your browser

Options

Control the number of results:

renderstack "python async await" --pool-size 100 --max-results 10
  • --pool-size N — Number of questions to fetch from API (default: 50)
  • --max-results N — Number of top questions to keep after ranking (default: 20)
  • --max-answers N — Max answers per question (default: 3)

Ranking modes:

renderstack "typescript generics" --mode accepted

Available modes:

  • most-voted → Highest score (default)
  • recent → Newest questions first
  • accepted → Only questions with accepted answers
  • unanswered → Questions without accepted answers (good for finding knowledge gaps)
  • active → Most recently active discussions

Output control:

renderstack "django rest framework" -o myresults.html --no-open
  • -o FILE — Save to specific file (default: temp file)
  • --no-open — Don't auto-open in browser

Full example

renderstack "react hooks best practices" \
  --pool-size 80 \
  --max-results 15 \
  --mode accepted \
  --max-answers 2

This will:

  • Fetch 80 questions from Stack Overflow
  • Filter to top 15 questions that have accepted answers
  • Show 2 answers per question
  • Rank by vote score

📊 Modes Explained

Each mode changes how questions are ranked and filtered:

Mode Description Best For
most-voted Highest score questions Finding canonical solutions
recent Newest questions first Latest techniques, new library versions
accepted Only questions with ✅ accepted answers Validated solutions
unanswered Questions without accepted answers Contributing, or finding edge cases
active Most recently active Ongoing discussions, evolving topics

📂 Output

The HTML output includes two views:

👤 Human View

  • Clean, readable cards for each question
  • Shows: title, score, answer count, views, tags, date
  • Question body preview
  • Top answers with scores and accepted status
  • Answers highlighted with green border if accepted
  • Click-through links to full Stack Overflow posts

🤖 LLM View

  • Plain text in a <textarea> for easy copying
  • Formatted for maximum AI comprehension:
    • Clear separators between questions
    • Emoji markers for structure (❓ 🔗 📊 🏷️ 💬)
    • Code blocks preserved
    • No HTML formatting
  • Ready to paste into ChatGPT, Claude, or any AI assistant

🔑 API Key (Optional)

Stack Overflow API has these rate limits:

  • Without API key: 300 requests/day (by IP address)
  • With API key: 10,000 requests/day (free)

For most users, 300/day is plenty. If you need more:

  1. Register for a free API key: https://stackapps.com/apps/oauth/register
  2. Set it in your environment:
    export STACKOVERFLOW_API_KEY=your_key_here
  3. Or pass it directly:
    renderstack "query" --api-key your_key_here

The tool works perfectly fine without an API key for typical usage.


💡 Pro Tips

Quick debugging workflow:

# 1. Search for your error
renderstack "TypeError: Cannot read property of undefined" --mode recent --max-results 5

# 2. Switch to LLM view in browser
# 3. Copy the text
# 4. Paste into Claude/ChatGPT with: "Help me fix this based on these Stack Overflow answers"

Finding best practices:

renderstack "react performance optimization" --mode most-voted --pool-size 100

Exploring new libraries:

renderstack "tailwind css dark mode" --mode recent --max-results 10

Contributing to Stack Overflow:

renderstack "python asyncio" --mode unanswered --max-results 20
# Find questions you can answer!

🛠️ Development

Clone the repo:

git clone https://github.com/yourusername/renderstack.git
cd renderstack

Install in editable mode:

pip install -e .

Run tests:

python -m renderstack.stackoverflow  # Test API client
python -m renderstack.cli "test query"  # Test full workflow

Project structure:

renderstack/
├── renderstack/
│   ├── __init__.py
│   ├── cli.py              # Command-line interface + HTML generation
│   ├── models.py           # Data models (Question, Answer)
│   └── stackoverflow.py    # Stack Overflow API client
├── .gitignore
├── README.md
├── pyproject.toml
└── requirements.txt

🤝 Contributing

Contributions welcome! Ideas for new features:

  • More ranking algorithms (relevance score, trending)
  • Save/load favorite searches
  • Export to Markdown format
  • Filter by specific tags
  • Integration with other Q&A sites (Reddit, GitHub Discussions)

📝 Notes

  • Uses the official Stack Overflow API (no web scraping!)
  • Respects API rate limits with built-in throttling
  • Works offline after initial fetch (HTML is self-contained)
  • All code snippets in answers are preserved with proper formatting
  • Handles edge cases (deleted users, no answers, etc.)

📄 License

MIT © 2025 Your Name


🙏 Credits


📧 Support

Found a bug? Have a feature request?

About

Search Stack Overflow from the terminal. Get clean HTML with human-friendly cards and LLM-ready text. No hallucinated answers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages