# Which folder structure do you think is best for authoring node libraries?

**URL:** <https://discourse.nodered.org/t/which-folder-structure-do-you-think-is-best-for-authoring-node-libraries/97082>\
**Category:** Developing Nodes\
**Created:** [15 May 2025 17:04 UTC](https://discourse.nodered.org/t/which-folder-structure-do-you-think-is-best-for-authoring-node-libraries/97082 "2025-05-15T17:04:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [15 May 2025 17:04 UTC](https://discourse.nodered.org/t/which-folder-structure-do-you-think-is-best-for-authoring-node-libraries/97082/1 "2025-05-15T17:04:47Z")

</div>

Do you have suggestions? This is the folder structure I defined

```bash
.
├── examples // NOTE: flow examples/
│ └── test.json
├── public // NOTE: public assets served at "resources/<package-name>/"/
│ └── vue.png
├── src/
│ ├── nodes/
│ │ └── {node-type}/
│ │ ├── client/
│ │ │ ├── locales/
│ │ │ │ ├── labels/
│ │ │ │ │ ├── en-US.json
│ │ │ │ │ └── de.json
│ │ │ │ └── docs/
│ │ │ │ ├── en-US.html
│ │ │ │ └── de.md
│ │ │ ├── icons/
│ │ │ │ └── vue.png
│ │ │ ├── Form.vue
│ │ │ └── index.js
│ │ └── server/
│ │ └── index.js
│ ├── index.client.ts // OPTIONAL -> if not provided, the cli creates it
│ └── index.server.ts // OPTIONAL -> if not provided, the cli creates it
└── package.json

```

I decided to group by node-type for the following reasons:

- use the folder name as a single source of truth for defining the node type at build time.
- enable node distribution separately. Each node can be built, packed and published separately.

The result distro is as follows

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f308f114e242414a3bd09b08b1e85aa589cc2eac.png)

All files from the "public" folder is added to "dist/resources".

"dist/index.html" is generated at build time.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b16a8910175e425383b3e8a49f44c67c7a7c56b.png)

"dist/locales/{language}" is generated after combining each node type locales. Labels are namespaced by the {node-type}.

Assets you import in your client modules are bundled together if a "Loader" for its mime type is configured in vite. For example, one of my nodes imported an image and used it on its Form.vue

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/465a275fe017093e619a45aca7f76bbe2ab96544.png)

As you can see in the image above, you can also use assets from the "public" folder by just using "/" followed by the name of the file. These assets are not bundled and they will be copied to "dist/resources".

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [16 May 2025 21:29 UTC](https://discourse.nodered.org/t/which-folder-structure-do-you-think-is-best-for-authoring-node-libraries/97082/2 "2025-05-16T21:29:26Z")

</div>

I redesigned the folder structure due to the way tsconfig files work. The repo is now a template

> **[GitHub - AllanOricil/node-red-vue-template: Write Node-RED nodes using Vue and Typescript](https://github.com/AllanOricil/node-red-vue-template)**
>
> Write Node-RED nodes using Vue and Typescript

Instructions to test are included

---

<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:** [15 July 2025 21:30 UTC](https://discourse.nodered.org/t/which-folder-structure-do-you-think-is-best-for-authoring-node-libraries/97082/3 "2025-07-15T21:30:33Z")

</div>

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