# How can I obfuscate the codes written in function node?

**URL:** https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624
**Category:** General
**Created:** [2 February 2023 20:41 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624 "2023-02-02T20:41:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)
#### Post date: [2 February 2023 20:41 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624/1 "2023-02-02T20:41:38Z")

</div>

Hi Forum,  
Is there a way to obfuscate the codes written in function nodes suppose if I want to deploy my flows to the client side?

---

<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: [2 February 2023 20:48 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624/2 "2023-02-02T20:48:21Z")

</div>

I don't think there is any really strong way of doing this in JavaScript. You could move the code to a module and run that through a good compressor which would certainly make it harder to easily read but there are plenty of tools that will make such code at least partially readable again.

The only strong way to hide your code is to put it on your own server and make it available via an API.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [3 February 2023 06:22 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624/3 "2023-02-03T06:22:56Z")

</div>

There is a javascript-obfuscator npm package for making your code somewhat unreadable/confusing

here is an online version:

> **[JavaScript Obfuscator Tool](https://obfuscator.io)**
>
> JavaScript Obfuscator is a free online tool that obfuscates your source code, preventing it from being stolen and used without permission.

---

<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: [3 February 2023 10:26 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624/4 "2023-02-03T10:26:10Z")

</div>

Just note that it most certainly does not "prevent". That is not possible for a scripting language (and almost certainly not for any other either). It just makes it harder. But it also makes the code less efficient.

---

<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: [4 April 2023 10:26 UTC](https://discourse.nodered.org/t/how-can-i-obfuscate-the-codes-written-in-function-node/74624/5 "2023-04-04T10:26:50Z")

</div>

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