A Node.js application that tracks product prices from websites on a daily basis.
- Track prices from any website using CSS selectors
- Automatically check prices daily
- View price history with charts
- Simple web interface for managing products
- RESTful API for programmatic access
- Node.js (v14 or higher)
- npm (v6 or higher)
-
Clone the repository:
git clone https://github.com/yourusername/price-analyzer.git cd price-analyzer -
Install dependencies:
npm install -
Configure environment variables (optional):
- Copy
.env.exampleto.env(if not already present) - Modify settings in
.envas needed
- Copy
npm start
The application will be available at http://localhost:3000 (or the port specified in your .env file).
- Click "Add New Product" on the home page
- Enter the product details:
- Name: A descriptive name for the product
- URL: The full URL of the product page
- Selector: A CSS selector that targets the price element on the page
- Visit the product page in your browser
- Right-click on the price and select "Inspect" or "Inspect Element"
- Look at the HTML element that contains the price
- Create a CSS selector that uniquely identifies this element
- Examples:
.price,#product-price,span.current-price
- Examples:
Click on a product name in the product list to view its price history, including a chart and detailed records.
You can manually check the current price of a product by clicking the "Check Now" button on the product list or product details page.
The application provides a RESTful API for programmatic access:
GET /api/products
GET /api/products/:id
GET /api/products/:id/prices
POST /api/products
Body:
{
"name": "Product Name",
"url": "https://example.com/product",
"selector": ".price"
}DELETE /api/products/:id
POST /api/products/:id/check
MIT