# specklesystems/speckle-sharp-connectors architecture

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

- Interactive diagram: https://gitdiagram.com/specklesystems/speckle-sharp-connectors
- Repository: https://github.com/specklesystems/speckle-sharp-connectors

## Overview

##### Main Components
- Desktop UI
– Represented by the DUI3 folder.
– This component is the entry point for user interaction in a desktop environment that manages, displays, and perhaps triggers connector actions.
- Connectors
– Organized by subdirectories under “Connectors”. Examples include Autocad, Rhino, Revit, ArcGIS, Tekla, and even CSi modules.
– These connectors are responsible for interfacing with native AEC software and exposing Speckle functionality.
– They include UI-specific plugins, bindings, dependency injection setups, and operations (for sending/receiving data).
- Converters
– Found under the “Converters” directory. They are also grouped by platform (Autocad, Civil3d, Rhino, Revit, ArcGIS, Tekla, and CSi).
– Converters contain the logic to translate data between the native application formats and the Speckle object graph.
- SDK / Core Libraries
– The “Sdk” folder has common modules such as connectors’ utilities, dependency injection modules, logging, caching, and geometry/mesh utilities.
– This acts as the core backbone that supplies common functions and libraries to both connectors and converters.
- Build & CI / Testing Infrastructure
– The Build folder and various test projects spread across the structure indicate automated testing, metrics, and CI/CD practices (e.g., GitHub workflows).

##### Relationships and Data Flow
– The Desktop UI (DUI3) sends user-triggered commands to the connectors.
– Connectors interact with the native AEC applications (Autodesk Revit, Rhino, etc.) through plugins, bindings, and host objects.
– When data is exchanged, the connectors use the Converters to translate native geometry and parameters to the Speckle data format (and vice versa).
– The SDK provides a common set of services (dependency injection, logging, caching, and instance management) to both connectors and converters.
- Inter-component Communication:
– Dependencies are managed via modules (for example, each connector has its own DependencyInjection folder and registration classes).
– There is a clear separation of concerns: the connector handles domain-specific interaction while the converter deals with geometry/data transformation.

##### Architectural Patterns and Design Principles
- Modularity:
– The project is divided along functional lines (Desktop UI, Connectors, Converters, SDK) allowing independent evolution and testing.
- Separation of Concerns (SoC):
– Data presentation (via DUI3) is separated from the underlying business logic (connector/plugin implementations) and conversion logic (converters).
- Dependency Injection:
– Each sub-component employs DI modules (e.g., ConnectorModule.cs files) that wire applications together, which helps in decoupling and testing.
- Use of Testing and CI:
– Multiple test projects, build scripts, and GitHub workflows indicate emphasis on automated builds and unit/integration testing.

- Avoid drawing every single folder or file; instead, concentrate on the main modules (UI, Connectors, Converters, SDK, and Build/CI).

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    %% Desktop UI Layer
    subgraph "Desktop UI Layer"
        UI["Desktop UI (DUI3)"]:::ui
    end

    %% Connectors Layer
    subgraph "Connectors Layer"
        CAutocad["Connector - Autocad"]:::connector
        CRevit["Connector - Revit"]:::connector
        CRhino["Connector - Rhino"]:::connector
        CArcGIS["Connector - ArcGIS"]:::connector
        CTekla["Connector - Tekla"]:::connector
        CCSi["Connector - CSi"]:::connector
    end

    %% Converters Layer
    subgraph "Converters Layer"
        VAutocad["Converter - Autocad"]:::converter
        VRevit["Converter - Revit"]:::converter
        VRhino["Converter - Rhino"]:::converter
        VArcGIS["Converter - ArcGIS"]:::converter
        VTekla["Converter - Tekla"]:::converter
        VCSi["Converter - CSi"]:::converter
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        SDK["SDK (Core Libraries)"]:::sdk
        NI["Native AEC Applications"]:::connector
        BuildNode["Build Scripts (Build)"]:::ci
        CIWorkflows["CI Workflows (.github)"]:::ci
    end

    %% Data Flow - From Desktop UI to Connectors
    UI -->|"UserCommand"| CAutocad
    UI -->|"UserCommand"| CRevit
    UI -->|"UserCommand"| CRhino
    UI -->|"UserCommand"| CArcGIS
    UI -->|"UserCommand"| CTekla
    UI -->|"UserCommand"| CCSi

    %% Connectors interacting with Native AEC Applications
    CAutocad -->|"PluginInterface"| NI
    CRevit -->|"PluginInterface"| NI
    CRhino -->|"PluginInterface"| NI
    CArcGIS -->|"PluginInterface"| NI
    CTekla -->|"PluginInterface"| NI
    CCSi -->|"PluginInterface"| NI

    %% Connectors invoking Converters for Data Conversion
    CAutocad -->|"DataConversion"| VAutocad
    CRevit -->|"DataConversion"| VRevit
    CRhino -->|"DataConversion"| VRhino
    CArcGIS -->|"DataConversion"| VArcGIS
    CTekla -->|"DataConversion"| VTekla
    CCSi -->|"DataConversion"| VCSi

    %% Connectors and Converters using SDK services
    CAutocad -->|"DI"| SDK
    CRevit -->|"DI"| SDK
    CRhino -->|"DI"| SDK
    CArcGIS -->|"DI"| SDK
    CTekla -->|"DI"| SDK
    CCSi -->|"DI"| SDK

    VAutocad -->|"Utilities"| SDK
    VRevit -->|"Utilities"| SDK
    VRhino -->|"Utilities"| SDK
    VArcGIS -->|"Utilities"| SDK
    VTekla -->|"Utilities"| SDK
    VCSi -->|"Utilities"| SDK

    %% Infrastructure Build & CI flow
    SDK -->|"Build/Test"| BuildNode
    BuildNode -->|"Triggers"| CIWorkflows

    %% Click Events
    click UI "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/DUI3"
    click CAutocad "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/Autocad"
    click CRevit "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/Revit"
    click CRhino "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/Rhino"
    click CArcGIS "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/ArcGIS"
    click CTekla "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/Tekla"
    click CCSi "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Connectors/CSi"
    click VAutocad "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/Autocad"
    click VRevit "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/Revit"
    click VRhino "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/Rhino"
    click VArcGIS "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/ArcGIS"
    click VTekla "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/Tekla"
    click VCSi "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Converters/CSi"
    click SDK "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Sdk"
    click BuildNode "https://github.com/specklesystems/speckle-sharp-connectors/tree/dev/Build"
    click CIWorkflows "https://github.com/specklesystems/speckle-sharp-connectors/blob/dev/.github"

    %% Styles
    classDef ui fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef connector fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef converter fill:#f08080,stroke:#333,stroke-width:2px;
    classDef sdk fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef ci fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
