# serverlessworkflow/synapse architecture

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

- Interactive diagram: https://gitdiagram.com/serverlessworkflow/synapse
- Repository: https://github.com/serverlessworkflow/synapse

## Overview

##### High-Level Architecture Components

- API Server (Gateway & Resource Management)
- Operator (Workflow Control)
- Runner (Workflow Execution)
- Correlator (Event Processing)
- Dashboard (User Interface)
- CLI (Command Line Interface)

##### Key Relationships and Data Flow

a) External Interactions:
- Users/Clients → API Server (HTTP/REST)
- Users → Dashboard (Web Interface)
- Users → CLI (Command Line)
- External Systems → Correlator (Events)

b) Internal Communications:
- API Server ↔ Operator (Resource Management)
- Operator → Runner (Workflow Execution)
- Correlator → API Server (Event Processing)
- Dashboard → API Server (Resource Management)

##### Supporting Infrastructure

Essential components:
- Container Platform (Docker/Kubernetes)
- Event Bus/Message Queue
- Storage/Database Systems
- Authentication/Authorization Services

**[External Users/Systems]**
- ↓
**[Frontend Layer: Dashboard, CLI]**
- ↓
**[API Layer: API Server]**
- ↓
**[Control Layer: Operator, Correlator]**
- ↓
**[Execution Layer: Runner]**
- ↓
**[Infrastructure Layer: Containers, Storage, Events]**

##### Additional Elements

Important aspects:
- Security boundaries
- Authentication flows
- Scaling indicators
- Health monitoring
- Resource management flows
- Event processing paths

##### Technical Details

Architectural features:
- RESTful API endpoints
- Event-driven architecture
- Microservices communication
- Container orchestration
- State management
- Error handling flows

##### Implementation Notes

- Vendor-neutral design
- Cloud-native architecture
- Scalability patterns
- Event-driven nature
- Service-oriented approach
- FaaS integration capabilities

Use a professional diagramming tool that supports:
- Nested containers
- Export capabilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Layer
    subgraph External
        Users([Users/Clients])
        ExtSys([External Systems])
    end

    %% Frontend Layer
    subgraph Frontend
        Dashboard["Dashboard"]:::ui
        CLI["CLI"]:::ui
    end

    %% API Layer
    subgraph APILayer
        APIServer["API Server"]:::core
        APICore["Core API"]:::core
        APIHttp["HTTP Controllers"]:::core
        APIClient["Client Libraries"]:::core
    end

    %% Control Layer
    subgraph Control
        Operator["Operator"]:::control
        OpServices["Operator Services"]:::control
        OpConfig["Operator Config"]:::control
        Correlator["Correlator"]:::event
        CorServices["Correlator Services"]:::event
        CorControllers["Correlator Controllers"]:::event
    end

    %% Execution Layer
    subgraph Execution
        Runner["Runner"]:::exec
        TaskExec["Task Executors"]:::exec
        Runtime["Runtime Services"]:::exec
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        Containers[("Container Platform")]:::infra
        Storage[("Storage/Database")]:::infra
        EventBus[("Event Bus")]:::infra
        Auth[("Auth Services")]:::infra
    end

    %% Connections
    Users --> Dashboard & CLI
    ExtSys --> Correlator
    Dashboard & CLI --> APIServer
    APIServer --> APICore & APIHttp
    APIHttp --> APIClient
    APIServer <--> Operator
    Operator --> OpServices & OpConfig
    Correlator --> CorServices & CorControllers
    Operator --> Runner
    Runner --> TaskExec & Runtime
    Correlator --> APIServer

    %% Infrastructure Connections
    APIServer & Operator & Runner & Correlator --> Auth
    Runner & Operator --> Storage
    Correlator & Operator --> EventBus
    Runner & Operator --> Containers

    %% Click Events
    click Dashboard "https://github.com/serverlessworkflow/synapse/blob/main/src/dashboard/Synapse.Dashboard"
    click CLI "https://github.com/serverlessworkflow/synapse/blob/main/src/cli/Synapse.Cli"
    click APIServer "https://github.com/serverlessworkflow/synapse/blob/main/src/api/Synapse.Api.Server"
    click APICore "https://github.com/serverlessworkflow/synapse/blob/main/src/api/Synapse.Api.Application"
    click APIHttp "https://github.com/serverlessworkflow/synapse/blob/main/src/api/Synapse.Api.Http"
    click APIClient "https://github.com/serverlessworkflow/synapse/blob/main/src/api/Synapse.Api.Client.Http"
    click Operator "https://github.com/serverlessworkflow/synapse/blob/main/src/operator/Synapse.Operator"
    click OpServices "https://github.com/serverlessworkflow/synapse/tree/main/src/operator/Synapse.Operator/Services"
    click OpConfig "https://github.com/serverlessworkflow/synapse/tree/main/src/operator/Synapse.Operator/Configuration"
    click Runner "https://github.com/serverlessworkflow/synapse/blob/main/src/runner/Synapse.Runner"
    click TaskExec "https://github.com/serverlessworkflow/synapse/tree/main/src/runner/Synapse.Runner/Services/Executors"
    click Runtime "https://github.com/serverlessworkflow/synapse/blob/main/src/runtime/Synapse.Runtime.Abstractions"
    click Correlator "https://github.com/serverlessworkflow/synapse/blob/main/src/correlator/Synapse.Correlator"
    click CorServices "https://github.com/serverlessworkflow/synapse/tree/main/src/correlator/Synapse.Correlator/Services"
    click CorControllers "https://github.com/serverlessworkflow/synapse/tree/main/src/correlator/Synapse.Correlator/Controllers"

    %% Styles
    classDef core fill:#2374ab
    classDef control fill:#2a9d8f
    classDef exec fill:#4caf50
    classDef event fill:#ff9800
    classDef ui fill:#9c27b0
    classDef infra fill:#607d8b

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Control Components"]:::control
        L3["Execution Components"]:::exec
        L4["Event Processing"]:::event
        L5["User Interfaces"]:::ui
        L6["Infrastructure"]:::infra
    end
```
