Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pro-softs/reddit-analysis-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reddit Research Backend

A lean Node.js backend that uses AI to research topics through Reddit discussions.

Architecture

4 Core Services

  1. Semantic Layer - Analyzes user queries using OpenAI to extract intent, tags, and keywords
  2. Reddit Fetcher - Searches Reddit using generated keywords across relevant subreddits
  3. Summarizer - Uses AI to summarize Reddit posts and extract key insights
  4. Coordinator - Orchestrates the entire pipeline

API Endpoints

POST /api/research

Research a topic through Reddit discussions.

Headers:

Authorization: Bearer <firebase-id-token>
Content-Type: application/json

Request Body:

{
  "query": "How do indie SaaS founders get first 100 users?",
  "maxPosts": 20,
  "timeFilter": "month",
  "subreddits": ["entrepreneur", "SaaS", "startups"]
}

Response:

{
  "success": true,
  "data": {
    "query": "How do indie SaaS founders get first 100 users?",
    "analysis": {
      "intent": "Growth strategies for SaaS founders to acquire their first customers",
      "tags": ["SaaS growth", "first users", "startup marketing"],
      "keywords": ["SaaS first 100 users", "indie hacker customer acquisition"]
    },
    "posts": [
      {
        "id": "abc123",
        "title": "How I got my first 100 SaaS customers",
        "summary": "Founder shares strategy of direct outreach and content marketing...",
        "insights": ["Direct outreach to target audience", "Content marketing builds trust"],
        "relevanceScore": 9,
        "url": "https://reddit.com/r/entrepreneur/comments/abc123",
        "subreddit": "entrepreneur",
        "score": 245,
        "comments": 67
      }
    ],
    "meta": {
      "totalFound": 156,
      "processed": 20,
      "summarized": true
    }
  }
}

Setup

  1. Environment Variables - Copy .env.example to .env and fill in:

  2. Install Dependencies

    npm install
  3. Start Server

    npm run dev  # Development with auto-reload
    npm start    # Production

Rate Limits

  • 100 requests per 15 minutes per IP
  • Max 50 posts per research request

Error Handling

The API returns structured error responses:

{
  "error": "Query not suitable for Reddit research",
  "suggestion": "Try: 'Reddit communities discussing SaaS growth'"
}

Security Features

  • Helmet.js for security headers
  • CORS protection
  • Rate limiting
  • Input validation
  • Firebase token verification# reddit-backend

About

Search reddit and ai analyses the results for startup research

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published