Enterprise-grade price tracking made simple β Monitor product prices across the web and get instant notifications when prices drop.
- π Smart Price Tracking β Monitor prices from any e-commerce website with flexible CSS selectors
- π§ Multi-Channel Notifications β Get alerts via email (SMTP) or SMS (Twilio) when prices change
- π Price History β Track price trends and changes over time with detailed history
- π Enterprise Security β Encryption, CSRF protection, rate limiting, and comprehensive input validation
- π Production Ready β Docker support, health checks, Prometheus metrics, and structured logging
- π§ͺ Well Tested β 80.67% test coverage with comprehensive unit, integration, and security tests
- β‘ High Performance β Async HTTP client, database connection pooling, and optimized queries
- π± Modern Web UI β Clean, responsive interface for managing trackers and profiles
-
Clone the repository
git clone https://github.com/pricewatch/pricewatch.git cd pricewatch -
Create and activate a virtual environment
# Windows python -m venv .venv .venv\Scripts\activate # macOS/Linux python -m venv .venv source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
# Copy example configuration cp .env.example .env # Edit .env and set at minimum: # SECRET_KEY=your-super-secure-secret-key-minimum-32-characters # DATABASE_URL=sqlite:///pricewatch.db
-
Initialize database
alembic upgrade head
-
Start the application
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000
-
Open your browser
http://localhost:8000
π You're all set! Start tracking prices by adding your first tracker.
- Navigate to the home page at
http://localhost:8000 - Click "Add Tracker"
- Enter the product URL (e.g., from Amazon, eBay, or any e-commerce site)
- Optionally specify a CSS selector for the price element
- Choose your notification method (Email or SMS)
- Enter your contact information
- Click "Create Tracker"
- Go to Admin β Profiles
- Click "Create New Profile"
- Configure SMTP settings:
- SMTP Host (e.g.,
smtp.gmail.com) - SMTP Port (usually
587for TLS) - Username and Password
- From Email address
- SMTP Host (e.g.,
- Sign up for Twilio
- Get your Account SID, Auth Token, and Phone Number
- Create a notification profile with your Twilio credentials
- View All Trackers β Main dashboard shows all active trackers
- Edit Tracker β Click any tracker to modify settings
- Delete Tracker β Remove trackers you no longer need
- Manual Refresh β Check for price updates on demand
- Price History β View detailed price change history
Create a .env file in the project root with the following variables:
# Required
SECRET_KEY=your-super-secure-secret-key-minimum-32-characters
DATABASE_URL=sqlite:///pricewatch.db
# Application
ENVIRONMENT=development
DEBUG=true
LOG_LEVEL=INFO
# Security
RATE_LIMIT_PER_MINUTE=60
RATE_LIMIT_BURST=10
ALLOWED_HOSTS=localhost,127.0.0.1
# Scraping
REQUEST_TIMEOUT=30
MAX_RETRIES=3
SCHEDULE_MINUTES=30
USE_ASYNC_CLIENT=false
# SMTP (Optional - for email notifications)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
FROM_EMAIL=your-email@gmail.com
# Twilio (Optional - for SMS notifications)
TWILIO_ACCOUNT_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-token
TWILIO_FROM_NUMBER=your-twilio-number
# Database (Optional - for PostgreSQL/MySQL)
DB_POOL_SIZE=5
DB_MAX_OVERFLOW=10
DB_POOL_TIMEOUT=30For production deployments:
- Use PostgreSQL or MySQL instead of SQLite
- Set
ENVIRONMENT=productionandDEBUG=false - Configure proper
ALLOWED_HOSTS - Use a strong, randomly generated
SECRET_KEY - Enable HTTPS with a reverse proxy (nginx)
- Set up proper logging and monitoring
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Pricewatch v2.1 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Web UI β β REST API β β Health API β β
β β (Templates) β β (FastAPI) β β (Monitoring)β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β βββββββββββββββββββββΌβββββββββββββββββββββ β
β β β
β ββββββββββΌβββββββββ β
β β Service Layer β β
β βββββββββββββββββββ€ β
β β TrackerService β β
β β ProfileService β β
β βSchedulerService β β
β βNotificationSvc β β
β ββββββββββ¬βββββββββ β
β β β
β βββββββββββββββββββββΌββββββββββββββββββββ β
β β β β β
β ββββββββΌβββββββ ββββββββββΌβββββββββ ββββββββΌβββββββ β
β β Scraper β β Database β β Security β β
β β (Price β β (SQLAlchemy) β β (Encrypt, β β
β β Extraction) β β β β Validate, β β
β βββββββββββββββ βββββββββββββββββββ β Rate Limit)β β
β βββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β External Services β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β SMTP β β Twilio β β Web β β β
β β β (Email) β β (SMS) β β Scraping β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Service Layer β Business logic separation with
TrackerService,ProfileService,SchedulerService, andNotificationService - Security Layer β Encryption, validation, rate limiting, CSRF protection, and security headers
- Database Layer β SQLAlchemy ORM with Alembic migrations and connection pooling
- Scraping Engine β Flexible price extraction with CSS selectors and async HTTP support
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=app --cov-report=html
# Run specific test categories
pytest tests/test_security.py -v # Security tests
pytest tests/test_api.py -v # API endpoint tests
pytest tests/test_services.py -v # Service layer tests
pytest tests/test_scraper.py -v # Scraper tests
pytest tests/test_integration.py -v # Integration tests- Current Coverage: 80.67%
- Minimum Required: 75%
- HTML Report: Generated in
htmlcov/directory
# Generate coverage report
pytest tests/ --cov=app --cov-report=term-missing --cov-fail-under=75# Build the image
docker build -t pricewatch:latest .
# Run the container
docker run -p 8000:8000 --env-file .env pricewatch:latest# Development
docker-compose up -d
# Production
docker-compose -f docker-compose.prod.yml up -dThe Docker setup includes:
- Multi-stage builds for optimized image size
- Non-root user for security
- Health checks
- Resource limits
- Persistent volumes for database
- Basic Health:
http://localhost:8000/health - Detailed Health:
http://localhost:8000/health/detailed - Prometheus Metrics:
http://localhost:8000/metrics - API Documentation:
http://localhost:8000/docs
Pricewatch uses structured JSON logging with:
- Request ID tracking for full request lifecycle
- Configurable log levels (DEBUG, INFO, WARNING, ERROR)
- Sensitive data masking (passwords, tokens automatically redacted)
- Contextual information (user, request, error details)
- π Encryption at Rest β Sensitive data encrypted using Fernet (Fernet symmetric encryption)
- π‘οΈ CSRF Protection β Token-based protection on all forms
- π¦ Rate Limiting β IP-based rate limiting with automatic cleanup
- β Input Validation β Comprehensive validation with Pydantic schemas
- π SSRF Protection β URL validation preventing private IP access
- π Security Headers β X-Content-Type-Options, X-Frame-Options, CSP, and more
- π Request Tracking β Unique request IDs for full observability
| Category | Technology |
|---|---|
| Framework | FastAPI |
| Database | SQLAlchemy + Alembic |
| Validation | Pydantic |
| Scraping | BeautifulSoup4 + httpx |
| Templates | Jinja2 |
| Security | Cryptography |
| Testing | Pytest |
| Linting | Ruff |
| Type Checking | MyPy |
| Monitoring | Prometheus |
pricewatch/
βββ app/ # Main application code
β βββ services/ # Business logic layer
β βββ static/ # CSS and static assets
β βββ templates/ # HTML templates
βββ docs/ # Documentation
β βββ CHANGELOG.md
β βββ CONTRIBUTING.md
β βββ SECURITY.md
β βββ ...
βββ tests/ # Test suite
βββ migrations/ # Database migrations
βββ docker-compose.yml # Docker Compose config
βββ Dockerfile # Docker image definition
βββ requirements.txt # Python dependencies
βββ pyproject.toml # Project configuration
βββ README.md # This file
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new features
- Ensure all tests pass (
pytest tests/) - Run pre-commit hooks (
pre-commit run --all-files) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read our Code of Conduct before contributing.
This project is licensed under the MIT License β see the LICENSE file for details.
- Import Errors β Ensure virtual environment is activated
- Database Errors β Run
alembic upgrade head - Port Conflicts β Use different port:
--port 8001 - Permission Errors β Check file permissions
- π Check the Documentation
- π Review the Changelog
- π Read the Security Policy
- π Open an Issue
- OAuth2 authentication
- API key management
- Redis caching layer
- Webhook notifications
- Multi-tenant support
- Price prediction algorithms
- Grafana dashboard integration
See docs/IMPROVEMENT_PLAN.md for detailed roadmap.
- FastAPI Community β For excellent documentation and support
- Contributor Covenant β For the Code of Conduct template
- All Contributors β Thank you to everyone who has contributed to Pricewatch!
Made with β€οΈ by the Pricewatch Team
β Star us on GitHub β’ π Documentation β’ π Report Bug β’ π‘ Request Feature