VS Code Extension Guide
The n8n-as-code VS Code Extension transforms VS Code into a powerful IDE for your n8n workflows. It provides visual editing, real-time synchronization, and workflow validation.
đ¨ Featuresâ
đ Native Synchronizationâ
The extension synchronizes your modifications in real-time. By default, every JSON file save (Ctrl+S) instantly sends changes to your n8n instance when auto-sync is enabled.
đī¸ Multi-Instance Supportâ
Your workflows are automatically organized by instance to avoid mixing files from different environments:
workflows/instance_name_user/my_workflow.json
đ¯ Visual Status Indicatorsâ
The tree view displays color-coded icons showing the sync status of each workflow at a glance:
- â
Green sync icon -
IN_SYNC: Workflow is synchronized between local and remote - đ Orange pencil -
MODIFIED_LOCALLY: Local changes not yet pushed - âī¸ Orange cloud -
MODIFIED_REMOTELY: Remote changes not yet pulled - đ Orange file -
EXIST_ONLY_LOCALLY: New local workflow not yet pushed - âī¸ Orange cloud -
EXIST_ONLY_REMOTELY: New remote workflow not yet pulled - đ´ Red alert -
CONFLICT: Both local and remote modified since last sync - đī¸ Grey trash -
DELETED_LOCALLY/DELETED_REMOTELY: Workflow deleted on one side
đĄī¸ Persistent Conflict Resolution UIâ
Workflows in conflict or deleted states become expandable tree items with child action buttons, ensuring you never lose track of issues that need resolution:
For Conflicts:
- đ Show Diff - Opens a side-by-side diff view comparing local and remote versions
- â Keep Local Version - Force push local changes to remote (overwrite remote)
- âī¸ Keep Remote Version - Force pull remote changes to local (overwrite local)
For Deletions:
- đī¸ Confirm Remote Deletion - Delete the workflow from n8n
- âŠī¸ Restore File - Restore the local file from remote
These actions remain visible in the tree until resolved, preventing conflicts from being forgotten or lost.
đ ī¸ Built-in Validation & Snippetsâ
Your environment is automatically configured with validation and snippets upon opening:
- JSON Validation: n8n schema applied for input assistance and live error detection
- Snippet Library: Ready-to-use node templates (
node:webhook,node:code, etc.)
đą Split Viewâ
Visualize the n8n canvas in real-time using the integrated Webview while editing the JSON code. This is the ideal interface for visually validating your structural changes.
âī¸ Installationâ
From VS Code Marketplaceâ
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "n8n-as-code"
- Click Install
From VSIX Fileâ
- Download the
.vsixfile from releases - In VS Code, go to Extensions
- Click "..." menu and select "Install from VSIX"
- Select the downloaded file
đ§ Configurationâ
Initial Setupâ
- Open VS Code Settings (File > Preferences > Settings or Ctrl+,)
- Search for "n8n"
- Configure the following settings:
n8n.host: URL of your n8n instance (e.g.,https://n8n.yourdomain.com)n8n.apiKey: Your n8n API key (found in n8n Settings > API)n8n.syncFolder: Local storage folder (default:workflows)n8n.syncMode: Sync mode (autoormanual)n8n.pollInterval: Polling interval in milliseconds (default: 3000)
Settings Referenceâ
| Parameter | Description | Default |
|---|---|---|
n8n.host | URL of your n8n instance | - |
n8n.apiKey | Your n8n API Key | - |
n8n.syncFolder | Local storage folder | workflows |
n8n.syncMode | Sync mode: auto (watch mode) or manual | auto |
n8n.pollInterval | Polling interval for auto mode (ms) | 3000 |
đ Usageâ
Connecting to n8nâ
The extension automatically connects to n8n when:
- You have configured
n8n.hostandn8n.apiKeyin settings - You open a workspace with the extension
- The extension validates the connection automatically
If connection fails, check the Output panel (View > Output, select "n8n-as-code") for error details.
Pulling Workflowsâ
- Click the refresh button in the n8n panel
- All workflows will be downloaded to your local
workflowsdirectory - Workflows are organized by instance
Editing Workflowsâ
- Click a workflow in the tree view to open the JSON editor
- For split view with canvas preview:
- Click "Open Workspace" action button
- Or use the context menu option
- The split view shows:
- Left: JSON editor
- Right: n8n canvas preview
- Make changes in the JSON editor
- Save (
Ctrl+S) to sync to n8n (when auto-sync is enabled)
Creating New Workflowsâ
To create a new workflow:
- Create a new JSON file in your workflows directory
- Use the n8n schema for structure guidance
- The extension will detect the new file and sync it to n8n automatically
Resolving Conflictsâ
When a workflow has a conflict (both local and remote modified):
- The workflow appears with a đ´ red alert icon in the tree
- Expand the workflow to see resolution actions:
- đ Show Diff - View differences between versions
- â Keep Local Version - Push your local changes
- âī¸ Keep Remote Version - Pull remote changes
- Click the desired action to resolve
- The workflow returns to normal sync state
Handling Deletionsâ
When a workflow is deleted locally or remotely:
- The workflow appears with a đī¸ grey trash icon in the tree
- Expand the workflow to see actions:
- đī¸ Confirm Remote Deletion - Delete from n8n
- âŠī¸ Restore File - Restore the local file
- Choose an action to resolve the deletion state
đ Sync Behaviorâ
Auto Sync (Default)â
- Changes are automatically pushed to n8n on save
- Remote changes are automatically pulled
- Conflicts require manual resolution
- Best for most use cases
Manual Syncâ
- Changes are only synced when you manually trigger sync actions
- Gives you more control over when changes are pushed
- Use the action buttons in the tree view for manual operations
3-Way Merge Detectionâ
The extension uses a sophisticated 3-way merge algorithm to detect conflicts:
- Tracks the base state (last synced version) in
.n8n-state.json - Compares local version (file on disk)
- Compares remote version (workflow in n8n)
- Only flags as conflict when both local AND remote have changed since the base
- This prevents false positive conflicts and enables deterministic sync behavior
đ¤ AI Agent Supportâ
Context Generation for AI Assistantsâ
The extension works with the CLI to generate context files that empower AI coding assistants:
AGENTS.md: Instructions for AI assistants on n8n workflow development.vscode/n8n.code-snippets: Code snippets for autocomplete (generated from n8n-nodes-index.json).vscode/n8n.code-snippets: Code snippets for common n8n node patterns
How AI Assistants Leverage These Filesâ
AI coding assistants (like Cursor, Copilot, Claude, etc.) can use these generated files to:
- Understand n8n workflow structure and best practices
- Provide accurate code suggestions based on node schemas
- Validate workflow JSON against the n8n schema
- Generate common node patterns using pre-built snippets
đ¯ Tips & Best Practicesâ
Workflow Organizationâ
- Use folders in n8n to organize workflows
- The extension mirrors the folder structure locally
- Keep related workflows together
Version Controlâ
- Commit workflow JSON files to Git
- Use meaningful commit messages
- Review changes using Git diff
Backup Strategyâ
- Regular commits to Git
- Export workflows from n8n as backup
- Use the extension's sync as primary backup
đ¨ Troubleshootingâ
Common Issuesâ
Extension not connecting
- Check n8n URL and API key
- Verify n8n instance is accessible
- Check network connectivity
Sync not working
- Check if auto-sync is enabled in settings
- Verify file permissions
- Check network connectivity
Canvas not loading
- Check n8n URL is correct
- Verify API key has proper permissions
- Try refreshing the webview
Getting Helpâ
- Check the Troubleshooting guide
- Search existing issues
- Ask in GitHub Discussions
đ Next Stepsâ
- CLI Guide: Learn about command-line automation
- Contribution Guide: Understand the architecture
- API Reference: Developer documentation
The VS Code Extension provides the best user experience for editing n8n workflows with real-time synchronization and visual feedback.