How instill-ai/model-backend works
Main Components
a) Core Services Layer:
• Model Management Service (pkg/service)
• Worker Service (pkg/worker)
• Repository Layer (pkg/repository)
• Handler Layer (pkg/handler)
b) External Integration Layer:
• Ray Integration (pkg/ray)
• Database Systems
• SQL Database (pkg/db)
• InfluxDB (indicated by repository/influx.go)
c) API Layer:
• gRPC Services (shown by proto files)
• REST Endpoints (indicated by integration tests)
• Private and Public APIs (pkg/handler/private.go and public.go)
d) Model Resources:
• Model Definitions
• Model Instances
• Various Task Types (shown in proto/model/model/v1alpha/)
[Client Layer]
[API Gateway]
[Service Layer] ←→ [Authentication/ACL]
[Core Services] ←→ [Worker Pool]
[Storage Layer]
Key Relationships to Highlight
• Flow from API endpoints through handlers to services
• Worker system's interaction with Ray for model execution
• Demonstrate database interactions for model management
• ACL (Access Control Layer) integration
Important Architectural Patterns to Emphasize
• Microservice Architecture: Show clear separation between different service components
• Repository Pattern: Highlight the data access layer
• Worker Pool Pattern: Demonstrate the distributed task execution
• GRPC/REST dual interface: Show both communication methods
Additional Elements
• A section for model assets (shown in /assets directory)
• Integration with external services (Ray)
• Demonstrate the migration system (pkg/db/migration)
• Monitoring and logging components (pkg/logger)
Specific Implementation Details
• Different model task types supported (classification, detection, OCR, etc.)
• Separation between public and private APIs
• Operation handling system for long-running tasks
• Metadata retention and usage tracking systems
• Component types
• Any abbreviations used