Build n8n workflows with TypeScript code

I’m used to deploy with aws-cdk, terraform or cdktf. So when I have to create workflow using my mouse it’s not very pleasant.

I looked on google and there was no tool for it, so I build it.

GitHub - Vahor/n8n-kit: Generate and deploy n8n workflows using code.

With this you can now create workflow using typescript code (every node properties are typed), build to json, deploy directly to your n8n instance. And check if there are diff between your code and what is currently deployed.

That was my week-end project so it’s currently in alpha, but it works. I made multiple examples to tests it and so far I’m very happy with it.

As it’s using env var + config file you can easily deploy a workflow in different environment (prod, preprod). And as it’s just code, it’s easy to revert and deploy and older version.

Let me know what you think :+1:t2:

2 Likes

Since the last update, I’ve added several options to make it easier for people to get started with the library.

The CLI now includes an import tool that can generate TypeScript code compatible with the library from an existing n8n workflow. It’s fully tested and produces usable code for almost all of my examples. The few cases where it didn’t work were only due to minor import issues.

There’s now a –watch flag to build and deploy to n8n while you are writing the code to see the result without leaving the ide (still have to refresh the n8n page manually)

And a diff command to compare your existing code to a n8n version, so that if you want to make sure everything is up-to-date or if you did manual changes and want to see what needs to changes in your code. That command will help.

Plus a lot of bug fixes

1 Like

Excited to try this out, good work.