# Proven workflow on developing code for the Code node

**URL:** <https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752>\
**Category:** Questions\
**Tags:** javascript, code\
**Created:** [December 13, 2022, 8:25pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752 "2022-12-13T20:25:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yavetal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/yavetal/32/12734_2.png) [@yavetal](https://community.n8n.io/u/yavetal)\
**Post date:** [December 13, 2022, 8:25pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/1 "2022-12-13T20:25:49Z")

</div>

Hi, i’m looking for a stable, proven way to work on the Code node - basically just writing some custom business logic for my workflow.

The first thing that comes to my mind is to save the input from the previous node (data i receive by the API), save it to the variable, set the dev env (e.g. Node.js), develop the logic itself, then copy the code and paste to the Code node. Meanwhile, i can ensure that outpt is more or less reasonable.

Another option may be is to create custom node (inherit the Code node and pre-fill its code with my logic?), but now sure if that is going to increase the development speed.

Any suggestions on it?

---

<div class="post-metadata">

**Author:** ![yavetal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/yavetal/32/12734_2.png) [@yavetal](https://community.n8n.io/u/yavetal)\
**Post date:** [December 14, 2022, 10:41pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/2 "2022-12-14T22:41:12Z")

</div>

After reading this article ( [Date and time with Luxon - n8n Documentation](https://docs.n8n.io/code-examples/expressions/luxon/) ) i thought that the basic node.js projct with Luxon and Jmespath libs should do the job (should i use more libs? probably would dig into n8n src some day).  
Plus template starter project with pre-create Input and Output variables, and the Code function itself, which can be  
a) tested easily in the VS Code  
b) copypasted directly to the Code node

Still, if you have better suggestions - please share.

---

<div class="post-metadata">

**Author:** ![BramKn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/bramkn/32/11894_2.png) [@BramKn](https://community.n8n.io/u/BramKn)\
**Post date:** [December 15, 2022, 4:23pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/3 "2022-12-15T16:23:35Z")

</div>

To be honest, I don’t get the issue.  
n8n is a low-code application. The code node is just there so you can easily put in small bits of code to your workflows.  
So in my opinion it does not make sense to move this to VS code or similar tools.  
Of course you do need to think about your development flow for n8n workflows, but no need to treat the code nodes separately.  
If you are doing a lot of development in the code node, you might want to see if n8n is the right tool for your use case.

Might be missing something here, but thats just my 2 cents. 🙂

---

<div class="post-metadata">

**Author:** ![yavetal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/yavetal/32/12734_2.png) [@yavetal](https://community.n8n.io/u/yavetal)\
**Post date:** [December 15, 2022, 8:36pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/4 "2022-12-15T20:36:48Z")

</div>

That’s a pretty valid point!

My idea behind that was to outsource js logic development, so the worker can simply set up the env and start working without too much headache learning n8n, entering creds, etc. Just “Hey, here’s input, i need that output, please implement”.

On the other hand, i really like n8n for its flexibility.  
I can definitely have API calls in the code - and skip using n8n at all - but, well, then I face all the issues with the common development process.

---

<div class="post-metadata">

**Author:** ![BramKn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/bramkn/32/11894_2.png) [@BramKn](https://community.n8n.io/u/BramKn)\
**Post date:** [December 16, 2022, 9:08am UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/5 "2022-12-16T09:08:11Z")

</div>

Than you are looking for a basic development flow using git.  
You can create something around that to get it into n8n, but all options will be a bit of a hassle.  
So better to just copy paste it in when something gets published on a certain git branch for example.

---

<div class="post-metadata">

**Author:** ![yavetal](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/yavetal/32/12734_2.png) [@yavetal](https://community.n8n.io/u/yavetal)\
**Post date:** [January 14, 2023, 7:08pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/6 "2023-01-14T19:08:32Z")

</div>

> [@\[n8n-workbench-code-node-runner\] Debug n8n Code Node with node.js](http://community.n8n.io/t/n8n-workbench-code-node-runner-debug-n8n-code-node-with-node-js/21836):
>
> I’m a mobile enterprise/game developer with lots of years of experience - but i’m pretty new to JS and nodejs. So this project works both as my practice of working with JS project, and it already helps me to deal with JS syntax and business logic via the debug. In short: it can run n8n Code node code slight_smile locally via nodejs, including debug feature. Project includes the same libs as n8n. It works fine for coding some small logic blocks.

Here’s the project i’ve made to fulfill my request, mentioned in the first message.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [January 21, 2023, 7:09pm UTC](https://community.n8n.io/t/proven-workflow-on-developing-code-for-the-code-node/20752/7 "2023-01-21T19:09:16Z")

</div>

Closed on January 21, 2023, 7:09pm UTC

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