
- FastAPI application that monitors websites for updates - SQLite database with Website and WebsiteAlert models - REST API endpoints for website management and alerts - Background scheduler for automatic periodic checks - Content hashing to detect website changes - Health check endpoint and comprehensive documentation - Alembic migrations for database schema management - CORS middleware for cross-origin requests - Environment variable configuration support Co-Authored-By: Claude <noreply@anthropic.com>
Website Update Alert Service
A FastAPI application that monitors websites for updates and provides alerts when changes are detected.
Features
- Add websites to monitor with custom check intervals
- Automatic periodic checking for website updates
- REST API for managing websites and viewing alerts
- Background scheduler for continuous monitoring
- SQLite database for data persistence
API Endpoints
Base
GET /
- Service information and documentation linksGET /health
- Health check endpointGET /docs
- Interactive API documentationGET /redoc
- Alternative API documentation
Websites
POST /websites/
- Add a new website to monitorGET /websites/
- List all monitored websitesGET /websites/{id}
- Get specific website detailsPUT /websites/{id}
- Update website settingsDELETE /websites/{id}
- Remove website from monitoringPOST /websites/{id}/check
- Manually trigger a check for updatesGET /websites/{id}/alerts
- Get alerts for a specific website
Alerts
GET /alerts/
- List all alerts (with optional unread filter)PUT /alerts/{id}/mark-read
- Mark an alert as read
Installation and Setup
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --host 0.0.0.0 --port 8000
The application will be available at http://localhost:8000
Environment Variables
CHECK_INTERVAL_MINUTES
- How often to check all websites (default: 5 minutes)
Database
The application uses SQLite with automatic database creation. The database file is stored at /app/storage/db/db.sqlite
.
Example Usage
- Add a website to monitor:
curl -X POST "http://localhost:8000/websites/" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"name": "Example Website",
"check_interval_minutes": 60
}'
- List all websites:
curl "http://localhost:8000/websites/"
- Get alerts:
curl "http://localhost:8000/alerts/"
How It Works
- Websites are checked periodically based on their individual check intervals
- Content is hashed (MD5) to detect changes
- When changes are detected, alerts are created
- Background scheduler runs every 5 minutes to check websites that are due for checking
- Manual checks can be triggered via the API
Description
Languages
Python
96.6%
Mako
3.4%