Skip to content

coleschaffer/RedditAgg

Repository files navigation

RedditAgg

Next.js React TypeScript Tailwind

An AI-powered Reddit aggregator that synthesizes answers to your questions from relevant Reddit discussions.

Overview

RedditAgg takes any question you have, searches for relevant Reddit threads, extracts key information from posts and comments, and uses AI to synthesize a coherent, sourced answer. It combines Google Custom Search, Reddit's API, and Groq's Llama 3 70B model to deliver contextual answers with confidence scores and source attribution.

Instead of manually searching Reddit and reading through dozens of threads, get a synthesized answer in seconds with links to the original discussions.

Features

  • Intelligent Search - Uses Google Custom Search to find the most relevant Reddit threads
  • Content Extraction - Fetches posts and top-voted comments from Reddit
  • AI Summarization - Generates initial summaries using Llama 3 70B via Groq
  • Relevance Filtering - Filters out off-topic results automatically
  • Multi-Source Synthesis - Combines insights from multiple threads into one answer
  • Confidence Scoring - Calculates confidence (50-95%) based on source quality
  • Source Attribution - Provides clickable links to all original Reddit discussions
  • Markdown Rendering - Clean, formatted output with proper styling

Tech Stack

Category Technology
Framework Next.js 15.3 (App Router)
Frontend React 19, TypeScript 5
Styling Tailwind CSS 4, Typography plugin
Reddit API snoowrap 1.23
AI Model Groq SDK (Llama 3 70B)
Search Google Custom Search API

Getting Started

Prerequisites

  • Node.js 18+
  • Reddit OAuth credentials (Client ID, Secret, Username, Password)
  • Google Custom Search API key and CSE ID
  • Groq API key

Installation

# Clone the repository
git clone https://github.com/coleschaffer/RedditAgg.git
cd RedditAgg

# Install dependencies
npm install

Configuration

Create a .env.local file:

# Reddit API
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password

# Google Custom Search
GOOGLE_API_KEY=your_google_api_key
GOOGLE_CSE_ID=your_cse_id

# Groq AI
GROQ_API_KEY=your_groq_api_key

Running

# Development
npm run dev

# Production
npm run build && npm start

Open http://localhost:3000 to use the app.

Project Structure

RedditAgg/
├── src/app/
│   ├── api/summarize/
│   │   └── route.ts         # Main API endpoint
│   ├── page.tsx             # Frontend UI
│   ├── layout.tsx           # Root layout
│   └── globals.css          # Global styles
├── public/                  # Static assets
├── tailwind.config.ts       # Tailwind configuration
└── package.json

How It Works

  1. User Input - Enter any question in the search box
  2. Search - Google Custom Search finds relevant Reddit threads
  3. Fetch - snoowrap retrieves posts and top 3 comments per thread
  4. Summarize - Groq AI generates summaries for each post
  5. Filter - Irrelevant summaries are filtered out
  6. Synthesize - Final answer is generated combining all sources
  7. Display - Markdown answer with confidence score and source links

Configuration Options

Adjustable constants in the API route:

  • MAX_GOOGLE_RESULTS_TO_CHECK - Top search results to examine (default: 10)
  • MAX_REDDIT_POSTS_TO_PROCESS - Maximum posts to fetch (default: 5)
  • MAX_COMMENTS_PER_POST - Top comments per post (default: 3)

License

MIT License

About

AI-powered Reddit aggregator that synthesizes answers from relevant discussions with source attribution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •