Skip to content

stardothosting/nullfake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Null Fake Logo

Null Fake

A Laravel application that analyzes Amazon product reviews to detect fake reviews using AI. Supports Amazon products from 14+ countries including US, Canada, Germany, France, UK, Japan, Mexico, Brazil, India, Singapore, and more. The service includes multiple data collection methods with BrightData's managed web scraping, direct Amazon scraping, and comprehensive AI analysis with multi-provider support.

Visit nullfake.com to try it out.

Read our blog post about how nullfake works

Table of Contents

Getting Started

Prerequisites

Before setting up Null Fake, ensure you have the following installed:

  • PHP 8.2 or higher with the following extensions:
    • BCMath
    • Ctype
    • cURL
    • DOM
    • Fileinfo
    • JSON
    • Mbstring
    • OpenSSL
    • PCRE
    • PDO
    • Tokenizer
    • XML
  • Composer (for PHP dependency management)
  • Node.js 18+ and npm (for frontend asset compilation)
  • MySQL 8.0+ or PostgreSQL 13+
  • Redis (optional, for caching and queue management)

Installation

  1. Clone the repository:

    git clone https://github.com/stardothosting/nullfake.git
    cd nullfake
  2. Install PHP dependencies:

    composer install
  3. Install Node.js dependencies:

    npm install
  4. Build frontend assets:

    npm run build

Environment Setup

  1. Copy the environment file:

    cp .env.example .env
  2. Generate application key:

    php artisan key:generate
  3. Configure your .env file with the following essential settings:

    # Application
    APP_NAME="Null Fake"
    APP_ENV=local
    APP_DEBUG=true
    APP_URL=http://localhost:8000
    
    # Database
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=nullfake
    DB_USERNAME=your_db_user
    DB_PASSWORD=your_db_password
    
    # Queue Configuration
    QUEUE_CONNECTION=database
    ANALYSIS_ASYNC_ENABLED=true
    
    # Choose your LLM provider (required for analysis)
    # Option 1: OpenAI
    LLM_PRIMARY_PROVIDER=openai
    OPENAI_API_KEY=sk-proj-your-openai-key-here
    OPENAI_MODEL=gpt-4o-mini
    
    # Option 2: DeepSeek (cost-effective)
    # LLM_PRIMARY_PROVIDER=deepseek
    # DEEPSEEK_API_KEY=sk-your-deepseek-key-here
    # DEEPSEEK_MODEL=deepseek-v3
    
    # Option 3: Self-hosted Ollama (free)
    # LLM_PRIMARY_PROVIDER=ollama
    # OLLAMA_BASE_URL=http://localhost:11434
    # OLLAMA_MODEL=qwen2.5:7b
    
    # Amazon Review Service (choose one)
    AMAZON_REVIEW_SERVICE=brightdata  # or 'scraping' or 'ajax'
    
    # If using BrightData
    BRIGHTDATA_SCRAPER_API=your-brightdata-api-key
    
    # If using direct scraping (add multiple sessions for rotation)
    # AMAZON_COOKIES_1=your-session-cookies-here
    # AMAZON_COOKIES_2=your-session-cookies-here
    
    # Captcha (for production)
    CAPTCHA_ENABLED=false  # Set to true in production
    # RECAPTCHA_SITE_KEY=your-recaptcha-site-key
    # RECAPTCHA_SECRET_KEY=your-recaptcha-secret-key

Database Setup

  1. Create your database:

    # For MySQL
    mysql -u root -p -e "CREATE DATABASE nullfake CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
    
    # For PostgreSQL
    createdb nullfake
  2. Run migrations:

    php artisan migrate
  3. Seed the database (optional):

    php artisan db:seed

Running the Application

  1. Start the Laravel development server:

    php artisan serve

    The application will be available at http://localhost:8000

  2. Start the queue worker (in a separate terminal):

    php artisan queue:work --queue=analysis
  3. For development with hot reloading (optional, in a separate terminal):

    npm run dev

