Enterprise-Grade Distributed Face Recognition/Tracking Platform
β οΈ DEVELOPMENT IN PROGRESS - This project is under active development. Coming soon as a Kubernetes Operator and Helm Chart for production deployments.
- Overview
- Why FreeFace Scales to Billions
- Key Features
- Quick Start
- Project Structure
- Architecture
- API Documentation
- Development Setup
- Deployment
- Configuration
- Monitoring & Operations
- Contributing
- License
FreeFace is a high-performance, cloud-native face recognition/tracking platform engineered for enterprise-scale deployments. Built with Rust for blazing-fast performance and designed for horizontal scalability, it delivers real-time face detection, feature extraction, and similarity matching with sub-millisecond latency.
A distributed face recognition system capable of:
- Processing millions of face recognition operations
- Sub-100ms API response times for async operations
- Handling massive concurrent requests
- Auto-scaling based on workload
- Real-time face clustering and association
FreeFace is engineered from the ground up to handle billions of face records with millions of concurrent operations. Here's why our technology choices enable massive scale:
ScyllaDB: Built for Massive Data
Advantages:
- Written in C++: No garbage collection pauses, consistent performance
- Linear Scalability: Add nodes = proportional throughput increase
- Sub-millisecond P99: Ultra-low latency even at massive scale
- Shard-per-core Architecture: Maximum CPU utilization
- Auto-tuning: Self-optimizing for different workloads
Large-scale capacity:
- Single node: 1M+ ops/sec
- Cluster scaling: 10M+ ops/sec with 10 nodes
- Storage: Petabyte-scale with automatic compression
- Face records: Billions with efficient time-series partitioning
- Global distribution: Multi-datacenter replicationMilvus: Purpose-Built Vector Database
Advantages:
- Billion-Scale Performance: Handles 10B+ vectors with sub-10ms query times
- GPU Acceleration: Native CUDA support for 100x computational speedup
- Advanced Indexing: IVF, HNSW, DiskANN algorithms optimize for different scales
- Elastic Scaling: Add compute/storage nodes independently
- Memory Optimization: Intelligent vector compression and caching
Vector Operations:
- Similarity Search: ANN algorithms with 99%+ recall at massive scale
- Dynamic Updates: Real-time insertions without index rebuilds
- Multi-Field Filtering: Combine vector similarity with metadata filtersββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Why Microservices Architecture? β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. REST API Server (api-server) β
β β’ Stateless: Infinite horizontal scaling β
β β’ Load balanced: Even distribution β
β β’ Rate limited: Protect downstream services β
β β’ Scales: 2-100+ pods based on load β
β β
β 2. gRPC Face Extractor (extractor) β
β β’ CPU/GPU optimized: Dedicated ML processing β
β β’ Connection pooling: Resource efficiency β
β β’ Circuit breaker: Fault isolation β
β β’ Scales: Based on CPU/GPU availability β
β β
β 3. Kafka Async Processor (face_async_enroll) β
β β’ Worker pools: 50+ concurrent workers per instance β
β β’ Priority queues: Critical operations first β
β β’ Batch processing: 1000+ faces/batch β
β β’ Scales: Kafka partitions Γ consumer groups β
β β
β 4. Event-Driven Clustering (face_cluster) β
β β’ Stream processing: Real-time clustering β
β β’ State management: Distributed state via Kafka β
β β’ Incremental updates: No full recomputation β
β β’ Scales: With Kafka topic partitions β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Kafka: High-Throughput Event Streaming
Advantages:
- Ultra-High Throughput: 1M+ messages/sec per broker with linear scaling
- Persistent Storage: Durable, replicated logs retain data for years
- Guaranteed Ordering: Per-partition message ordering for consistent processing
- Event Sourcing: Complete event history replay for analytics and recovery
- Zero Data Loss: Multi-replica persistence with configurable durability
Large-Scale Features:
- Massive Parallelism: 1000s of partitions per topic, independent scaling
- Consumer Groups: Multiple parallel processors per topic
- Backpressure Handling: Producer buffering prevents system overloadChoice: DragonflyDB over Redis
Reasons:
- 25x throughput: vs Redis single-threaded
- Memory efficiency: 30% less RAM usage
- Compatibility: Redis protocol support
- Multi-core: Vertical scaling on modern CPUsChoice: MinIO S3-compatible storage
Reasons:
- Distributed: Erasure coding for reliability
- Performance: 180 GB/s per cluster
- Cost effective: Use commodity hardware
- S3 API: Industry standard compatibility| Component | Technology | Scale Capability | Why It Matters |
|---|---|---|---|
| Metadata DB | ScyllaDB | 10M+ ops/sec, Petabytes | No bottleneck on face records |
| Vector DB | Milvus | 10B+ vectors, <10ms search | Fast similarity at scale |
| Cache | DragonflyDB | 4M+ ops/sec | Instant hot data access |
| Queue | Kafka | 1M+ msg/sec | Decouple & parallelize |
| Storage | MinIO | Exabytes, 180GB/s | Unlimited image storage |
| Language | Rust | Zero-cost abstractions | Maximum performance |
FreeFace supports multiple state-of-the-art detection and recognition models, optimized for different deployment scenarios:
| Model | Performance | Use Case | Hardware |
|---|---|---|---|
| MobileNet v0.25 | Ultra-fast, lightweight | Mobile, edge devices, real-time | CPU optimized |
| ResNet50 | High accuracy, robust | Server deployment, batch processing | CPU/GPU hybrid |
| Model | Accuracy | Speed | Deployment |
|---|---|---|---|
| ArcFace (R50) | State-of-the-art | Medium | CPU/GPU versions |
| FaceNet (VGGFace2) | High accuracy | Fast | CPU optimized |
| MobileNet | Good accuracy | Ultra-fast | CPU/GPU versions |
models/
βββ detection/
β βββ mobilenet-cpu/ # Lightweight detection
β β βββ mobilenet0.25_Final.pth
β βββ resnet50-cpu/ # Robust detection
β βββ Resnet50_Final.pth
βββ recognition/
βββ arcface-cpu/ # High accuracy CPU
β βββ R50-0000.params
β βββ R50-symbol.json
βββ arcface-gpu/ # GPU acceleration
β βββ R50-0000.params
β βββ R50-symbol.json
βββ facenet-cpu/ # Fast CPU inference
β βββ facenet_vggface2.pth
βββ mobilenet-cpu/ # Ultra-fast CPU
β βββ mnet10-0000.params
β βββ mnet10-symbol.json
βββ mobilenet-gpu/ # GPU optimized
βββ mnet10-0000.params
βββ mnet10-symbol.json
- High-Throughput: MobileNet detection + MobileNet recognition
- High-Accuracy: ResNet50 detection + ArcFace recognition
- Balanced: MobileNet detection + FaceNet recognition
- GPU Acceleration: Use GPU variants when CUDA available
- β Multi-Model Support - Dynamic model selection based on accuracy/speed requirements
- β Real-time Face Detection - Advanced ML models (FaceNet, ArcFace, MobileNet)
- β Vector Similarity Search - Fast matching using Milvus vector database
- β Async Processing - Immediate API responses with background processing
- β Smart Auto-Clustering - Automatic grouping of similar faces
- β Geospatial Analytics - GPS-based face tracking and location analysis
- β Multi-Face Processing - Handle group photos and crowds
- π High Performance - Massive concurrent processing with parallel workers
- π Priority Queuing - Critical, High, Normal, Low priority processing
- π‘οΈ Resilient Architecture - Circuit breakers, retry logic, graceful degradation
- π Auto-scaling - Kubernetes HPA/VPA based scaling
- π Enterprise Observability - Comprehensive monitoring, tracing, and logging stack
- π Advanced Metrics - 40+ Prometheus metrics with atomic counters
- π Distributed Tracing - Jaeger integration with request correlation
- π Enterprise Security - JWT auth, encrypted storage, RBAC
β οΈ HARDWARE REQUIREMENTS
Docker Desktop: 14+ CPUs, 21984MB RAM, 220GB disk space
Why: Infrastructure services (ScyllaDB, Milvus, Kafka, ELK stack) are resource-intensive
Best for: Daily development with full debugging capabilities
# macOS (recommended)
brew install minikube kubectl skaffold foreman
# Rust toolchain (for local apps)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install cargo-watchgit clone https://github.com/your-org/freeface.git
cd freeface
cp .env.sample .envβ Verification:
ls -la .env # Should exist./dev-k8s.sh # Starts Minikube + deploys infrastructureβ Verification:
# Wait for all pods to be Ready (may take 3-5 minutes)
kubectl get pods -A
# Should show all pods in Running/Ready state
# Test key services
curl -f http://localhost:9042 || echo "ScyllaDB: β
"
curl -f http://localhost:19530 || echo "Milvus: β
"
curl -f http://localhost:9093 || echo "Kafka: β
"# Initialize database schemas (after infrastructure is running)
cargo run --bin migrate -- up --database scylla
cargo run --bin migrate -- up --database milvus
# Or: cargo run --bin migrate -- up --database allβ Verification:
cargo run --bin migrate -- status --database all
# Should show: "All migrations applied"# Option A: All services together
foreman start
# Option B: Individual services for debugging
cargo run --bin api-server # Terminal 1: REST API
cargo run --bin extractor # Terminal 2: gRPC extractor
cargo run --bin face-cluster # Terminal 3: Clustering serviceβ Verification:
# API Health Check
curl http://localhost:8080/api/v1/health
# Should return: {"status": "healthy"}
# gRPC Service Check
grpcurl -plaintext localhost:50051 list
# Should list available gRPC services| Benefit | Description |
|---|---|
| β‘ Instant Rebuilds | Cargo rebuilds in 1-5s vs Docker's 30-60s |
| π οΈ Native Debugging | Full IDE support, breakpoints, variable inspection |
| π« No ARM64 Issues | Eliminates Docker cross-compilation problems |
| π Real Infrastructure | Uses actual ScyllaDB, Milvus, Kafka in K8s |
| π Full Observability | Complete monitoring stack with real metrics |
Main Applications (Run on Host):
- FreeFace API: http://localhost:8080 (API Docs)
- FreeFace Extractor: grpc://localhost:50051
- Face Clustering: grpc://localhost:50053
- Admin Panel: http://localhost:7998
Infrastructure Services:
- ScyllaDB: localhost:9042
- ScyllaDB Console: http://localhost:10000
- Milvus Vector DB: localhost:19530
- Milvus Admin UI (Attu): http://localhost:3002
- DragonflyDB Cache: redis://localhost:6379
- Redis Commander: http://localhost:8083
- MinIO API: http://localhost:9000 (freeface-admin/freeface-secret-2024)
- MinIO Console: http://localhost:9090 (freeface-admin/freeface-secret-2024)
Message Queues & Streaming:
- Kafka: localhost:9093
- Kafka UI: http://localhost:8082
- RabbitMQ Web: http://localhost:15672 (freeface/freeface123)
- RabbitMQ AMQP: amqp://localhost:5672
- Zookeeper: localhost:2181
Monitoring & Observability:
- Prometheus: http://localhost:9091 (40+ metrics including HTTP, face operations, database)
- Grafana: http://localhost:3001 (admin/admin) - Pre-built dashboards for system health & KPIs
- Jaeger Tracing: http://localhost:16686 - Distributed request tracing with correlation IDs
Logging (ELK Stack):
- Elasticsearch: http://localhost:9200 - Centralized log storage
- Kibana: http://localhost:5601 - Log analysis dashboards
- Logstash: http://localhost:9600 - Real-time log processing
UI Services:
- etcd UI: http://localhost:8084
FreeFace/
βββ π kubernetes/ # Kubernetes deployment manifests
β βββ freeface-api/ # API service deployment
β β βββ Dockerfile.api-server # Production build
β β βββ Dockerfile.api-server.dev # Dev with cargo-watch
β β βββ deployment.yaml # Production deployment
β β βββ deployment-dev.yaml # Hot-reload deployment
β βββ freeface-extractor/ # Face extraction service
β βββ face_enroll_async/ # Async processor deployment
β βββ freeface-face-cluster/ # Clustering service
β βββ scylladb/ # ScyllaDB cluster setup
β βββ milvus/ # Milvus vector database
β βββ kafka/ # Event streaming setup
β βββ monitoring/ # Prometheus, Grafana, Jaeger
β
βββ π src/ # Rust source code
β βββ bin/ # Binary entry points
β β βββ api-server.rs # REST API server
β β βββ extractor.rs # gRPC extraction service
β β βββ face-async-enroll.rs # Async processor
β β βββ face_cluster.rs # Clustering service
β β βββ migrate.rs # Database migration tool
β βββ api/ # REST API implementation
β βββ face_async_enroll/ # Async processing logic
β βββ face_cluster/ # Clustering algorithms
β βββ extractors/ # ML model integration
β βββ storage/ # Database clients
β βββ services/ # Business logic
β βββ grpc/ # gRPC definitions
β
βββ π db/ # Database schemas
β βββ migration/
β βββ scylla/ # ScyllaDB migrations (CQL)
β βββ milvus/ # Milvus collections (JSON)
β
βββ π models/ # ML models
β βββ onnx/ # ONNX format models
β βββ pytorch/ # PyTorch models
β βββ keras/ # Keras/TensorFlow models
β
βββ π proto/ # Protocol Buffers
β βββ extractor.proto # gRPC service definitions
β
βββ π .env # Environment configuration (K8s DNS names)
βββ π dev-k8s.sh # Development script (hot-reload default, --prod for production)
βββ π skaffold.yaml # Production Skaffold configuration
βββ π skaffold-dev.yaml # Hot-reload Skaffold config (DEFAULT)
βββ π Cargo.toml # Rust dependencies
βββ π README.md # This file
- api-server: REST API for face operations
- extractor: gRPC service for face detection/extraction
- face-async-enroll: High-throughput async processor
- face_cluster: Event-driven clustering service
- migrate: Database schema management
- ScyllaDB: Metadata storage (faces, persons, images) -
scylladb/scylla-cluster.yaml - Milvus: Vector database for face embeddings -
milvus/simple-standalone.yaml - Kafka: Event streaming for async processing -
kafka/deployment.yaml - MinIO: S3-compatible image storage -
minio/minio-deployment.yaml - DragonflyDB: High-performance caching -
dragonfly/deployment.yaml - Prometheus: Metrics collection and alerting -
prometheus/deployment.yaml - Grafana: Monitoring dashboards and visualization -
grafana/deployment.yaml - Jaeger: Distributed tracing and request correlation -
jaeger/deployment.yaml - ELK Stack: Centralized logging (Elasticsearch, Logstash, Kibana) -
elk-stack/deployment.yaml - Admin Panel: Web-based system administration -
admin/deployment-all.yaml - UI Services: Management UIs for databases and queues -
ui-services/deployment.yaml - Supporting Services: Additional infrastructure components -
supporting-services/
βββββββββββββββββββββββββ FreeFace Platform Architecture βββββββββββββββββββββββββββββ
β β
β ββββ APPLICATION LAYER ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β REST API β β gRPC Extractor β β Face Clustering β β Async β β β
β β β (Scalable) β β (Scalable) β β (Service) β β Processor β β β
β β β β β β β β β (High-Scale)β β β
β β β Face Recognitionβ βFace Detection & β β Similarity β βKafka Consumerβ β β
β β β Endpoints β β Embedding β β & Clustering β β& Worker Poolβ β β
β β β β β β β β β β β β
β β β Port: 8080 β β Port: 50051 β β Event-Driven β β 50 Workers β β β
β β β Axum Framework β β Tonic/gRPC β β Kafka Consumer β β Rust Tokio β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββ UTILITY SERVICES βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β Admin Panel β β MinIO S3 β β Migrator β β UI Services β β β
β β β (CRUD/Explorer) β β (Storage) β β (Service) β β (Management)β β β
β β β β β β β β β β β β
β β βData Management β β Image Storage β βDatabase Schema β β Kafka UI β β β
β β β & Analytics β β & Encryption β β Management β β Redis Cmdr β β β
β β β β β S3-Compatible β β CQL & Milvus β β etcd UI β β β
β β β Port: 7998 β β Port: 9000 β β Migration Tool β βVarious Portsβ β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββ DATA LAYER βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β ScyllaDB β β Milvus β β DragonflyDB β β etcd β β β
β β β (Metadata) β β (Vector DB) β β (Cache) β β(Coordinationβ β β
β β β β β β β β β β β β
β β β β’ Face Records β ββ’ Face Embeddingsβ ββ’ Query Cache β ββ’ Milvus Metaβ β β
β β β β’ Person Data β ββ’ 128D/512D Vecs β ββ’ Session Store β ββ’ Service β β β
β β β β’ Image Meta β ββ’ Similarity β ββ’ Hot Data β β Discovery β β β
β β β β’ Clustering β β Search β ββ’ Rate Limits β ββ’ Config β β β
β β β β ββ’ GPU Acceleratedβ ββ’ 25x Redis Speedβ β Store β β β
β β β Port: 9042 β β Port: 19530 β β Port: 6379 β β Port: 2379 β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββ MESSAGING & EVENT STREAMING ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β Kafka β β RabbitMQ β β Zookeeper β β Kafka UI β β β
β β β (Streaming) β β (Message Queue) β β (Coordination) β β(Management) β β β
β β β β β β β β β β β β
β β ββ’ Event Sourcing β ββ’ Reliable Msg β ββ’ Kafka Cluster β ββ’ Topic Mgmt β β β
β β ββ’ Real-time β β Delivery β β Management β ββ’ Consumer β β β
β β β Processing β ββ’ Dead Letters β ββ’ Leader Electionβ β Monitoring β β β
β β ββ’ 1M+ msg/sec β ββ’ Priority Queue β ββ’ Config Sync β ββ’ Lag Track β β β
β β β β β β β β β β β β
β β β Port: 9093 β β Port: 5672 β β Port: 2181 β β Port: 8082 β β β
β β βTopics: events, β β AMQP Protocol β β β β β β β
β β β logs, clusters β β β β β β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββ MONITORING & OBSERVABILITY βββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β Prometheus ββββΆβ Grafana β β Jaeger β β Admin UIs β β β
β β β (Metrics) β β (Dashboards) β β (Tracing) β β(Data Explorerβ β β
β β β β β β β β β β β β
β β ββ’ 40+ Metrics β ββ’ System Health β ββ’ Request Flow β ββ’ ScyllaDB β β β
β β ββ’ Performance β ββ’ Business KPIs β ββ’ Latency Track β β Manager β β β
β β ββ’ Resource Usage β ββ’ Real-time β ββ’ Span Analysis β ββ’ Milvus Attuβ β β
β β ββ’ Thread-safe β β Alerts β ββ’ Service Map β ββ’ Redis Cmdr β β β
β β β Counters β ββ’ Custom Panels β ββ’ Error Tracking β β β β β
β β β β β β β β β β β β
β β β Port: 9091 β β Port: 3001 β β Port: 16686 β βVarious Portsβ β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββ LOGGING & SEARCH STACK βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β β β Elasticsearch ββββΆβ Kibana β β Logstash β βAuto Scaling β β β
β β β (Log Store) β β (Log UI) β β (Processing) β β (HPA/VPA) β β β
β β β β β β β β β β β β
β β ββ’ Centralized β ββ’ Log Analysis β ββ’ Log Parsing β ββ’ Resource β β β
β β β Repository β ββ’ Dashboards β ββ’ Transformation β β Based β β β
β β ββ’ Full-text β ββ’ Query Builder β ββ’ Multiple Input β ββ’ K8s Native β β β
β β β Search β ββ’ Visualizations β β Sources β ββ’ CPU/Memory β β β
β β ββ’ Async Logging β ββ’ Saved Searches β ββ’ Filter Pipelineβ β Triggers β β β
β β β β β β ββ’ Enrichment β ββ’ Pod Scalingβ β β
β β β β β β β β β β β β
β β β Port: 9200 β β Port: 5601 β β Port: 9600 β β 2-100+ pods β β β
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Data Flow: Client β API Layer β Messaging β Data Layer β Storage
π Monitoring: All services β Prometheus (40+ metrics) β Grafana Dashboards
π Logging: Async β Elasticsearch β Kibana (structured search)
π Tracing: Request correlation IDs β Jaeger β Distributed trace analysis
β‘ Events: Face operations β Kafka β Async processing & clustering
πΎ Storage: Metadata (ScyllaDB) + Vectors (Milvus) + Images (MinIO) + Cache (DragonflyDB)
π― Observability: Thread-safe metrics + Non-blocking logs + Request correlation
π Scaling: HPA/VPA auto-scaling based on CPU/Memory/Custom metrics
| Operation | Flow | Response Time |
|---|---|---|
| Sync Enrollment | Client β API β Extractor β Databases | ~500ms |
| Async Enrollment | Client β API β Kafka β Background | < 100ms |
| Face Search | Client β API β Cache/Milvus β Results | ~50ms |
| Recognition | Client β API β Vector Search β Match | ~30ms |
- Tech: Rust + Axum framework
- Purpose: HTTP REST API for face recognition
- Features: Sync/async enrollment, search, recognition
- Scaling: Auto-scales 2-20 replicas
- Tech: Rust + Tonic + ONNX Runtime
- Purpose: Face detection and feature extraction
- Models: FaceNet, ArcFace, MobileNet
- Scaling: CPU/GPU resource-based scaling
- Tech: Rust + Kafka + Worker Pools
- Purpose: High-throughput background processing
- Capacity: Massive concurrent processing capacity
- Features: Priority queuing, webhook callbacks
- Tech: Rust + Kafka consumer
- Purpose: Real-time face grouping and association
- Features: Auto-clustering, similarity analysis
π Interactive API Documentation: http://localhost:8080/docs (Swagger UI)
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/faces/enroll |
Synchronous face enrollment |
POST |
/api/v1/faces/enroll_async |
Async enrollment (< 100ms) |
GET |
/api/v1/faces/enroll/status/{id} |
Check async enrollment status |
POST |
/api/v1/faces/search |
Search similar faces |
POST |
/api/v1/faces/recognize |
Recognize face and return best match |
POST |
/api/v1/faces/detect |
Detect faces without enrollment |
GET |
/api/v1/faces/{id} |
Get face record details |
DELETE |
/api/v1/faces/{id} |
Delete face record |
GET |
/api/v1/persons |
List persons with pagination |
GET |
/api/v1/persons/by_external_ids |
List persons by external IDs (comma-separated) |
GET |
/api/v1/persons/by_external_id/{external_id} |
Get person by external ID |
POST |
/api/v1/persons |
Create new person |
GET |
/api/v1/persons/{id} |
Get person details |
PUT |
/api/v1/persons/{id} |
Update person information |
DELETE |
/api/v1/persons/{id} |
Delete person and all faces |
GET |
/api/v1/persons/{person_id}/timeline |
Get person timeline (chronological appearances) |
GET |
/api/v1/persons/{person_id}/appearances |
Get person appearances with geo-filtering |
GET |
/api/v1/images/{image_id} |
Serve image file |
GET |
/api/v1/images/{image_id}/download |
Download image file |
GET |
/api/v1/health |
Basic health check |
GET |
/api/v1/health/ready |
Readiness probe (K8s) |
GET |
/api/v1/health/live |
Liveness probe (K8s) |
GET |
/api/v1/metrics |
Service metrics (JSON) |
GET |
/api/v1/metrics/prometheus |
Prometheus metrics |
POST |
/api/v1/auth/login |
User authentication |
# Request with priority and options
curl -X POST http://localhost:7999/api/v1/faces/enroll_async \
-H "Content-Type: application/json" \
-d '{
"person_id": "employee_123",
"image_data": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQg...",
"priority": "high",
"processing_options": {
"auto_associate": true,
"enable_multi_face": true,
"quality_threshold": 0.8
},
"webhook_url": "https://your-app.com/webhook/face-enrollment"
}'
# Immediate response (< 100ms)
{
"success": true,
"data": {
"face_id": "47f651a6-086d-4928-8c2d",
"status": "processing",
"estimated_completion": "< 30 seconds"
}
}# List persons by multiple external IDs with pagination
curl -X GET "http://localhost:8080/api/v1/persons/by_external_ids?external_ids=ext_001,ext_002,ext_003&limit=50" \
-H "Accept: application/json"
# Response
{
"success": true,
"message": "Found 2 persons for 3 external_ids",
"data": {
"persons": [
{
"person_id": "person_12345",
"external_id": "ext_001",
"name": "John Doe",
"face_count": 3,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"metadata": {"department": "Engineering"}
},
{
"person_id": "person_67890",
"external_id": "ext_002",
"name": "Jane Smith",
"face_count": 5,
"created_at": "2025-01-15T11:15:00Z",
"updated_at": "2025-01-15T11:15:00Z",
"metadata": {"department": "Marketing"}
}
],
"next_page_token": "",
"has_more": false,
"external_ids": ["ext_001", "ext_002", "ext_003"]
}
}# Get a single person by external ID
curl -X GET "http://localhost:8080/api/v1/persons/by_external_id/ext_001" \
-H "Accept: application/json"
# Response
{
"success": true,
"message": "Person found for external_id: ext_001",
"data": {
"person_id": "person_12345",
"external_id": "ext_001",
"name": "John Doe",
"face_count": 3,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"metadata": {"department": "Engineering"}
}
}ββββββββββ βββββββββββ βββββββββ ββββββββββ βββββββββββββ βββββββββββββ
β Client β βREST API β β Kafka β β Worker β β Extractor β β Databases β
βββββ¬βββββ ββββββ¬βββββ βββββ¬ββββ βββββ¬βββββ βββββββ¬ββββββ βββββββ¬ββββββ
β β β β β β
β POST /faces/ β β β β β
β enroll_async β β β β β
βββββββββββββββΊβ β β β β
β β Publish β β β β
β β enrollment β β β β
β β event β β β β
β βββββββββββββββΊβ β β β
β 200 OK β β β β β
β (< 100ms) β β β β β
ββββββββββββββββ€ β β β β
β β β Consume β β β
β β β event β β β
β β βββββββββββββΊβ β β
β β β β gRPC extract_ β β
β β β β face β β
β β β ββββββββββββββββΊβ β
β β β β Face β β
β β β β embeddings β β
β β β βββββββββββββββββ€ β
β β β β Store face + β β
β β β β vectors β β
β β β βββββββββββββββββββββββββββββββββΊβ
β β Webhook β β β β
β β callback β β β β
β ββββββββββββββββββββββββββββ€ β β
β Webhook β β β β β
β notification β β β β β
ββββββββββββββββ€ β β β β
ββββββββββ βββββββββββ βββββββββ βββββββββββββ ββββββββββ ββββββββββββ
β Client β βREST API β β Cache β β Extractor β β Milvus β β ScyllaDB β
βββββ¬βββββ ββββββ¬βββββ βββββ¬ββββ βββββββ¬ββββββ βββββ¬βββββ ββββββ¬ββββββ
β β β β β β
β POST /facesβ β β β β
β /recognize β β β β β
βββββββββββββΊβ β β β β
β β Check cacheβ β β β
β βββββββββββββΊβ β β β
β β β β β β
β ββββ΄βββ β β β β
β βCacheβ β β β β
β βHit? β β β β β
β ββββ¬βββ β β β β
β β β β β β
β ββββββββ΄ββββββββββ β β β β
β HIT MISS β β β
β β β β β β β
β β Cached result β β β β β
β ββββββββββββββββββ€ β β β β
β β β β Extract β β β
β β β β features β β β
β β β βββββββββββββΊβ β β
β β β β Face β β β
β β β β embeddings β β β
β β β ββββββββββββββ€ β β
β β β β Vector β β β
β β β β similarity β β β
β β β β search β β β
β β β ββββββββββββββββββββββββββΊβ β
β β β β Top matchesβ β β
β β β βββββββββββββββββββββββββββ€ β
β β β β Get person β β β
β β β β details β β β
β β β βββββββββββββββββββββββββββββββββββββββΊβ
β β β β Person β β β
β β β β metadata β β β
β β β ββββββββββββββββββββββββββββββββββββββββ€
β β β β Store β β β
β β β β result β β β
β β β βββββββββββββΊβ β β
β ββββββββββββββββββββββ β β β
β Recognition result (~30ms) β β β
ββββββββββββββ€ β β β
Swagger UI: http://localhost:8080/docs - Interactive API explorer with live testing capabilities
FreeFace includes a comprehensive observability platform with metrics, logging, and tracing:
# View all metrics
curl http://localhost:8080/api/v1/metrics/prometheus
# Key metric categories:
# β’ HTTP Operations: requests_total, response_time_ms, client_errors, server_errors
# β’ Face Operations: enroll_requests, enroll_success, search_requests, recognition_requests
# β’ Database Operations: scylla_operations_total, milvus_operations_total, db_queries_success
# β’ System Metrics: system_errors_total, system_uptime_seconds, memory_usage_bytes# Jaeger tracing with request correlation
# Features:
# β’ HTTP request spans with timing
# β’ Database operation tracing
# β’ Cross-service request correlation
# β’ Request ID tracking throughout the system
# β’ Performance bottleneck identification# All logs include rich context:
# β’ Request IDs for correlation
# β’ Service names and operations
# β’ Timing information (start/end/duration)
# β’ Success/failure status
# β’ Database table and operation details
# β’ Error messages and stack traces# Service health (via Skaffold port-forward)
curl http://localhost:8080/health
curl http://localhost:8080/health/ready
curl http://localhost:8080/metricsAll monitoring services are automatically port-forwarded when using Skaffold development mode:
- Prometheus: http://localhost:9091 - Metrics collection and alerting
- Grafana: http://localhost:3001 (admin/admin) - Visualization dashboards
- Jaeger: http://localhost:16686 - Distributed request tracing
- Kibana: http://localhost:5601 - Log analysis and search
All migration commands now run directly with cargo (no Docker/K8s needed):
# Apply all pending migrations
cargo run --bin migrate -- up --database all
# Apply migrations for specific database
cargo run --bin migrate -- up --database scylla
cargo run --bin migrate -- up --database milvus
# Check migration status
cargo run --bin migrate -- status --database all
# Create new migration template
cargo run --bin migrate -- create "add_user_sessions" --database scylla
cargo run --bin migrate -- create "face_indexes" --database milvus
# Rollback migrations (not implemented yet)
cargo run --bin migrate -- down --database scylla --steps 1
# DESTRUCTIVE: Erase entire database
cargo run --bin migrate -- erase all --confirm
# DESTRUCTIVE: Truncate data while keeping schema
cargo run --bin migrate -- truncate scylla --tables all --confirm
cargo run --bin migrate -- truncate scylla --tables "persons,faces,images" --confirm
cargo run --bin migrate -- truncate scylla --tables "faces,user_auth" --confirm
cargo run --bin migrate -- truncate milvus --collections all --confirm
cargo run --bin migrate -- truncate milvus --collections "face_embeddings" --confirmMigration Features:
- β Dual Database Support: ScyllaDB (.cql files) and Milvus (.json collections)
- β Checksum Validation: Prevents accidental re-runs of modified migrations
- β Migration Tracking: Complete history with execution times and status
- β Error Recovery: Failed migrations are logged for debugging
- β Interactive Setup: Dynamic keyspace configuration for production deployments
- β Safety Controls: Destructive operations require explicit confirmation
Note: Infrastructure services (ScyllaDB, Milvus) must be running in K8s with proper port forwarding.
Copyright (c) 2025 Moussa Ndour
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
- β Free to use, modify, and share for personal, educational, and research purposes
- β Open source contributions welcome
- β Must provide attribution
For commercial use, you need explicit written permission from the author.
Contact for commercial licensing:
- π§ Email: moussandour1@gmail.com
- π GitHub: github.com/touskar
- π¬ WhatsApp: +221772457199
See LICENSE file for full details.