A production-ready, real-time API monitoring and alerting system built with FastAPI, React, Firebase, and Google Cloud.

- โ Real-time API Health Checks - Monitor any HTTP/HTTPS endpoint every 5 minutes
- ๐ Comprehensive Metrics - Track uptime, response times (p50, p95, p99), error rates
- ๐จ Intelligent Alerts - AI-powered error analysis using Google Gemini
- ๐ Historical Data - 7-day retention with time-series analysis
- ๐ฏ Custom Configurations - Per-monitor settings for intervals, timeouts, and expected responses
- ๐ Firebase Authentication - Secure user management
- ๐๏ธ Firestore Database - Scalable NoSQL for monitor configs
- ๐พ SQLite Time-Series - Efficient local metrics storage
- ๐ณ Docker Containerized - Easy deployment with Docker Compose
- ๐ Production-Ready Security - HTTPS, CORS, rate limiting, security headers
- ๐จ Modern UI - React with Tailwind CSS and Chart.js
- ๐ค AI Analysis - Gemini-powered error diagnostics
- ๐ฆ In-Memory Caching - 5-minute TTL for performance
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USERS (Web Browser) โ
โ https://monitor.yourdomain.com โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS (443)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ S3 + CloudFront (Static Frontend) โ
โ React SPA Application โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ REST API + Firebase Auth
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AWS EC2 / Google Compute Engine โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Nginx (Reverse Proxy) โ โ
โ โ โข SSL/TLS Termination โ โ
โ โ โข Rate Limiting (100 req/min) โ โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ proxy_pass โ
โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ FastAPI Backend + APScheduler โ โ
โ โ โข REST API (8000) โ โ
โ โ โข Background Workers โ โ
โ โ โข SQLite Database โ โ
โ โ โข In-Memory Cache โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ Firebase โ โ Gemini โ โ GCP โ
โ Auth & โ โ API โ โ Logging โ
โ Firestoreโ โ AI โ โ โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
api-monitor-system/
โโโ backend/ # FastAPI Backend
โ โโโ main.py # Application entry point
โ โโโ app/
โ โ โโโ core/ # Core configurations
โ โ โ โโโ config.py # Settings & environment
โ โ โ โโโ firebase.py # Firebase integration
โ โ โโโ database/ # Database layer
โ โ โ โโโ sqlite_db.py # SQLite operations
โ โ โโโ models/ # Pydantic schemas
โ โ โ โโโ schemas.py # Request/response models
โ โ โโโ routers/ # API endpoints
โ โ โ โโโ monitors.py # Monitor CRUD
โ โ โ โโโ metrics.py # Metrics endpoints
โ โ โ โโโ alerts.py # Alert endpoints
โ โ โ โโโ auth.py # Authentication
โ โ โโโ scheduler/ # Background jobs
โ โ โ โโโ monitor_scheduler.py
โ โ โโโ services/ # Business logic
โ โ โโโ monitor_checker.py
โ โ โโโ gemini_service.py
โ โ โโโ cache_service.py
โ โโโ Dockerfile
โ โโโ requirements.txt
โ โโโ .env.example
โโโ frontend/ # React Frontend
โ โโโ src/
โ โ โโโ components/ # React components
โ โ โโโ pages/ # Page components
โ โ โโโ services/ # API clients
โ โ โโโ context/ # React context
โ โ โโโ config/ # Configuration
โ โ โโโ utils/ # Utilities
โ โโโ package.json
โ โโโ vite.config.js
โ โโโ tailwind.config.js
โโโ infrastructure/ # Deployment configs
โ โโโ docker-compose.yml
โ โโโ nginx/
โ โ โโโ nginx.conf
โ โ โโโ conf.d/
โ โโโ scripts/
โโโ docs/ # Documentation
โโโ DEPLOYMENT_GUIDE.md # Deployment instructions
โโโ API_REFERENCE.md # API documentation
โโโ ARCHITECTURE.md # System architecture
- Python 3.11+
- Node.js 18+
- Docker & Docker Compose
- Google Cloud account
- Firebase project
git clone <repository-url>
cd api-monitor-systemcd backend
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Place Firebase credentials
mkdir secrets
cp /path/to/firebase-credentials.json secrets/
# Run development server
python main.pyBackend will be available at http://localhost:8000
cd frontend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Add Firebase configuration
# Run development server
npm run devFrontend will be available at http://localhost:3000
cd infrastructure
# Configure environment
cp ../.env.example .env
# Edit with your credentials
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downGET /api/auth/me- Get current userGET /api/auth/verify- Verify token
GET /api/monitors/- List all monitorsGET /api/monitors/{id}- Get monitor detailsPOST /api/monitors/- Create monitorPUT /api/monitors/{id}- Update monitorDELETE /api/monitors/{id}- Delete monitorGET /api/monitors/{id}/health-checks- Get health historyGET /api/monitors/dashboard/stats- Dashboard statistics
GET /api/metrics/{id}?hours=24- Get monitor metricsGET /api/metrics/{id}/daily?days=7- Get daily metrics
GET /api/alerts/{monitor_id}- Get monitor alertsGET /api/alerts/- Get all user alerts
GET /health- System health check
Full API documentation: http://localhost:8000/docs
# Firebase
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CREDENTIALS_PATH=/app/secrets/firebase-credentials.json
# Google Cloud
GCP_PROJECT_ID=your-gcp-project-id
GEMINI_API_KEY=your-gemini-api-key
# Database
SQLITE_DB_PATH=/app/database/metrics.db
DATA_RETENTION_DAYS=7
# Monitoring
MONITOR_CHECK_INTERVAL_MINUTES=5
MAX_WORKERS=10
REQUEST_TIMEOUT_SECONDS=30
# Security
ALLOWED_ORIGINS=["http://localhost:3000"]
RATE_LIMIT_PER_MINUTE=100
# Alerts
MAX_CONSECUTIVE_FAILURES=3
ALERT_COOLDOWN_MINUTES=30VITE_API_URL=http://localhost:8000
VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id- Firebase Authentication - Industry-standard auth
- HTTPS Only - TLS 1.2+ encryption
- CORS Protection - Whitelist-based origins
- Rate Limiting - 100 requests/minute per IP
- Security Headers - XSS, clickjacking protection
- Input Validation - Pydantic schemas
- SQL Injection Prevention - Parameterized queries
- Token Verification - Firebase ID token validation
- Response Time: < 100ms (API endpoints)
- Monitoring Interval: 5 minutes (configurable)
- Cache TTL: 5 minutes
- Data Retention: 7 days (configurable)
- Concurrent Checks: 10 workers
- Database: SQLite (for single instance) or Cloud SQL (for scale)
- Production API Monitoring - Monitor critical APIs
- SLA Compliance - Track and report uptime
- Performance Analysis - Identify slow endpoints
- Incident Response - AI-powered error diagnosis
- Multi-Environment - Monitor dev, staging, production
- Third-Party Services - Track external dependencies
{
"name": "Production API",
"url": "https://api.example.com/health",
"method": "GET",
"headers": {
"Authorization": "Bearer token123"
},
"interval_minutes": 5,
"timeout_seconds": 30,
"expected_status_code": 200,
"alert_on_failure": true,
"alert_threshold_minutes": 15
}- Real-time Status - Live monitor status
- Uptime Percentage - 24-hour rolling window
- Response Time Charts - P50, P95, P99 percentiles
- Alert History - Recent incidents
- AI Analysis - Gemini-powered insights
- Export Data - CSV/JSON exports
# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm test# Python linting
flake8 backend/
black backend/
# JavaScript linting
cd frontend
npm run lint- Deployment Guide - Complete deployment instructions
- API Reference - Detailed API documentation
- Architecture - System design details
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@yourdomain.com
- FastAPI - Modern Python web framework
- React - UI library
- Firebase - Authentication and database
- Google Cloud - Infrastructure
- Gemini AI - Error analysis
- Tailwind CSS - Styling framework
- Chart.js - Data visualization
- Multi-region monitoring
- Webhook notifications
- Custom dashboards
- API rate limit monitoring
- SSL certificate expiry alerts
- Mobile app
- Slack/Discord integration
- Advanced analytics
- Team collaboration features
- SLA reporting
Built with โค๏ธ using FastAPI, React, Firebase, and Google Cloud
Version: 1.0.0 Last Updated: February 2024