Skip to main content

GitOps CLI for n8n Community Edition

Project description


sidebar_key: n8n-gitops tags: [docker, devops, cli]

n8n-gitops

A GitOps CLI tool for n8n Community Edition that brings version control and collaborative workflow development to n8n.

Sponsor Opensource ByJG Build Status GitHub source GitHub license GitHub release

n8n is a fair-code workflow automation platform (like Zapier/Make.com but self-hosted) that connects 400+ services and apps. n8n-gitops adds the Git integration that's missing from the Community Edition.

Features

  • ๐Ÿ”„ Mirror Mode Export: Always keeps local repository in perfect sync with n8n
  • ๐Ÿ“ฆ Code Externalization: Store Python/JavaScript code in separate files
  • ๐Ÿ”‘ Credential Documentation: Auto-generate documentation of workflow credential dependencies
  • ๐Ÿท๏ธ Git-Based Deployment: Deploy specific tags/branches/commits
  • โœ… Validation: Validate workflows and manifests before deployment
  • ๐Ÿ”Œ Active State Management: Control workflow activation via API endpoints
  • ๐Ÿงน Clean Deployments: Replace workflows with clean state

Logo

Quick Start

# Install from PyPI
pip install n8n-gitops

# Or install with uv (faster)
uv pip install n8n-gitops

# Create project
n8n-gitops create-project my-n8n-project
cd my-n8n-project

# Configure authentication
n8n-gitops configure --config dev \
  --api-url https://your-n8n-instance.com \
  --api-key your-api-key-here

# Export workflows
n8n-gitops export

# Commit to Git
git init
git add .
git commit -m "Initial export"
git tag v1.0.0

# Deploy
n8n-gitops deploy --git-ref v1.0.0

Core Guides

Key Concepts

Mirror Mode

Export always mirrors your n8n instance:

n8n-gitops export
  • โœ… Exports ALL workflows
  • ๐Ÿ—‘๏ธ Deletes local workflows not in n8n
  • ๐Ÿ—‘๏ธ Deletes orphaned script files
  • ๐Ÿ“ Updates manifest to match remote

Code Externalization

Store code in separate files instead of inline JSON (controlled by externalize_code in n8n/manifests/workflows.yaml, default: true):

Workflow JSON:

{
  "parameters": {
    "pythonCode": "@@n8n-gitops:include scripts/my-workflow/process.py"
  }
}

Script File:

def process(data):
    return data.upper()

result = process(input)

Git-Based Deployment

Deploy from any Git reference:

# Deploy from tag
n8n-gitops deploy --git-ref v1.0.0

# Deploy from branch
n8n-gitops deploy --git-ref main

# Deploy from commit
n8n-gitops deploy --git-ref abc123

Commands

# Create project structure
n8n-gitops create-project <path>

# Export workflows (mirror mode)
n8n-gitops export

# Validate workflows
n8n-gitops validate [--strict]

# Deploy workflows
n8n-gitops deploy [--git-ref REF] [--dry-run] [--backup] [--prune]

# Rollback to previous version
n8n-gitops rollback --git-ref <ref>

See Commands Reference for complete documentation.

Example Workflow

# 1. Export from n8n
n8n-gitops export

# 2. Edit scripts
vim n8n/scripts/payment-processing/validate.py

# 3. Validate changes
n8n-gitops validate --strict

# 4. Commit to Git
git add .
git commit -m "Improve payment validation"
git tag v1.1.0

# 5. Deploy
n8n-gitops deploy --git-ref v1.1.0

Project Structure

my-n8n-project/
โ”œโ”€โ”€ n8n/
โ”‚   โ”œโ”€โ”€ workflows/           # Workflow JSON files
โ”‚   โ”œโ”€โ”€ scripts/             # Externalized code
โ”‚   โ”‚   โ””โ”€โ”€ my-workflow/
โ”‚   โ”‚       โ”œโ”€โ”€ process.py
โ”‚   โ”‚       โ””โ”€โ”€ transform.js
โ”‚   โ”œโ”€โ”€ credentials.yaml     # Credential documentation (auto-generated)
โ”‚   โ””โ”€โ”€ manifests/
โ”‚       โ”œโ”€โ”€ workflows.yaml   # Workflow manifest
โ”‚       โ””โ”€โ”€ env.schema.json  # Environment schema
โ””โ”€โ”€ .gitignore

Development

# Clone the repository
git clone https://github.com/n8n-gitops/n8n-gitops.git
cd n8n-gitops

# Install with uv (recommended)
uv sync --dev

# Or with pip
pip install -e ".[dev]"

# Run tests
uv run pytest -v  # with uv
# or
pytest -v  # with pip

Requirements

  • Python 3.10+
  • Git
  • n8n instance with API access

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

n8n_gitops-0.3.3.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

n8n_gitops-0.3.3-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file n8n_gitops-0.3.3.tar.gz.

File metadata

  • Download URL: n8n_gitops-0.3.3.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for n8n_gitops-0.3.3.tar.gz
Algorithm Hash digest
SHA256 8d47536120c959f5022c9b736bfa0c9bb15412e850a0a7b21dbac92bcccbdda0
MD5 76c25a09765bd1afaf65b92693680e10
BLAKE2b-256 3613e8057b81ef11df3fa9d4f9794e60d47861a8edc6046e392999b790e993ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for n8n_gitops-0.3.3.tar.gz:

Publisher: build.yml on n8n-gitops/n8n-gitops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file n8n_gitops-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: n8n_gitops-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for n8n_gitops-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4c623afc14ba5d4e285a7bf37096ce2e3123010017fe3dee2540f40c0d4f1abf
MD5 1f3b27e54707ecd7ea6f0cd35b9f23eb
BLAKE2b-256 8115bb59241815faeee6dbb5c6d44a1aa9464487122814ad0ddf4e6ade536e15

See more details on using hashes here.

Provenance

The following attestation bundles were made for n8n_gitops-0.3.3-py3-none-any.whl:

Publisher: build.yml on n8n-gitops/n8n-gitops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page