ποΈ Global Architecture
FirstBreath is a modular, high-performance monitoring platform designed for equine safety. It relies on a distributed microservices architecture to handle real-time video processing, data analysis, and instant user notifications.
System Overviewβ
The system is composed of 4 main subsystems that communicate asynchronously.
Subsystems Breakdownβ
1. ποΈ Vision Systemβ
- Role: The eyes of the platform. It consumes RTSP streams, performs AI inference, and detects anomalies (Horse down, agitation, etc.).
- Tech Stack: Python 3.11, OpenCV (CUDA), PyTorch, Ultralytics YOLOv11, TensorRT.
- Key Components:
- Camera Manager: Handles RTSP connections and frame grabbing (with hardware decoding).
- Batch Inference: Aggregates frames from multiple cameras into batches for high-throughput GPU processing.
- Redis Worker: Consumes detection results, applies temporal smoothing logic, and pushes events to the backend.
2. ποΈ Backend Core (Control Hub)β
- Role: The brain. It manages users, stable configurations, and routes alerts to the right devices.
- Tech Stack: AdonisJS (Node.js), TypeScript.
- Key Responsibilities:
- API REST: Configuration of cameras and user accounts.
- Websockets: Pushing real-time alerts to the frontend.
- Data Persistence: Storing historical data and logs in MySQL.
3. πΎ Storage & Messagingβ
- Redis: Acts as the central nervous system. It handles:
- Hot Queue: Transferring video frames and detection results between Vision services (approx. 150MB/s throughput).
- Pub/Sub: Notifying the API when an alarm is triggered.
- Caching: Storing ephemeral camera states.
- MySQL: Relational storage for reliable long-term data (User profiles, Horse medical records, Alert history).
4. π± User Interfacesβ
- Showcase / Dashboard: Next.js web application for detailed monitoring and stable management.
- Mobile App: React Native application for field usage and push notifications.