Anonymous961/pixel-pricer-server

server for tracking of multiple eccomerce platform for product and price comparision

โ˜… 0Forks 0TypeScriptGitHub โ†—Compare
ecommercenodejsplaywrighttypescript

README

Here's a comprehensive README.md file for your Pixel Pricer project:

# Pixel Pricer - E-commerce Price Tracker

![Project Logo](https://via.placeholder.com/150) _(Consider adding a logo here)_

A web scraping service that tracks product prices across multiple e-commerce platforms and notifies users of price drops.

## Features

- ๐Ÿ›๏ธ Multi-platform price tracking (Amazon, Flipkart, etc.)
- ๐Ÿ“‰ Price drop alerts via email/SMS
- ๐Ÿ“Š Price history analytics
- ๐Ÿ”” Customizable notification thresholds
- ๐Ÿš€ Scalable architecture for adding new stores

## Tech Stack

### Backend

- **Node.js** with **TypeScript**
- **Playwright** for browser automation
- **Express.js** for API routes
- **Bull** for job queues
- **PostgreSQL** with **Prisma** ORM

### Frontend

- **Next.js** (React) for dashboard
- **Tailwind CSS** for styling
- **Chart.js** for price history visualization

## Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/yourusername/pixel-pricer.git
   cd pixel-pricer
   ```
  1. Install dependencies:

    npm install
  2. Set up environment variables (create .env file):

    DATABASE_URL="postgresql://user:password@localhost:5432/pixel-pricer"
    SMTP_HOST=your-smtp-host
    SMTP_PORT=587
    SMTP_USER=your-email
    SMTP_PASS=your-password
  3. Run database migrations:

    npx prisma migrate dev

Running the Project

Development Mode

npm run dev

Production Build

npm run build
npm start

Scraper Architecture

graph TD
    A[Frontend] --> B[API Server]
    B --> C[Scraper Queue]
    C --> D[Amazon Scraper]
    C --> E[Flipkart Scraper]
    D --> F[(Database)]
    E --> F
    F --> G[Notification Service]
Loading

Configuration

Edit config/scrapers/*.config.ts files to update:

  • Product selectors
  • Scraping intervals
  • Platform-specific settings

Example Amazon config:

export const AmazonConfig = {
  selectors: {
    productTitle: "span#productTitle",
    price: ".a-price-whole",
    availability: "#availability span",
  },
  scrapingInterval: "6 hours",
};

Adding New Stores

  1. Create a new scraper class extending BaseScraper:

    export class NewStoreScraper extends BaseScraper {
      getProductSelectors() {
        return {
          name: "product-title-selector",
          price: "price-selector",
        };
      }
    
      async scrapeProduct(url: string) {
        // Implementation
      }
    }
  2. Register the scraper in the queue system:

    scraperQueue.process("new-store", async (job) => {
      const scraper = new NewStoreScraper();
      return await scraper.scrapeProduct(job.data.url);
    });

API Endpoints

Endpoint Method Description
/api/products GET List tracked products
/api/scrape/amazon POST Scrape Amazon product
/api/scrape/flipkart POST Scrape Flipkart product
/api/alerts GET List price drop alerts

Deployment

Docker Setup

docker-compose up -d

Environment Variables

Variable Required Description
DATABASE_URL Yes PostgreSQL connection string
SMTP_* No Email notification settings
REDIS_URL No Redis connection for queues

Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Your Name - @yourtwitter - [email protected]

Project Link: https://github.com/yourusername/pixel-pricer


## Key Sections Included:

1. **Project Overview**: Brief description and features
2. **Tech Stack**: Backend and frontend technologies
3. **Installation**: Setup instructions
4. **Configuration**: How to customize scrapers
5. **Architecture**: Visual representation of the system
6. **API Documentation**: Available endpoints
7. **Deployment**: Docker and environment setup
8. **Contributing**: Guidelines for contributors

You can customize this further by:
- Adding screenshots of your application
- Including more detailed API documentation
- Adding a roadmap or future features section
- Including troubleshooting tips for common issues
- Adding a section about rate limiting and ethical scraping practices

Contributors

Anonymous961

Issues