# jetlinks/jetlinks-community architecture

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

- Interactive diagram: https://gitdiagram.com/jetlinks/jetlinks-community
- Repository: https://github.com/jetlinks/jetlinks-community

## Overview

The JetLinks project is a full‐featured, enterprise‐grade IoT platform built with modern Java technologies (Java 8, Spring Boot 2.x, WebFlux, Reactor, Netty, Vert.x) that supports a wide range of device protocols and management functionalities. In other words, you are looking at a full-stack IoT platform that consists of several main modules for device gateway management, rule engine processing, data visualization, authentication and authorization, and more.

##### High-Level Components
- Components Module ("jetlinks-components"): Contains common libraries, shared utilities and integrations (e.g. common-component, configuration-component, dashboard-component, elasticsearch integration, gateway, IO, logging, network, notify, protocol, relation, rule-engine, script, timeseries, tdengine, and things). Each of these submodules addresses a specific capability.
- Manager Module ("jetlinks-manager"): Provides business-level management functions such as authentication, device management, logging management, network management, notify management, visualization, and rule-engine management.
- Standalone Module ("jetlinks-standalone"): Represents the service startup layer (entry point) of the platform.
- Simulator Module ("simulator"): Supports simulation of devices and histories (e.g., benchmark simulators for MQTT, device simulation jars and scripts for starting simulated workloads).
- Auxiliary Modules: The repository also includes Docker files, Maven wrapper scripts and build configurations that support CI/CD and deployment.

##### Relationships & Data Flow
- Device Connectivity: The network-component submodule (including gateway, TCP, MQTT, etc.) handles device protocol integration and message passing. It “talks to” the device-manager (in module jetlinks-manager) to register, update, and manage device status.
- Data Processing: Once messages are received from devices, the rule-engine-component processes the data through configurable rules (e.g., alarm thresholds, scene triggers). The timeseries-component and tdengine-component manage high-volume data storage and time-series analysis.
- User & Data Management: The authentication-manager manages users and roles, while device-manager, logging-manager, and notify-manager provide interfaces for device operations, logs, notifications (SMS, email, voice, webhook, etc.).
- External Integration: Components integrate with external systems like ElasticSearch (for logging and search) and PostgreSQL via R2DBC for reactive database access.

##### Architectural Patterns
- Modular/Microkernel Architecture: The source tree separates core components (like common libraries and network components) from management modules; they plug together into the overall platform.
- Reactive & Event Driven: With Spring WebFlux, Reactor, Netty, and Vert.x, the system design follows a non-blocking, event–driven pattern for high-concurrency device communication.
- Decoupling via Interfaces: Most modules expose service interfaces (e.g., protocol-component for device protocol supports, notify-component to handle various alert channels) that promote plug–in, extensibility, and testing.

- Clear labels for each component and submodule (e.g., “Device Gateway (MQTT/TCP/HTTP)”, “Rule Engine”, “Authentication & Authorization”, “Device Management”, “Notify Service”, “Data Storage & Time Series”, “Integration (ElasticSearch, PostgreSQL)”).
– Data flowing from Device Manager into the Rule Engine.
– Rules triggering notifications via the Notify Service.
– Data being archived into time-series databases.
– Interactions between external systems like ElasticSearch and the logging components.
– For instance, use rectangles for microservices or modules.
- With technologies and key design concepts (Reactive Streams, WebFlux, etc.) where relevant.

##### Summary
- A multi-module layout where each module has a defined responsibility.
- Communication channels between device layer (network) and management/business logic.
- Integration points for notifications, logging, and data persistence.
- Deployment views indicating Docker-based environments and the standalone service layer for startup.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Standalone Module
    subgraph "Standalone Module"
        ST["Standalone Service"]:::standalone
    end

    %% Manager Module
    subgraph "Manager Module"
        AM["Authentication Manager"]:::manager
        DM["Device Manager"]:::manager
        LM["Logging Manager"]:::manager
        NM["Network Manager"]:::manager
        NTM["Notify Manager"]:::manager
        REM["Rule Engine Manager"]:::manager
    end

    %% Components Module
    subgraph "Components Module"
        CC["Common Component"]:::comp
        CFG["Configuration Component"]:::comp
        DBC["Dashboard Component"]:::comp
        ESC["Elasticsearch Component"]:::comp
        GC["Gateway Component"]:::comp
        IOC["IO Component"]:::comp
        LC["Logging Component"]:::comp
        NC["Network Component"]:::comp
        NTC["Notify Component"]:::comp
        PC["Protocol Component"]:::comp
        RC["Relation Component"]:::comp
        REC["Rule Engine Component"]:::comp
        SC["Script Component"]:::comp
        TS["Timeseries Component"]:::comp
        TDC["TDengine Component"]:::comp
        TC["Things Component"]:::comp
    end

    %% Simulator Module
    subgraph "Simulator Module"
        SIM["Simulator Module"]:::simulator
    end

    %% Auxiliary Modules
    subgraph "Auxiliary Modules"
        AUX["CI/CD & Deployment"]:::aux
    end

    %% External Database
    PG["PostgreSQL"]:::database

    %% Relationships and Data Flow
    ST -->|"boot"| DM
    ST -->|"boot"| AM
    AUX -->|"deploy"| ST

    NC -->|"deviceConnectivity"| DM
    DM -->|"processData"| REC
    REC -->|"triggerNotify"| NTM
    REC -->|"archiveData"| TS
    REC -->|"archiveData"| TDC
    REC -->|"storeReactive"| PG
    ESC -->|"loggingData"| LM
    SIM -->|"simulateDevices"| DM

    %% Styles
    classDef comp fill:#bbdefb,stroke:#1565c0,stroke-width:2px;
    classDef manager fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef standalone fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef simulator fill:#b2dfdb,stroke:#00695c,stroke-width:2px;
    classDef aux fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef database fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px;

    %% Click Events for Components Module
    click CC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/common-component"
    click CFG "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/configure-component"
    click DBC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/dashboard-component"
    click ESC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/elasticsearch-component"
    click GC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/gateway-component"
    click IOC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/io-component"
    click LC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/logging-component"
    click NC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/network-component"
    click NTC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/notify-component"
    click PC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/protocol-component"
    click RC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/relation-component"
    click REC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/rule-engine-component"
    click SC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/script-component"
    click TS "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/timeseries-component"
    click TDC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/tdengine-component"
    click TC "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-components/things-component"

    %% Click Events for Manager Module
    click AM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/authentication-manager"
    click DM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/device-manager"
    click LM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/logging-manager"
    click NM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/network-manager"
    click NTM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/notify-manager"
    click REM "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-manager/rule-engine-manager"

    %% Click Events for Standalone and Simulator Modules
    click ST "https://github.com/jetlinks/jetlinks-community/tree/master/jetlinks-standalone"
    click SIM "https://github.com/jetlinks/jetlinks-community/tree/master/simulator"
```