Quick Test

  1. Visit http://localhost:8000
  2. Enter an Amazon product URL (e.g., https://amazon.com/dp/B08N5WRWNW)
  3. Complete the captcha if enabled
  4. Watch the analysis process in real-time

LLM Provider Setup

Choose one of the following AI providers for review analysis:

Ollama (Free, Self-hosted)

Perfect for development and cost-conscious deployments:

  1. Install Ollama:

    curl -fsSL https://ollama.com/install.sh | sh
  2. Pull a model:

    # Lightweight model (3B parameters)
    ollama pull llama3.2:3b
    
    # Better quality model (7B parameters) 
    ollama pull qwen2.5:7b
  3. Configure in .env:

    LLM_PRIMARY_PROVIDER=ollama
    OLLAMA_BASE_URL=http://localhost:11434
    OLLAMA_MODEL=qwen2.5:7b

OpenAI (Default)

Most reliable, requires API key:

LLM_PRIMARY_PROVIDER=openai
OPENAI_API_KEY=sk-proj-your-openai-key-here
OPENAI_MODEL=gpt-4o-mini

DeepSeek (Cost-effective)

94% cheaper than OpenAI with comparable quality:

LLM_PRIMARY_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-your-deepseek-key-here
DEEPSEEK_MODEL=deepseek-v3

Troubleshooting

Common Issues:

  1. "Class not found" errors: Run composer dump-autoload
  2. Permission errors: Ensure storage/ and bootstrap/cache/ are writable
  3. Queue jobs not processing: Make sure php artisan queue:work is running
  4. LLM provider errors: Test your provider with php artisan llm:manage test
  5. Amazon scraping fails: Check your cookies/API keys and test with php artisan test:amazon-scraping

Logs and Debugging:

  • Application logs: storage/logs/laravel.log
  • Queue jobs: php artisan queue:failed to see failed jobs
  • Debug mode: Set APP_DEBUG=true in .env

How It Works

  1. User submits an Amazon product URL from any supported country and completes a captcha
  2. Null Fake automatically detects the country and retrieves the ASIN from the URL
  3. Database check: If a review analysis for the given ASIN and country exists in the database (and is less than 30 days old), the cached analysis is returned instantly
  4. If fresh data is needed, the service fetches reviews using the configured data collection method (BrightData, direct scraping, or AJAX bypass)
  5. Reviews are analyzed using AI with configurable thresholds for fake review detection
  6. Results are displayed including fake review percentage, grade, explanation, and ratings

Supported Countries

Null Fake supports Amazon product analysis from the following countries:

Country Amazon Domain Status
๐Ÿ‡บ๐Ÿ‡ธ United States amazon.com โœ… Full Support
๐Ÿ‡จ๐Ÿ‡ฆ Canada amazon.ca โœ… Full Support
๐Ÿ‡ฉ๐Ÿ‡ช Germany amazon.de โœ… Full Support
๐Ÿ‡ซ๐Ÿ‡ท France amazon.fr โœ… Full Support
๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom amazon.co.uk โœ… Full Support
๐Ÿ‡ฎ๐Ÿ‡น Italy amazon.it โœ… Full Support
๐Ÿ‡ช๐Ÿ‡ธ Spain amazon.es โœ… Full Support
๐Ÿ‡ฏ๐Ÿ‡ต Japan amazon.co.jp โœ… Full Support
๐Ÿ‡ฆ๐Ÿ‡บ Australia amazon.com.au โœ… Full Support
๐Ÿ‡ฎ๐Ÿ‡ณ India amazon.in โœ… Full Support
๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico amazon.com.mx โœ… Full Support
๐Ÿ‡ง๐Ÿ‡ท Brazil amazon.com.br โœ… Full Support
๐Ÿ‡ธ๐Ÿ‡ฌ Singapore amazon.sg โœ… Full Support
๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands amazon.nl โœ… Full Support

Additional domains supported: Turkey, UAE, Saudi Arabia, Sweden, Poland, Egypt, Belgium

Note: All countries use the same sophisticated AI analysis and data collection methods. Product metadata, review extraction, and fake review detection work consistently across all supported Amazon domains.

Features

Review Collection

  • BrightData Integration: Professional web scraping with managed infrastructure and anti-bot protection
  • Direct Amazon Scraping: Custom scraping with proxy support and session management
  • AJAX Bypass: Alternative method using Amazon's internal endpoints
  • Multi-session Management: Cookie rotation across multiple Amazon sessions for reliability
  • Rate Limiting: Configurable delays and request throttling

AI Analysis

  • Multi-provider Support: OpenAI, DeepSeek, or self-hosted Ollama
  • Configurable Thresholds: Adjustable fake review detection sensitivity (default: 85+ score)
  • Comprehensive Scoring: Heuristic analysis combined with LLM evaluation
  • Grade System: Letter grades (A-F) with detailed explanations

User Experience

  • Real-time Progress: Job-based processing with live progress updates
  • Asynchronous Processing: Queue-based analysis for better performance
  • Captcha Protection: reCAPTCHA and hCaptcha support with session persistence
  • Product Metadata: Title, image, and description extraction for complete product pages
  • Shareable URLs: SEO-optimized product analysis pages

Infrastructure

  • Database Caching: Fast repeat lookups with 30-day cache validity
  • Comprehensive Alerting: Pushover notifications for API errors and system issues
  • Command Line Tools: Management commands for data processing and system maintenance
  • Test Coverage: Extensive test suite with 396+ tests covering all major functionality

Data Collection Methods

The application supports three primary methods for collecting Amazon review data:

BrightData Web Scraper (Recommended)

Professional managed scraping service with enterprise-grade infrastructure:

AMAZON_REVIEW_SERVICE=brightdata
BRIGHTDATA_SCRAPER_API=your-api-key-here

Benefits:

  • Managed anti-bot protection
  • High success rates for data collection
  • Professional infrastructure
  • Built-in retry mechanisms

Direct Amazon Scraping

Custom scraping implementation with advanced session management:

AMAZON_REVIEW_SERVICE=scraping
AMAZON_COOKIES_1=your-session-cookies-here
AMAZON_COOKIES_2=your-session-cookies-here
# Up to AMAZON_COOKIES_10 for rotation

Features:

  • Multi-session cookie rotation
  • CAPTCHA detection and alerting
  • Proxy integration support
  • Bandwidth optimization

AJAX Bypass (Experimental)

Alternative method using Amazon's internal AJAX endpoints:

AMAZON_REVIEW_SERVICE=ajax

Note: Currently disabled pending optimization. Uses Amazon's review rendering endpoints to bypass traditional page scraping.

Database Schema

The asin_data table stores:

  • asin - Amazon Standard Identification Number
  • country - Country code (e.g., 'us', 'ca')
  • product_title - Product title from Amazon
  • product_description - Product description from Amazon
  • product_image_url - Product image URL
  • reviews - JSON array of fetched reviews
  • openai_result - JSON of full AI analysis with detailed scores
  • total_reviews_on_amazon - Total review count reported by Amazon
  • have_product_data - Boolean indicating complete product metadata

The model calculates:

  • fake_percentage - Percentage of reviews flagged as potentially fake (score โ‰ฅ 85)
  • grade - Letter grade (A-F) based on fake review percentage
  • explanation - Human-readable analysis summary
  • amazon_rating - Original average rating from all reviews
  • adjusted_rating - Adjusted rating excluding fake reviews

Technology Stack

  • Backend: Laravel 12 with Livewire 3
  • Database: MySQL/PostgreSQL with JSON columns
  • Queue System: Database-driven job processing for asynchronous analysis
  • Session Management: Multi-provider session rotation for Amazon access
  • AI Integration: Multi-provider LLM support with automatic failover
  • Security: reCAPTCHA/hCaptcha integration with session persistence
  • Monitoring: Comprehensive alerting via Pushover for system health

Configuration

LLM Provider Setup

The application supports three AI providers for review analysis:

Option 1: OpenAI (Default)

LLM_PRIMARY_PROVIDER=openai
OPENAI_API_KEY=sk-proj-your-openai-key-here
OPENAI_MODEL=gpt-4o-mini

Option 2: DeepSeek (94% cost reduction vs OpenAI)

LLM_PRIMARY_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-your-deepseek-key-here
DEEPSEEK_MODEL=deepseek-v3

Option 3: Self-Hosted Ollama (100% cost reduction)

  1. Install Ollama: curl -fsSL https://ollama.com/install.sh | sh
  2. Pull a model: ollama pull qwen2.5:7b or ollama pull llama3.2:3b
  3. Configure:
LLM_PRIMARY_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=qwen2.5:7b

Multi-Provider Fallback

LLM_AUTO_FALLBACK=true

Asynchronous Processing

Control job-based vs immediate processing:

ANALYSIS_ASYNC_ENABLED=true  # Use job queues (recommended for production)
QUEUE_CONNECTION=database    # Database-backed job processing

For immediate processing (development):

ANALYSIS_ASYNC_ENABLED=false

Management Commands

LLM Management

  • Check provider status: php artisan llm:manage status
  • Switch providers: php artisan llm:manage switch --provider=ollama
  • Compare costs: php artisan llm:manage costs --reviews=100
  • Test providers: php artisan llm:manage test

Data Processing

  • Process existing products: php artisan asin:process-existing --missing-any
  • Clean zero-review products: php artisan products:cleanup-zero-reviews
  • Backfill total review counts: php artisan backfill:total-review-counts

Session Management

  • Check Amazon sessions: php artisan amazon:cookie-sessions
  • Test scraping functionality: php artisan test:amazon-scraping
  • Test international URLs: php artisan test:international-urls
  • Debug proxy connections: php artisan debug:amazon-scraping

Queue Processing

  • Start queue worker: php artisan queue:work --queue=analysis
  • Restart workers: php artisan queue:restart

Usage

  1. Enter an Amazon product URL from any supported country (US, Canada, Germany, France, UK, Japan, Mexico, Brazil, India, Singapore, etc.)
  2. Complete the captcha (production only)
  3. View real-time progress as analysis processes
  4. Review detailed results including:
    • Fake review percentage with adjustable thresholds
    • Letter grade (A-F) based on authenticity
    • Detailed explanation of findings
    • Original vs adjusted ratings
    • Product metadata and images
    • Country-specific analysis results

Development

Testing

Run the comprehensive test suite:

php artisan test

The application includes 396+ tests covering:

  • Unit tests for all major services
  • Feature tests for user workflows
  • Integration tests for external services
  • Mock-based testing to prevent external API calls

Code Style

Maintain code quality with Laravel Pint:

./vendor/bin/pint

License

MIT

Shift8

Developed in Toronto, Canada by Shift8 Web

About

Analyze Amazon product reviews of any product to determine authenticity and actual rating

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages