$ show blakeblackshear/frigate
Frigate is a production-grade, full-stack Network Video Recorder (NVR) with real-time AI object detection. It ingests IP camera streams, performs motion detection, object detection (via TFLite/ONNX/OpenVINO/TensorRT on CPU/GPU/NPU), tracking, and recording. The backend is Python with FastAPI, Peewee ORM, and ZMQ-based inter-process communication. The frontend is a React/TypeScript single-page application with live views, timeline review, config editing, and GenAI enrichments (face recognition, license plates, semantic search, chat). It supports hardware acceleration across a wide range of devices (Coral, Intel iGPU, NVIDIA Jetson, Hailo, Rockchip NPU, etc.) and integrates deeply with Home Assistant. While primarily an application, it contains substantial data/research components including ML model runners, embedding pipelines, and post-processing logic for classification and transcription.
The LLM identified 6 files worth highlighting for reuse:
HardwareProber dynamically discovers AI accelerator devices from system paths (/sys, /dev, /proc). Isolated per-device probe functions allow one failure without breaking enumeration. Returns canonical detector keys with metadata. Extracted pattern: any project needing polymorphic hardware detection with mockable filesystem-based tests.
DeferredRealtimeProcessorApi provides a generic base class for async background workers with a bounded task queue, Future-based request/response, and drainable results. Supports backpressure (drops when full, logs debug). Extractable: any Python service needing a simple producer-consumer pattern with timeout control.
ConfigHolder provides a thread-safe indirection layer to avoid stale configuration references after runtime updates. Consumed by many modules, it ensures all components see the latest config after a hot reload without restart. Pattern applicable to any long-running application with live config updates.
ZMQ Proxy setup (Publisher/Subscriber) for inter-process communication between Frigate's multiprocessing services. Generic, well-isolated, with proper socket lifecycle and topic-based routing. Could be extracted as a standalone IPC helper for any multiprocess Python application.
Custom React hook that wraps IndexedDB (idb-keyval) with per-user namespacing and automatic legacy key migration. Tracks which keys have been migrated per user to avoid repeated work. Self-contained and generic for any multi-user React app needing client-side persistence.
ModelDownloader downloads machine learning models from URLs with hash verification, versioned caching, and optional github release parsing. Handles token-based authentication for private repos. Extractable as a generic file downloading utility with integrity checks.