# Creating your own nodes for Node-RED

**URL:** <https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195>\
**Category:** Developing Nodes\
**Created:** [15 January 2021 19:07 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195 "2021-01-15T19:07:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discourse.nodered.org/u/Mas)\
**Post date:** [15 January 2021 19:07 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/1 "2021-01-15T19:07:23Z")

</div>

Hi, I am new to using Node-red. I need to create my own node in node-red. could you please help me to do this?  
Regards

---

<div class="post-metadata">

**Author:** ![fellinga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fellinga/32/30631_2.png) [@fellinga](https://discourse.nodered.org/u/fellinga)\
**Post date:** [15 January 2021 19:09 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/2 "2021-01-15T19:09:57Z")

</div>

There is a documentation available here: [Creating your first node : Node-RED](https://nodered.org/docs/creating-nodes/first-node)

Do you need to know something specific?

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [15 January 2021 19:40 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/3 "2021-01-15T19:40:36Z")

</div>

> [@fellinga](#):
>
> documentation available here

Once you have `node-red-contrib-example-lower-case` running, the Node-RED source code on GitHub and the contributed nodes in the Flow Library offer lots of examples, some more advanced than others.

---

<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:** [15 January 2021 20:24 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/4 "2021-01-15T20:24:17Z")

</div>

THe first question to be asked is - why?

Have you thought through the issue and looked through the existing nodes?

You are launching straight into the deep end and often a new node isn't actually needed. Maybe share a bit more about what you are trying to achieve and people might be able to find an easier route.

If you do need to go down that route, how are your JavaScript, HTML and Node.js skills because you will need some of each to write a node well.

---

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discourse.nodered.org/u/Mas)\
**Post date:** [19 January 2021 10:53 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/5 "2021-01-19T10:53:23Z")

</div>

Thanks for the replies.  
Actually, I need to make a node to control my device which a smart plug.

I have done the steps in this link [Creating your first node : Node-RED](https://nodered.org/docs/creating-nodes/first-node)

But could you please help me in the last step which is "Publishing to npm"

---

<div class="post-metadata">

**Author:** ![fellinga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fellinga/32/30631_2.png) [@fellinga](https://discourse.nodered.org/u/fellinga)\
**Post date:** [19 January 2021 11:07 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/6 "2021-01-19T11:07:48Z")

</div>

You need to open the console in your nodes root folder and run `npm publish`. It will probably complain that you haven't set up npm on your computer and will give you more details on what you have to do. You definitely need a [npmjs.com](http://npmjs.com) account and an access token that you can generate in your profile.

---

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discourse.nodered.org/u/Mas)\
**Post date:** [19 January 2021 11:43 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/7 "2021-01-19T11:43:18Z")

</div>

> [@fellinga](#):
>
> nodes root folder

Thanks, it did not give me more details on what I have to do. could you please tell me those steps to set up npm?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 January 2021 11:52 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/8 "2021-01-19T11:52:40Z")

</div>

> [@Mas](#):
>
> I need to make a node to control my device which a smart plug.

What sort of smart plug is it?

---

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discourse.nodered.org/u/Mas)\
**Post date:** [19 January 2021 17:06 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/9 "2021-01-19T17:06:25Z")

</div>

I do not have it yet. What I need to do is to turn on/off the device when its node got input on/off.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 January 2021 19:33 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/10 "2021-01-19T19:33:34Z")

</div>

If you have not got it yet how do know whether there is already a node that accesses it? Almost every such device that can be used in this way already had a node available. Also, how have you written a node if you don't know how to access it?

---

<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:** [20 March 2021 19:33 UTC](https://discourse.nodered.org/t/creating-your-own-nodes-for-node-red/39195/11 "2021-03-20T19:33:49Z")

</div>

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