Skip to content

ferbiy/pain-radar

Repository files navigation

Pain Radar 🎯

AI-Powered Product Idea Generator - Automatically discover and validate product ideas from Reddit pain points.

🤖 AI-Generated Project: This project was 97% generated by AI and built in approximately 15 hours total development time.

Overview

Pain Radar is an intelligent system that monitors Reddit discussions, identifies pain points and frustrations, and generates validated product ideas using AI agents. The application uses OpenAI's GPT-4 with structured outputs to analyze Reddit posts and comments, extract actionable insights, and score product opportunities.

Key Features

  • 🔍 Automated Reddit Monitoring - Tracks multiple subreddits for trending discussions
  • 🤖 AI-Powered Analysis - Uses GPT-4 to identify pain points and validate ideas
  • 📊 Smart Scoring System - Ranks ideas based on market potential, feasibility, and demand
  • 📧 Email Digests - Sends curated ideas to subscribers based on their interests
  • 🎨 Modern UI - Beautiful, responsive interface built with Next.js and Tailwind CSS
  • 🔐 Secure Authentication - Powered by Supabase Auth

Tech Stack

  • Frontend: Next.js 15, React, Tailwind CSS, shadcn/ui
  • Backend: Next.js API Routes, TypeScript
  • AI: OpenAI GPT-4 with Structured Outputs
  • Database: Supabase (PostgreSQL)
  • Queue: Redis (for job processing)
  • Email: Resend
  • Deployment: Vercel

Prerequisites

  • Node.js 18+ and npm
  • Supabase account
  • OpenAI API key
  • Reddit API credentials (optional, for authenticated requests)
  • Resend API key (for email functionality)
  • Redis instance (Upstash recommended)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/pain-radar.git
    cd pain-radar
  2. Install dependencies

    npm install
  3. Set up environment variables

    • Copy .env.example to .env (if provided)
    • Fill in all required environment variables
  4. Run database migrations (if applicable)

    # Set up Supabase locally or use the hosted version
    # Run migrations to create necessary tables
  5. Start the development server

    npm run dev

Cron Job Setup (REQUIRED)

⚠️ Important: This application requires a cron job to process the queue and generate ideas.

Using External Cron Service (Recommended for Free Tier)

Since Vercel's free tier only triggers cron jobs every 5 minutes, we recommend using an external service:

  1. Sign up at cron-job.org (free)

  2. Create a new cron job with the following settings:

    • URL: https://your-app.vercel.app/api/queue/process
    • Schedule: * * * * * (every minute)
    • HTTP Method: POST
    • Custom Headers: Add header x-cron-secret with the value from your CRON_SECRET environment variable
  3. Enable the job and verify it's running

Alternative: Vercel Cron (Paid Plans)

If you're on a Vercel paid plan, the built-in cron job will work automatically:

// vercel.json
{
  "crons": [
    {
      "path": "/api/queue/process",
      "schedule": "* * * * *"
    }
  ]
}

The endpoint is already configured with security headers and requires the CRON_SECRET to authenticate requests.

Available Cron Endpoints

All cron endpoints require the x-cron-secret header for authentication:

  1. POST /api/queue/process - Processes jobs in the queue (recommended for production)

    • Handles both coordinator and post_processor jobs
    • Implements proper job queuing and error handling
  2. POST /api/cron/generate - Generates ideas from Reddit (legacy, for direct generation)

    • Fetches Reddit posts and generates ideas in a single request
  3. POST /api/cron/email - Sends email digests to subscribers

    • Configure separately if you want automated email digests

Development

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Run linter
npm run lint

Database Schema

Supabase Types

To generate TypeScript types from your Supabase schema:

supabase gen types typescript --linked > types/supabase.ts

# or

npx supabase gen types typescript --linked > types/supabase.ts

Project Structure

pain-radar/
├── agents/          # AI workflow orchestration
├── app/             # Next.js app directory
│   ├── (auth)/      # Authentication pages
│   ├── (dashboard)/ # Dashboard pages
│   ├── (marketing)/ # Landing pages
│   └── api/         # API routes
├── components/      # React components
├── lib/             # Utility libraries
│   ├── auth/        # Authentication logic
│   ├── email/       # Email sending
│   ├── openai/      # OpenAI integration
│   ├── queue/       # Job queue operations
│   ├── reddit/      # Reddit API client
│   └── supabase/    # Supabase clients
├── types/           # TypeScript type definitions
└── public/          # Static assets

How It Works

  1. Reddit Monitoring: The system monitors configured subreddits for trending posts
  2. AI Analysis: Each post is analyzed by GPT-4 to extract pain points and validate potential ideas
  3. Idea Generation: The AI generates structured product ideas with scores and reasoning
  4. Queue Processing: Jobs are queued and processed one at a time to manage API limits
  5. Email Delivery: Subscribers receive curated ideas based on their topic preferences

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Acknowledgments

This project was built with the assistance of AI (Claude/GPT-4), demonstrating the power of AI-assisted development in creating full-stack applications.

About

POC created with a lot of AI usage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages