Skip to content

Automatically fetch daily Product Hunt products and export them to CSV format, sorted by vote count

Notifications You must be signed in to change notification settings

ranbot-ai/product-hunt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product Hunt Daily Fetcher

Automatically fetch daily Product Hunt products and export them to CSV format, sorted by vote count.

Features

  • 📊 Fetches daily released products from Product Hunt
  • 🗳️ Sorts products by upvote count
  • 📄 Exports data to CSV format
  • ⏰ Designed for automated daily execution
  • 🔐 Secure API token management via environment variables

Prerequisites

  • Node.js (version 14 or higher)
  • npm or yarn
  • Product Hunt API token

Setup Instructions

1. Clone or Download the Repository

git clone git@github.com:ranbot-ai/product-hunt.git
cd product-hunt

2. Install Dependencies

npm install

3. Configure Environment Variables

  1. Copy the example environment file:

    cp .env.example .env
  2. Edit .env and add your Product Hunt API token:

    PRODUCT_HUNT_API_TOKEN=your_actual_token_here
    

4. Get Your Product Hunt API Token

  1. Go to Product Hunt API Dashboard
  2. Create a new application
  3. Copy your API token
  4. Paste it in your .env file

Usage

Manual Run

To fetch today's products manually:

npm start

This will create a CSV file in the output/ directory with the format: products_YYYY-MM-DD.csv

Automated Daily Run (Cron Job)

Using the provided script (macOS/Linux):

A run.sh script is provided in the scripts/ folder that will:

  • Run the fetcher
  • Automatically commit the CSV file
  • Push to GitHub
  1. Open your crontab:

    crontab -e
  2. Add a daily job (runs at 11:59 PM daily):

    59 23 * * * /path/to/product-hunt/scripts/run.sh
  3. The script will log output to tmp/log.txt

Manual setup (macOS/Linux):

  1. Open your crontab:

    crontab -e
  2. Add a daily job (runs at 11:59 PM daily):

    59 23 * * * cd /path/to/product-hunt && /usr/local/bin/node src/index.js
  3. Make sure to use the full path to your node binary (find it with which node)

On Windows (Task Scheduler):

  1. Open Task Scheduler
  2. Create a new Basic Task
  3. Set it to run daily
  4. Action: Start a program
  5. Program: node
  6. Arguments: src/index.js
  7. Start in: C:\path\to\product-hunt

Output Format

The CSV file contains the following columns:

Column Description
Rank Position based on votes
Name Product name
Tagline Product tagline
Votes Number of upvotes
Comments Number of comments
URL Product Hunt URL
Website Product website URL
Topics Product categories/topics
Description Product description
Created At Launch date

Project Structure

product-hunt/
├── src/
│   ├── index.js          # Main script
│   └── utils/
│       ├── api.js        # Product Hunt API client
│       └── csv.js        # CSV export utilities
├── scripts/
│   └── run.sh            # Automated run script with git commit/push
├── output/               # Generated CSV files
├── tmp/                  # Log files (git-ignored)
├── .env                  # Your API configuration (git-ignored)
├── .env.example          # Example configuration
├── .gitignore            # Git ignore rules
├── package.json          # Project dependencies
└── README.md             # This file

Troubleshooting

"Unauthorized" Error

  • Check that your API token is correct in the .env file
  • Ensure your Product Hunt application has the necessary permissions

"Module not found" Error

  • Run npm install to install all dependencies

No Output Directory

  • The script will automatically create the output/ directory if it doesn't exist

Contributing

Feel free to submit issues or pull requests to improve this project!

License

MIT

About

Automatically fetch daily Product Hunt products and export them to CSV format, sorted by vote count

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published