# @node-red/runtime.context/ how to set up multi-tennant-flows?

**URL:** <https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035>\
**Category:** General\
**Tags:** http-request, function-node\
**Created:** [16 March 2025 17:20 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035 "2025-03-16T17:20:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![papenfort](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@papenfort](https://discourse.nodered.org/u/papenfort)\
**Post date:** [16 March 2025 17:20 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/1 "2025-03-16T17:20:08Z")

</div>

Hello fellow Node Red enjoyers.

Im still rather new to this, so i barely know where to start...

Is it possible to configure multi-tennant flows by attaching a scoped repository( a special object that has methods for interacting with data, where the data-access is coupled to a user in some way) to a context(node/flow/global) in an elegant way? im kind of lost on how to do that without it being a total pain the ass to work with.

i dont want to prepend a middleware to node red just yet, as that would prohibed any nodes that may want to use the repository from working in any environment that ist set up like mine is.

help is apprechiated, i hope im just missing something right now.

for context, i plan on just creating a node right now that initializes the repository for now.

---

<div class="post-metadata">

**Author:** ![papenfort](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@papenfort](https://discourse.nodered.org/u/papenfort)\
**Post date:** [16 March 2025 19:49 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/2 "2025-03-16T19:49:35Z")

</div>

After some testing i found out that websocket-ins and http-ins provide message-properties. Namely **\_session** for **websockets** , where a session-id for the given websocket is stored as \_session inside the object and **req** for **httpins** , the request object( the one that the underlying express-instance provides), which allows to to get a session via tokens. however, this adds the need for middleware, so i wont get arround using middleware in order to support multi-tennancy with regards to consumers of the webservice.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [16 March 2025 20:43 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/3 "2025-03-16T20:43:15Z")

</div>

You can have the http response node send a http header ww-authenticate, this will mean the person has to log in, which you can use to identify them. I believe at that point you can set cookies etc in the response.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [16 March 2025 21:36 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/4 "2025-03-16T21:36:48Z")

</div>

The Node-RED runtime is not multi-tenant.

There is just 1 flow and it runs in the backend, which has no concept of the different users that can be defined for the editor (frontend).

If you want to run different flows for different users the only option is to run different instances of Node-RED.

Now if you are talking about multiple users interacting with a website hosted by Node-RED, either by using http-in/http-response nodes or the Node-RED Dashboard, that is a different thing.

The Node-RED Dashboard v2 supports multiple concurrent users and there are a number of plugins that support different authentication schemes, they are listed on the documentation page here:

> **[Building Multi-Tenant Dashboards | Node-RED Dashboard 2.0](https://dashboard.flowfuse.com/user/multi-tenancy.html)**
>
> Discover the features and benefits of Node-RED Dashboard 2.0, designed to streamline and enhance your Node-RED experience.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 March 2025 22:09 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/5 "2025-03-16T22:09:05Z")

</div>

> [@papenfort](#):
>
> Namely **\_session** for **websockets**

Note that websockets does not support custom headers. Therefore it is only possible to have session headers on the initial connection, not on websocket messages. This limits the usefulness of session headers for systems that have long-running websocket comms.

> [@hardillb](#):
>
> The Node-RED Dashboard v2 supports multiple concurrent users

As does UIBUILDER. 🙂 Dashboard2 and http-in/-response are not the only options.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 June 2025 22:09 UTC](https://discourse.nodered.org/t/node-red-runtime-context-how-to-set-up-multi-tennant-flows/96035/6 "2025-06-14T22:09:51Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
