Add database schema
This commit is contained in:
181
DEPLOYMENT.md
Normal file
181
DEPLOYMENT.md
Normal file
@@ -0,0 +1,181 @@
|
||||
# Price Tracker - Docker Deployment Guide
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
This is a complete price tracking system with:
|
||||
- Product management (Add/Edit/Remove products)
|
||||
- Specification-based alert profiles (e.g., "any 6TB harddrive under 500 DKK")
|
||||
- Discord webhook notifications
|
||||
- No login required
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- A Discord webhook URL (optional, for notifications)
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Clone the repository
|
||||
|
||||
```bash
|
||||
git clone <your-repo-url>
|
||||
cd <repo-name>
|
||||
```
|
||||
|
||||
### 2. Build and run with Docker Compose
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
The application will be available at: **http://localhost:8080**
|
||||
|
||||
### 3. Stop the application
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
### Product Management
|
||||
1. Go to **Products** tab
|
||||
2. Click "Add Product"
|
||||
3. Enter:
|
||||
- Product name and URL
|
||||
- Store (Proshop, Komplett, Amazon)
|
||||
- Category (Hard Drive, RAM, Processor, Graphics Card)
|
||||
- Current price
|
||||
- Specifications (size, type, brand)
|
||||
|
||||
### Alert Profiles (Specification-Based)
|
||||
|
||||
Instead of tracking specific products, you create profiles based on what you need:
|
||||
|
||||
**Example**: "I need any 6TB harddrive under 500 DKK"
|
||||
|
||||
1. Go to **Alerts** tab
|
||||
2. Click "Add Alert Profile"
|
||||
3. Configure:
|
||||
- Profile name: "6TB Storage Deal"
|
||||
- Category: Hard Drive
|
||||
- Target price: 500 DKK
|
||||
- Minimum size: 6TB
|
||||
- Type: SSD (optional)
|
||||
- Discord webhook URL (optional)
|
||||
|
||||
### Discord Notifications
|
||||
|
||||
To receive Discord notifications:
|
||||
|
||||
1. In Discord, go to Server Settings → Integrations → Webhooks
|
||||
2. Create a new webhook
|
||||
3. Copy the webhook URL
|
||||
4. Paste it in your alert profile
|
||||
|
||||
When a product matches your criteria and is below your target price, you'll get a Discord message!
|
||||
|
||||
### Checking Prices
|
||||
|
||||
Click the "Check Prices Now" button in the Alerts tab to manually trigger price checks.
|
||||
|
||||
**Automated Checks**: Set up a cron job to call the check-prices endpoint:
|
||||
|
||||
```bash
|
||||
# Check prices every hour
|
||||
0 * * * * curl -X POST http://localhost:8080/functions/v1/check-prices
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Frontend (React + Vite)
|
||||
↓
|
||||
Lovable Cloud Backend
|
||||
↓
|
||||
PostgreSQL Database
|
||||
↓
|
||||
Discord Webhooks
|
||||
```
|
||||
|
||||
### Database Tables:
|
||||
- **products**: All tracked products with specifications
|
||||
- **alert_profiles**: Specification-based alert configurations
|
||||
- **price_history**: Historical price data
|
||||
- **alerts_log**: Log of triggered alerts
|
||||
|
||||
### Backend Functions:
|
||||
- **check-prices**: Matches products to alert profiles and triggers notifications
|
||||
- **send-discord-alert**: Sends formatted alerts to Discord
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
The app uses Lovable Cloud which is pre-configured. No additional environment setup needed!
|
||||
|
||||
### Port Configuration
|
||||
|
||||
Default port is 8080. To change it, edit `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
ports:
|
||||
- "YOUR_PORT:80"
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Local Development (without Docker)
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Building for Production
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Can't see products or alerts
|
||||
- Check browser console for errors
|
||||
- Verify Lovable Cloud is connected
|
||||
- Check database tables in Cloud tab
|
||||
|
||||
### Discord notifications not working
|
||||
- Verify webhook URL is correct
|
||||
- Check edge function logs in Cloud tab
|
||||
- Test webhook manually with curl
|
||||
|
||||
### Docker build fails
|
||||
- Clear Docker cache: `docker-compose build --no-cache`
|
||||
- Check Docker logs: `docker-compose logs`
|
||||
|
||||
## Features
|
||||
|
||||
✅ Product CRUD operations
|
||||
✅ Specification-based alerts (not tied to specific products)
|
||||
✅ Discord webhook integration
|
||||
✅ No authentication required
|
||||
✅ Real-time price tracking
|
||||
✅ Dashboard with statistics
|
||||
✅ Single Docker deployment
|
||||
|
||||
## Example Alert Scenarios
|
||||
|
||||
1. **Budget Storage**: "Any 6TB+ harddrive under 450 DKK"
|
||||
2. **RAM Upgrade**: "32GB+ DDR5 RAM under 900 DKK"
|
||||
3. **GPU Deal**: "Any RTX 4070 graphics card under 4000 DKK"
|
||||
4. **Fast Storage**: "2TB+ NVMe SSD under 1000 DKK"
|
||||
|
||||
Each alert will match ANY product that meets your specifications!
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions, check:
|
||||
- Lovable Cloud tab for backend logs
|
||||
- Browser console for frontend errors
|
||||
- Docker logs: `docker-compose logs -f`
|
||||
Reference in New Issue
Block a user