# tilialabs/tilia-phoenix-connect architecture

> Architecture diagram of the GitHub repository tilialabs/tilia-phoenix-connect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tilialabs/tilia-phoenix-connect
- Repository: https://github.com/tilialabs/tilia-phoenix-connect

## Overview

##### Project’s Purpose and Type
- It is an open source connectivity application that integrates Enfocus Switch with tilia Phoenix.
- Its main functionality is to allow dynamic imposition for print workflows, providing several export formats (e.g., PDF, JDF, DXF, XML, etc.) to control press and finishing devices.
- It is run as a script (tilia-phoenix-connect.sscript) within Enfocus Switch, with supporting code in source.js and properties in props.xml.

##### Assess the File Structure
- The minimal file structure indicates that the project is script-based:
- The tilia-phoenix-connect.sscript file is the primary script for Switch.
- The source.js file contains the core logic (with a directive that every code change on source.js must be tracked alongside the sscript file).
- The props.xml file holds dynamic properties used by the script, enabling an abstraction between the configuration and code.
- The images folder (and accompanying files like LICENSE, README.md) support documentation and branding.
- No separate directories for backend or frontend exist—this is a single component application that acts as an integration layer.

##### Main Components
- Enfocus Switch:
- That this component is responsible for running the script (tilia-phoenix-connect.sscript) within its flows.
- That it interacts with external scripts and integrates with the automation endpoint from Phoenix.
- Phoenix:
- Tilia Phoenix with its relevant automation endpoint (Switch Connector), which is triggered to perform imposition tasks in real-time.
- Integration Script:
- Combine source.js, props.xml, and tilia-phoenix-connect.sscript into a central “Integration Layer” component.
- This component handles property management, dynamic scripting, and acts as the bridge between Switch and Phoenix.
- External Export Formats/Devices:
- Representations for the various output formats (Imposed PDF, JDF, DXF, etc.) as endpoints where the script sends data.
- This shows how the output is consumed, driving devices like printers or finishing equipment.

##### Relationships and Data Flows
- Bidirectional communication if the Phoenix system sends back status information or reports.

##### Architectural Patterns and Design Principles
- Segregation of Configuration/Properties:
- Using props.xml to keep dynamic properties modular, which enhances maintainability.
- Scripting and Automation Integration:
- The design is built for automation within an existing workflow (Enfocus Switch), and makes use of domain-specific scripting (Switch Scripter module).
- Minimal Connector Layer:
- Centralizing the connectivity logic in a few files ensures a lightweight and focused integration connector.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Host Applications"
        A["Enfocus Switch Scripting Module"]:::host
        E["tilia Phoenix"]:::host
    end

    subgraph "Integration Layer"
        B["Integration Script: source.js"]:::integration
        C["Dynamic Properties: props.xml"]:::config
    end

    subgraph "Export Endpoints"
        F["Imposed PDF"]:::export
        G["JDF"]:::export
        H["DXF"]:::export
        I["XML"]:::export
    end

    D["Documentation/Branding"]:::support

    A -->|"triggers"| B
    B -->|"uses-config"| C
    B -->|"calls-automation"| E
    E -->|"returns-status"| B
    B -->|"exports-PDF"| F
    B -->|"exports-JDF"| G
    B -->|"exports-DXF"| H
    B -->|"exports-XML"| I
    B -->|"refers-docs"| D

    click A "https://github.com/tilialabs/tilia-phoenix-connect/blob/main/tilia-phoenix-connect.sscript"
    click B "https://github.com/tilialabs/tilia-phoenix-connect/blob/main/source.js"
    click C "https://github.com/tilialabs/tilia-phoenix-connect/blob/main/props.xml"
    click D "https://github.com/tilialabs/tilia-phoenix-connect/tree/main/images"

    classDef host fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef integration fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef config fill:#ccccff,stroke:#333,stroke-width:2px;
    classDef export fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef support fill:#ffccff,stroke:#333,stroke-width:2px;
```
