Lesson 23 / 25

Managing Workflows Like Code

Export, version and monitor workflows, and split big ones into sub-workflows.

Treat workflows as assets

Workflows export as JSON, so keep them in Git (credentials are not included in exports) and review changes like code. Break big workflows into sub-workflows called with the Execute Workflow node, so pieces can be tested and reused. Name nodes clearly ("Fetch new orders", not "HTTP Request 3"), add sticky notes for intent, and use separate instances or projects for development and production. Watch the Executions list and set up the error workflow so failures are noticed.

Export and import from the CLI

The n8n CLI can export workflows to files for Git and import them elsewhere. Flags can change between versions; run n8n export:workflow --help to confirm.

n8n export:workflow --all --separate --output=./workflows/
n8n import:workflow --separate --input=./workflows/

Quick check: Why split a large workflow into sub-workflows?

  • Smaller parts are easier to test, reuse and understand
  • n8n limits workflows to 3 nodes
  • Sub-workflows are always faster
  • It removes the need for names
Answer

Smaller parts are easier to test, reuse and understand — Modular workflows are maintainable, like functions in code.