Cameras, NVRs and drones with live view, recording and AI event detection
- Role
- Full-stack engineer
- Year
- 2026
- Status
- Live
- Links
- Private
- Cameras · drones
- MediaMTX gateway
- NestJS backend
- OpenVINO workers
- PostgreSQL
- React console
Ayni
Ayni is an automated surveillance and camera-management platform: live view, recording and playback, AI video analytics, alerts, dispatch and maintenance across IP cameras, NVRs and drones, self-hosted end to end with no hosted backend-as-a-service.
The problem
The platform depended on a hosted backend-as-a-service, which made redeploying it to new servers difficult, and raw video from many cameras had to become events an operator could search and act on.
Approach
I moved everything the hosted backend did (authentication, the data API, file storage, realtime, scheduled jobs and functions) into NestJS modules, so the platform runs from one repository with Docker Compose, then added an AI event pipeline that turns raw video into searchable incidents.
Architecture
Cameras and phones publish over RTSP, RTMP or WebRTC to MediaMTX, which records segments; every publish and read is authorised by the backend. Python analytics workers using OpenVINO (YOLOX and RF-DETR) run a motion gate, then detection, tracking and rules, and send incidents to the backend, which stores events in monthly partitions with thumbnails and clips.
Features
- Self-hosted replacement for a BaaS: auth, data API, storage, realtime and jobs as NestJS modules
- MediaMTX media gateway with backend-authorised publish and playback
- AI pipeline: motion gate, detection, tracking and rules (YOLOX, RF-DETR on OpenVINO)
- Analytics workers scale out horizontally
- Video events in monthly partitions with search, facets and triage
- Per-camera retention, recording index and event clips
Stack
NestJS 11, React, Vite, TypeScript, PostgreSQL, MediaMTX, Python, OpenVINO, Docker, Nginx
Results
- In production
- Redeployable to a new server without any hosted dependencies
“Removing a platform dependency is a migration of behaviour, not just code. Rebuilding each hosted function as a tested module first made the AI pipeline safe to add.”