# stevenfullman/elvis-image-recognition architecture

> Architecture diagram of the GitHub repository stevenfullman/elvis-image-recognition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stevenfullman/elvis-image-recognition
- Repository: https://github.com/stevenfullman/elvis-image-recognition

## Overview

##### Component Details

a. Elvis Server Component:
- Webhook integration point
- Custom metadata fields configuration
- Plugin system

b. Image Recognition Server:
- REST API endpoints (/api/recognize, /ping)
- Webhook endpoint
- File processing system
- Translation module

c. AI Services Integration:
- Individual connectors for each service
- Service-specific features (tag detection, facial analysis, landmark detection)

##### Two Main Flow Patterns
a. Import-time Recognition:
- Webhook trigger flow
- Preview generation
- AI service processing
- Metadata update path

b. On-demand Recognition:
- Plugin interaction
- REST API calls
- Processing flow
- Results storage

##### Technical Details
- Node.js runtime
- TypeScript implementation
- REST API endpoints
- Supported file types
- Metadata field mappings

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef client fill:#e1e1ff,stroke:#9370db
    classDef server fill:#90EE90,stroke:#006400
    classDef external fill:#FFA07A,stroke:#FF4500
    classDef elvis fill:#87CEEB,stroke:#4682B4
    classDef api fill:#DDA0DD,stroke:#8B008B

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        WebClient["Elvis Web Client"]
        DesktopClient["Elvis Desktop Client"]
        
        subgraph Plugins["Elvis Plugins"]
            AutoTag["Auto Tag Plugin"]
            WebLinks["Web Links Plugin"]
            SearchSimilar["Search Similar Plugin"]
            ImageSearch["Image Search Plugin"]
        end
    end

    %% Server Layer
    subgraph ServerLayer["Server Layer"]
        ElvisServer["Elvis Server"]:::elvis
        
        subgraph RecognitionServer["Image Recognition Server"]
            NodeServer["Node.js Server"]:::server
            APIEndpoint["REST API"]:::api
            WebhookEndpoint["Webhook Endpoint"]:::api
            FileProcessor["File Processing"]:::server
            RecognitionLogic["Recognition Logic"]:::server
            SearchImage["Search by Image"]:::server
            ElvisAPI["Elvis API Integration"]:::elvis
        end
    end

    %% External Services Layer
    subgraph ExternalLayer["External Services Layer"]
        GoogleVision["Google Vision API"]:::external
        AWSRekognition["AWS Rekognition"]:::external
        Clarifai["Clarifai"]:::external
        Emrays["Emrays"]:::external
        Translate["Google Translate"]:::external
    end

    %% Connections
    WebClient --> ElvisServer
    DesktopClient --> ElvisServer
    Plugins --> APIEndpoint
    ElvisServer --> WebhookEndpoint
    
    NodeServer --> FileProcessor
    FileProcessor --> RecognitionLogic
    RecognitionLogic --> ElvisAPI
    
    RecognitionLogic --> GoogleVision
    RecognitionLogic --> AWSRekognition
    RecognitionLogic --> Clarifai
    RecognitionLogic --> Emrays
    RecognitionLogic --> Translate

    %% Click Events
    click AutoTag "https://github.com/stevenfullman/elvis-image-recognition/tree/master/elvis-plugins/auto_tag_images/"
    click WebLinks "https://github.com/stevenfullman/elvis-image-recognition/tree/master/elvis-plugins/web_links/"
    click SearchSimilar "https://github.com/stevenfullman/elvis-image-recognition/tree/master/elvis-plugins/search_similar/"
    click ImageSearch "https://github.com/stevenfullman/elvis-image-recognition/tree/master/elvis-plugins/image_search/"
    click NodeServer "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/server.ts"
    click APIEndpoint "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/recognize-api.ts"
    click WebhookEndpoint "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/webhook-endpoint.ts"
    click FileProcessor "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/file-utils.ts"
    click RecognitionLogic "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/recognizer.ts"
    click SearchImage "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/search-by-image.ts"
    click GoogleVision "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/service/google-vision.ts"
    click AWSRekognition "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/service/aws-rekognition.ts"
    click Clarifai "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/service/clarifai.ts"
    click Emrays "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/service/emrays.ts"
    click Translate "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/app/service/google-translate.ts"
    click ElvisAPI "https://github.com/stevenfullman/elvis-image-recognition/blob/master/src/elvis-api/api.ts"

    %% Legend
    subgraph Legend
        Client[Client Components]:::client
        Server[Server Components]:::server
        External[External Services]:::external
        Elvis[Elvis Components]:::elvis
        API[API Endpoints]:::api
    end
```
