AI-powered multi-camera perimeter security with real-time drone detection, geofencing, and Claude AI threat analysis.
QuantumFence/
├── code/
│ ├── backend/ # FastAPI Python backend
│ │ ├── main.py # Application entry point
│ │ ├── config/
│ │ │ └── settings.py # All system configuration
│ │ ├── api/
│ │ │ ├── routes/ # REST API endpoints
│ │ │ │ ├── auth.py # JWT authentication
│ │ │ │ ├── cameras.py # Camera CRUD + management
│ │ │ │ ├── alerts.py # Alert management
│ │ │ │ ├── drones.py # Drone detections
│ │ │ │ ├── analytics.py # Analytics & reporting
│ │ │ │ └── geofences.py # Geofence zones
│ │ │ └── websocket.py # Real-time WebSocket hub
│ │ ├── database/
│ │ │ ├── database.py # SQLAlchemy engine & session
│ │ │ └── models.py # All ORM models
│ │ ├── services/
│ │ │ ├── detection_service.py # Camera processing orchestrator
│ │ │ ├── ai_analysis_service.py # Claude AI threat analysis
│ │ │ ├── notification_service.py # Email & webhook alerts
│ │ │ └── perimeter_service.py # Fence breach intelligence
│ │ └── requirements.txt
│ ├── ai_models/
│ │ ├── model_manager.py # YOLOv8 model loader & runner
│ │ └── drone_detector.py # Drone tracking & trajectory analysis
│ └── integrations/
│ └── google_earth.py # Google Maps/Earth KML/API
├── web-frontend/ # React + Vite SPA
│ ├── src/
│ │ ├── pages/
│ │ │ ├── Dashboard.jsx # Live command center
│ │ │ ├── Cameras.jsx # Camera management
│ │ │ ├── Alerts.jsx # Alert management table
│ │ │ ├── DroneWatch.jsx # Drone radar & log
│ │ │ ├── MapView.jsx # Leaflet tactical map
│ │ │ ├── Analytics.jsx # Charts & reporting
│ │ │ ├── Settings.jsx # System configuration
│ │ │ └── Login.jsx # Authentication
│ │ ├── components/
│ │ │ └── Layout.jsx # Sidebar navigation
│ │ ├── context/
│ │ │ ├── AuthContext.jsx # JWT auth state
│ │ │ └── WebSocketContext.jsx # Real-time events
│ │ └── services/
│ │ └── api.js # Axios API client
├── infrastructure/
│ ├── docker/
│ │ ├── docker-compose.yml # Full stack deployment
│ │ ├── Dockerfile.backend # Python multi-stage build
│ │ ├── Dockerfile.frontend # Node + Nginx build
│ │ └── prometheus.yml # Monitoring config
│ ├── nginx/
│ │ └── nginx.conf # Reverse proxy config
│ ├── kubernetes/
│ │ └── k8s-deployment.yml # K8s manifests + HPA
│ └── terraform/
│ └── main.tf # AWS infrastructure as code
└── scripts/
├── setup/
│ ├── setup.sh # One-click installation
│ └── migrate_and_seed.py # DB init + demo data
├── deployment/
│ └── start.sh # Start all services
└── maintenance/
└── maintenance.py # Cleanup & health checks
- Python 3.10+
- Node.js 18+
- Git
git clone https://github.com/quantsingularity/QuantumFence
cd QuantumFence
bash scripts/setup/setup.sh --devEdit code/backend/.env:
ANTHROPIC_API_KEY=sk-ant-your-key-here
GOOGLE_MAPS_API_KEY=your-google-maps-keycd code/backend && source venv/bin/activate
python ../../scripts/setup/migrate_and_seed.pybash scripts/deployment/start.shAccess:
- Frontend: http://localhost:3000
- API Docs: http://localhost:8000/api/docs
- Login:
admin/quantumfence
cd infrastructure/docker
cp .env.example .env # Edit with your API keys
docker-compose up -d- Add unlimited IP/RTSP/USB/HTTP-MJPEG cameras
- Per-camera detection configuration
- PTZ control support
- Night vision tagging
- Live status dashboard with WebSocket updates
- Person detection near fence perimeter
- Vehicle detection (cars, trucks, motorcycles, buses)
- Drone/UAV detection with trajectory tracking
- Multi-object tracking with approach vector analysis
- Swarm detection (multiple drones coordinating)
- Confidence-based alert filtering
- Natural language threat summaries for operators
- Risk scoring (0.0–1.0) per detection
- Recommended immediate actions
- Drone purpose classification (surveillance/recreational/hostile)
- Multi-threat coordination detection
- Google Maps / OpenStreetMap satellite view
- KML export for Google Earth Pro
- Draw and manage geofence polygons
- Camera FOV visualization on map
- Threat heatmap overlay
- Real-world location estimation from bounding box
- Animated radar display
- Live trajectory analysis
- Altitude & speed estimation
- Authorized vs. unauthorized classification
- Loitering detection
- Detection timeline charts
- Alert distribution by type
- Camera performance metrics
- 24h / 7d / 30d trend analysis
- HTML email alerts with snapshot attachments
- Webhook integration (Slack, Teams, custom)
- Severity-based escalation
- Alert cooldown management
- JWT authentication with refresh tokens
- Role-based access (Admin / Operator / Viewer)
- All actions logged to DB
Full Swagger docs at: http://localhost:8000/api/docs
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login |
Authenticate and get JWT |
| GET | /api/cameras |
List all cameras |
| POST | /api/cameras |
Add new camera |
| GET | /api/alerts |
List alerts with filters |
| POST | /api/alerts/{id}/acknowledge |
Acknowledge alert |
| GET | /api/drones |
Drone detection log |
| GET | /api/analytics/overview |
System overview stats |
| GET | /api/geofences |
List geofence zones |
| WS | /ws/{client_id} |
Real-time event stream |
Key settings in code/backend/.env:
| Variable | Description | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Claude AI API key | — |
GOOGLE_MAPS_API_KEY |
Maps/satellite imagery | — |
DETECTION_CONFIDENCE |
YOLOv8 minimum confidence | 0.5 |
AI_CONFIDENCE_THRESHOLD |
Threshold to trigger AI analysis | 0.65 |
FRAME_SKIP |
Process every N-th frame | 3 |
MAX_CAMERAS |
Maximum concurrent cameras | 64 |
DEFAULT_MAP_CENTER_LAT/LNG |
Default map center coordinates | 33.6844, 73.0479 |
Connect to ws://localhost:8000/ws/{client_id} for live events:
{ "type": "alert", "data": { ... } }
{ "type": "detection", "data": { "camera_id": 1, "detections": [...] } }
{ "type": "drone_detection", "data": { "camera_id": 1, "threat_level": "high" } }
{ "type": "camera_status", "camera_id": "1", "status": "online" }Includes: FastAPI backend, React frontend (Nginx), PostgreSQL, Redis, Prometheus, Grafana
kubectl apply -f infrastructure/kubernetes/k8s-deployment.ymlcd infrastructure/terraform
terraform init && terraform plan && terraform applyThis project is licensed under the MIT License - see the LICENSE file for details.