[Announce] Svelte-Integration-RED (SIR) allows node-editors based on Svelte templates

Hello everyone,

SIR is here to help you creating node editors more easily. If you ever struggled with the HTML part of a node's editor and with all the jQuery stuff, you may want to take a closer look at SIR:

SIR integrates Svelte into Node-RED and allows to write the editor-part of your node using Svelte templates. Svelte itself is thereby only needed during development - anyone using your node will only use the generated HTML file.

Especially for editors that change dynamically or that have computed properties, life gets a lot easier. Or if you want to extract parts of your editor as reusable components: SIR will take care of it.

Creating an input and binding it's value to your node's property is as easy as this:

<script context="module">
	RED.nodes.registerType("test-node", {
		// Node definitions like category, inputs, outputs, color, label, etc. go here as always
		defaults: {
			name: { value: "", label: "Name" } // Set the label of your property directly in the defaults
		// Some boilerplate that is needed to handle the editor lifecycle.
		// Anyway, you won't have to deal with anything else here: everything dynamic
		// is done directly in the Svelte template.
		oneditprepare: function () {
		oneditsave: function () {
		oneditcancel: function () {

	export let node
	// Import the components you need.
	// Many more are available like EditableList, TypedInput, Group, Collapsible, etc.
	import { Input } from 'svelte-integration-red/components'

<!-- Adding an input is as easy as that: -->
<Input bind:node prop="name" />
<!-- That's it. Everything else is handled by SIR. -->

The documentation part is done in an extra file with a .doc.html extension. This separation of concerns helps maintaining a neat project structure.

A simple sir from within your project's root directory now starts the compilation process and you will get an .html file that conforms to Node-RED's specification.

Interested? Take a look at the project's home page on Gitlab for more details.

Warning: SIR is still a work in progress. It is already basically usable, but things may change unexpectedly. Furthermore important things like i8n-support or validation are not yet implemented. Feel free to play with it and if you like it, keep an eye on the project: The missing parts will sooner or later arrive.

I hope you like SIR. Feedback is welcome.



An exciting project! I look forward to seeing it progress.

Certainly I personally find creating the html file rather painful so if this can make it a better experience, then great. :grinning_face_with_smiling_eyes:

I will try to use this next time I need to create a cusom node.

I'm also interested in how I might work with Svelte and uibuilder. Obviously Svelte is a compiler based tool so still a little way to go. However, I'm just adding selectable templates to uibuilder which should pave the way for a more flexible approach to structuring the source code. It also opens another item on the roadmap which is a build button which will use an appropriate package.json script to actually do the work.

First though, I need to make the template copy a bit more flexible which I'd been meaning to do anyway. At the moment, only the src folder is updated, I'll change that to a wider copy so that the template could, for instance, have a svelte example project.

Exciting stuff - however, I'm rambling. All the best with this project.

1 Like

Hi Julian,

thanks! :slight_smile: The compiler approach of Svelte is great though it makes things a bit more complicated for frameworks like uibuilder. Anyway, you could think of an automatic build as soon as a Svelte template gets copied over. In that case frameworks like rollup or snowpack could be very helpful. The latter is what I want to build upon with the next release of pekfinger-RED.

BTW: Pekfinger-RED is the reason I started SIR. The editor part was a hell to maintain. The rewrite is now well underway and it will feature a complex and dynamic editor that allows to define hierarchical templates:

I hope I can publish it soon, though quite a lot of work remains as it is more or less a complete rewrite of the current version.

But now I am rumbling. :grinning_face_with_smiling_eyes: Good luck with uibuilder - it's a great project and I would love to see support for Svelte there. :+1:

1 Like

Definitely interesting and I'll keep an eye out for more releases.

I've managed to up the cadence on uibuilder releases (like yourself, getting v3 out the door took a LOOOONG time but once done it paved the way for many more). Indeed, v3.2 should be published tomorrow with a few nice additions.

Having a quick play with svelte and I've already managed to change the config to output to dist instead of public and realised that I can simply publish a template to GitHub that can be installed as easily as their own default template but into the appropriate uibuilder instance folder! Wow :grin:

A compiled framework that "just works", out-of-the-box. And doesn't require a CLI module just to get things working. Double Wow.

And that doesn't require more code in the build config than in your actual front-end code. Triple Wow!

I can already see how I can extend the template so that the dev server will work with uibuilder as well. Should be fun.

The new event handler in uibuilder v3.2 should work very nicely with svelte as well.

Ho, hum, another rabbit hole to go down :grin:

How cool ist that?!! :grin: Looking forward to uibuilder 3.2 then.

Well - no more looking forward i guess. Just saw that you already released the new version. :+1: Great to see!

1 Like

Thanks, did you see my Svelte and uibuilder post as well? It went even better than expected and I particularly like the fact that, in development mode, the browser reload is built into the front end. That means that whenever the dev build service detects a change and rebuilds, even the uibuilder version of the page reloads itself!

You can also attach the uibuilder.sendEvent function directly to a Svelte event attribute in your HTML and it "just works"!

I also discovered degit along the way thanks to Svelte and I'm going to integrate that I think so that you will be able to install an external template direct to the correct uibuilder folder from within the uibuilder config panel. That should be great for anyone wanting to publish a uibuilder-based front-end template regardless of the framework.

This did prompt me to add yet more to the backlog though! And I discovered that the way I've implemented the choice between service from the dist or src folders leaves a lot to be desired and I'll need to re-engineer that. If you are interested, I'm maintaining the backlog and progress in a GitHub project To Do (github.com).

1 Like

Actually I didn't - things are going crazy here due to some worldwide shortage of raw materials resulting in massive delivery problems for the products we sell. And unfortunately this also means that I have less time for interesting things like Node-RED and uibuilder. :pensive:

Your progress on Svelte within uibuilder is fascinating - I will definitely take a closer look at it as soon as things are cooling down a bit. I will also take a look at the projects TODO then.

1 Like

Yes, it is very annoying when reality gets in the way of our creative fun! :rofl:

I had a week off last week so had more time - though my wife insisted on us getting out for walks each day. :slight_smile:

Hope you manage to sort out your supply chain. Things are somewhat hit and miss here in the UK of course though that is mainly the fault of people deciding that we would be better off without our primary trading partner! Sheesh, what did they think would happen? :scream:

1 Like