Skip to content

A based flow programming runtime engine, compatible with Node-RED, in Rust.

License

Notifications You must be signed in to change notification settings

oldrev/edgelink

Repository files navigation

EdgeLink: A Node-RED Compatible Run-time Engine in Rust

Build Status Releases

Node-RED Rust Backend

English | 简体中文

Overview

EdgeLink is a Node-RED compatible run-time engine implemented in Rust.

This program is designed to execute flows.json file that have been designed and exported/deployed using Node-RED, without any editor or other HTML/Web-related functionalities. The purpose of its development is to deploy tested Node-RED flows to devices with limited memory for execution.

Only the "function" node will use the lightweight QuickJS JS interpreter to run their code; all other functionalities are implemented in native Rust code.

Features

Memory Usage

  • High Performance: Leverage the advantages of the Rust language for excellent performance.
  • Low Memory Footprint: Reduce memory usage compared to the NodeJS backend. Tests indicate that, for running a same simple workflow, the physical memory usage of EdgeLink is only 10% of that of Node-RED.
  • Scalability: Retain the extensibility of Node-RED, supporting custom nodes.
  • Easy Migration: Easily replace the existing Node-RED backend with minimal modifications.

Quick Start

0. Install Node-RED

For the purpose of testing this project, we first need to install Node-RED as our flow designer and generate the flows.json file. Please refer to the Node-RED documentation for its installation and usage.

After completing the flow design in Node-RED, please ensure that you click the big red "Deploy" button to generate the flows.json file. By default, this file is located in ~/.node-red/flows.json. Be mindful not to use Node-RED features that are not yet implemented in this project.

1. Build

Using Rust 1.80 or later, run:

cargo build -r

Important

Note for Windows Users: Windows users should ensure that the patch.exe program is available in the %PATH% environment variable to successfully compile the project using rquickjs. This utility is required to apply patches to the QuickJS library for Windows compatibility. If Git is already installed, it will include patch.exe.

To compile rquickjs, which is required by the project, you will need to install Microsoft Visual C++ (MSVC) and the corresponding Windows Software Development Kit (SDK).

The toolchains tested are as follows(see GitHub Actions for details):

  • x86_64-pc-windows-msvc
  • x86_64-pc-windows-gnu
  • x86_64-unknown-linux-gnu
  • aarch64-unknown-linux-gnu
  • armv7-unknown-linux-gnueabihf
  • armv7-unknown-linux-gnueabi

2. Run

cargo run -r

Or:

./target/release/edgelinkd

By default, EdgeLink will read ~/.node-red/flows.json and execute it.

You can use the --help command-line argument to view all the supported options for this program:

./target/release/edgelinkd --help

Run Unit Tests

cargo test --all

Run Integration Tests

Running integration tests requires first installing Python 3.9+ and the corresponding Pytest dependencies:

pip install -r ./tests/requirements.txt

Then execute the following command:

set PYO3_PYTHON=YOUR_PYTHON_EXECUTABLE_PATH # Windows only
cargo build --all
py.test

Configuration

Adjust various settings and configuration, please execute edgelinkd with flags. The flags available can be found when executing edgelinkd --help.

Project Status

Pre-Alpha Stage: The project is currently in the pre-alpha stage and cannot guarantee stable operation.

The heavy check mark ( ✔️ ) below indicates that this feature has passed the integration test ported from Node-RED.

Node-RED Features Roadmap:

  • ✔️ Flow
  • ✔️ Sub-flow
  • Group
  • ✔️ Environment Variables
  • Context
    • Memory storage
    • Local file-system storage
  • RED.util (WIP)
    • RED.util.cloneMessage()
    • RED.util.generateId()
  • Plug-in subsystem1
  • JSONata

The Current Status of Nodes:

Refer REDNODES-SPECS-DIFF.md to view the details of the currently implemented nodes that comply with the Node-RED specification tests.

  • Core nodes:
    • Common nodes:
      • ✔️ Console-JSON (For integration tests)
      • ✔️ Inject
      • Debug (WIP)
      • ✔️ Complete
      • Catch
      • Status
      • ✔️ Link In
      • ✔️ Link Call
      • ✔️ Link Out
      • ✔️ Comment (Ignored automatically)
      • GlobalConfig (WIP)
      • ✔️ Unknown
      • ✔️ Junction
    • Function nodes:
      • Function (WIP)
        • Basic functions
        • node object (WIP)
        • context object
        • flow object
        • global object
        • RED.util object
        • env object
      • Switch
      • ✔️ Change
      • ✔️ Range
      • Template
      • Delay
      • Trigger
      • Exec
      • ✔️ Filter (RBE)
    • Network nodes:
      • MQTT In
      • MQTT Out
      • HTTP In
      • HTTP Response
      • HTTP Request
      • WebSocket In
      • WebSocket Out
      • TCP In
      • TCP Out
      • TCP Request
      • UDP In
      • UDP Out
        • Unicast
        • Multicast (WIP)
      • TLS
      • HTTP Proxy
    • Sqeuence nodes:
      • Split
      • Join
      • Sort
      • Batch
    • Parse nodes:
      • CSV
      • HTML
      • JSON
      • XML
      • YAML
    • Storage
      • Write File
      • Read File
      • Watch

Roadmap

Check out our milestones to get a glimpse of the upcoming features and milestones.

Contribution

Alt

Contributions are always welcome! Please read CONTRIBUTING.md for more details.

If you want to support the development of this project, you could consider buying me a beer.

Buy Me a Coffee at ko-fi.com

Support via PayPal.me

Issues, Feedback and Support

We welcome your feedback! If you encounter any issues or have suggestions, please open an issue.

E-mail: oldrev(at)gmail.com

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for more details.

Copyright © Li Wei and other contributors. All rights reserved.

Footnotes

  1. Rust's Tokio async functions cannot call into dynamic libraries, so currently, we can only use statically linked plugins. I will evaluate the possibility of adding plugins based on WebAssembly (WASM) or JavaScript (JS) in the future.

About

A based flow programming runtime engine, compatible with Node-RED, in Rust.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages