Go to file
2025-06-24 21:48:03 +02:00
.idea backup 2025-06-24 21:48:03 +02:00
app first 2025-05-06 10:01:03 +02:00
docs first 2025-05-06 10:01:03 +02:00
price-compare-api backup 2025-06-24 21:48:03 +02:00
.gitignore backup 2025-06-24 21:48:03 +02:00
README.md first 2025-05-06 10:01:03 +02:00
systemarhitecture.md first 2025-05-06 10:01:03 +02:00

Price Comparison PWA Implementation

This repository contains the implementation of a price comparison PWA with NestJS backend and PostgreSQL database, as outlined in the improvement plan.

Implementation Details

The implementation follows the structure outlined in the improvement plan, with the following components:

Backend (NestJS)

The backend is implemented using NestJS and includes the following modules:

  1. Product Module

    • API endpoints for products
    • Search and filtering functionality
    • CRUD operations
  2. Price Module

    • Price history tracking
    • Price comparison functionality
    • Discount calculations
  3. Source Module

    • Source metadata management
    • Product listing by source
  4. Scraper Module

    • HTML parsing using cheerio
    • Data transformation
    • Scheduled scraping jobs
  5. User Module

    • Watchlist functionality
    • Price drop notifications

Database (PostgreSQL)

The database schema includes the following models:

  1. Product

    • Basic product information
    • Category and description
    • Availability status
  2. Price

    • Regular and discounted prices
    • Promotion information
    • Historical price tracking
  3. Source

    • Data source information
    • Last scraped timestamp
  4. User

    • User information
    • Watchlist and notifications
  5. WatchlistItem

    • User-product relationship for watchlist
  6. Notification

    • Price drop notification configuration

API Endpoints

The API provides the following endpoints:

  1. Products

    • GET /products - List all products with pagination
    • GET /products/:id - Get product details
    • GET /products/search - Search products by name/category
  2. Prices

    • GET /prices/product/:id - Get all prices for a product
    • GET /prices/compare/:ids - Compare prices for multiple products
    • GET /prices/history/:id - Get price history for a product
  3. Sources

    • GET /sources - List all data sources
    • GET /sources/:id - Get source details
    • GET /sources/:id/products - Get products from a specific source
  4. User Features

    • GET /users/:userId/watchlist - Get user's watchlist
    • POST /users/:userId/watchlist - Add product to watchlist
    • DELETE /users/:userId/watchlist/:productId - Remove product from watchlist
    • GET /users/:userId/notifications - Get user's notifications
    • POST /users/:userId/notifications - Configure price drop notification
    • DELETE /users/:userId/notifications/:productId - Remove notification

Getting Started

  1. Clone the repository
  2. Install dependencies:
    cd price-compare-api
    npm install
    cd ../app
    npm install
    
  3. Set up the database:
    cd price-compare-api
    npx prisma migrate dev
    
  4. Start the backend:
    cd price-compare-api
    npm run start:dev
    
  5. Start the frontend:
    cd app
    npm run dev
    

Next Steps

  1. Implement authentication and authorization
  2. Add more data sources
  3. Enhance the frontend with more features
  4. Implement push notifications for price drops
  5. Add analytics and reporting