A Node.js application that tracks prices of Amazon products and sends email notifications when prices drop. Built with Express, TypeScript, MongoDB, and Cheerio.
- Track Prices: Monitor prices of products from various e-commerce websites.
- Email Notifications: Receive email alerts when the price of a tracked product drops.
- Scheduled Price Checks: Regularly check the prices of tracked products using cron jobs.
- Request Validation: Ensure valid request data using AJV (Another JSON Schema Validator).
- Monitoring: Adding monitoring for cron job and API health
- Support for other stores: Adding support for other stores as well.
- Node.js
- MongoDB
- A Gmail account for sending email notifications
-
Clone the repository:
git clone https://github.com/your-username/price-tracker.git cd price-tracker
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with the following content:MONGODB_URI=mongodb://localhost:27017/price-tracker EMAIL_USER=[email protected] EMAIL_PASS=your-email-password PORT=3000 BASE_URL=http://localhost:3000
-
Build the project:
npm run build
-
Start the application:
npm start
-
Start the application in development mode:
npm run dev
-
Lint the code:
npm run lint
-
URL:
/api/track
-
Method:
POST
-
Description: Start tracking a product's price.
-
Request Body:
{ "url": "https://example.com/product", "email": "[email protected]" }
-
Response:
{ "message": "Tracking started", "price": 29.99 }
-
URL:
/api/check
-
Method:
GET
-
Description: Manually trigger a price check for all tracked products.
-
Response:
{ "message": "Prices checked" }
src/
├── jobs/
│ └── priceChecker.ts
├── middleware/
│ └── validateRequest.ts
├── models/
│ └── Product.ts
├── routes/
│ └── index.ts
├── schemas/
│ └── product.ts
├── services/
│ ├── notifier.ts
│ └── scraper.ts
├── app.ts
└── server.ts
- Fork the repository
- Create a new branch: git checkout -b feature/your-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin feature/your-feature
- Create a new Pull Request