# dungssj/n8n-clone architecture

> Architecture diagram of the GitHub repository dungssj/n8n-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dungssj/n8n-clone
- Repository: https://github.com/dungssj/n8n-clone

## Overview

n8n is a self-hostable visual workflow-automation platform with integrations and native LangChain-based AI. The main user journey is to build or import a workflow in the editor, save it through the workflow API, and run it; workflows can use triggers, integration nodes, code, and AI components. The graph includes execution, binary-data storage, and OAuth as supporting layers. Several subsystems are represented from the README and source index rather than inspected implementation, so their connections are limited to documented relationships.

Main entry points: [`packages/cli/src/workflows/workflow-execution.service.ts`](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflow-execution.service.ts) (Execution service), [`packages/cli/src/workflows/workflows.controller.ts`](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflows.controller.ts) (Workflow API), [`packages/editor-ui/src/App.vue`](https://github.com/dungssj/n8n-clone/blob/master/packages/editor-ui/src/App.vue) (Workflow editor), [`packages/nodes-base`](https://github.com/dungssj/n8n-clone/tree/master/packages/nodes-base) (Integration nodes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Workflow authoring"]
  node_editor["Workflow editor<br/>[App.vue]"]
  node_workflow_api["Workflow API"]
  node_workflow_service["Workflow service"]
  node_execution_api["Manual run API"]
end

subgraph group_runtime["Workflow runtime"]
  node_execution_service["Execution service"]
  node_active_workflows["Active workflows"]
  node_node_context["Node execution context"]
  node_webhook_context["Webhook context<br/>[webhook-context.ts]"]
  node_scheduled_tasks["Scheduled tasks"]
end

subgraph group_capabilities["Workflow capabilities"]
  node_integrations["Integration nodes"]
  node_ai_nodes["LangChain nodes"]
  node_chat_trigger["Chat triggers"]
  node_custom_code["Code node<br/>[Code.node.ts]"]
end

subgraph group_platform["Platform services"]
  node_binary_files[("Binary data")]
  node_oauth["OAuth client<br/>[ClientOAuth2.ts]"]
  node_workflow_db[("Workflow database<br/>[db.ts]")]
end

node_user(("Technical team"))
node_external_services{{"External services"}}

node_user -->|"builds workflows"| node_editor
node_editor -.->|"saves workflows"| node_workflow_api
node_workflow_api -->|"manages workflows"| node_workflow_service
node_workflow_api -->|"persists workflows"| node_workflow_db
node_user -->|"runs workflow"| node_execution_api
node_execution_api -->|"dispatches run"| node_execution_service
node_execution_service -.->|"coordinates"| node_active_workflows
node_execution_service -.->|"executes nodes"| node_node_context
node_webhook_context -->|"extends"| node_node_context
node_execution_service -.->|"runs integration nodes"| node_integrations
node_execution_service -.->|"runs AI nodes"| node_ai_nodes
node_execution_service -.->|"runs code"| node_custom_code
node_execution_service -.->|"uses schedules"| node_scheduled_tasks
node_chat_trigger -.->|"serves chat"| node_external_services
node_integrations -->|"connects services"| node_external_services
node_ai_nodes -->|"uses models"| node_external_services
node_oauth -.->|"authenticates requests"| node_external_services
node_execution_service -.->|"stores binary data"| node_binary_files

click node_editor "https://github.com/dungssj/n8n-clone/blob/master/packages/editor-ui/src/App.vue"
click node_workflow_api "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflows.controller.ts"
click node_workflow_service "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflow.service.ts"
click node_execution_api "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflows.controller.ts"
click node_execution_service "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflow-execution.service.ts"
click node_active_workflows "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/active-workflow-manager.ts"
click node_node_context "https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/node-execution-context/node-execution-context.ts"
click node_webhook_context "https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/node-execution-context/webhook-context.ts"
click node_scheduled_tasks "https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/scheduled-task-manager.ts"
click node_integrations "https://github.com/dungssj/n8n-clone/tree/master/packages/nodes-base"
click node_ai_nodes "https://github.com/dungssj/n8n-clone/tree/master/packages/%40n8n/nodes-langchain"
click node_chat_trigger "https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/nodes-langchain/nodes/trigger/ChatTrigger/ChatTrigger.node.ts"
click node_custom_code "https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/nodes-langchain/nodes/code/Code.node.ts"
click node_binary_files "https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/binary-data/file-system.manager.ts"
click node_oauth "https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/client-oauth2/src/ClientOAuth2.ts"
click node_workflow_db "https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/db.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_editor,node_workflow_api,node_workflow_service,node_execution_api toneBlue
class node_execution_service,node_active_workflows,node_node_context,node_webhook_context,node_scheduled_tasks toneAmber
class node_integrations,node_ai_nodes,node_chat_trigger,node_custom_code toneMint
class node_binary_files,node_oauth,node_workflow_db toneRose
class node_user,node_external_services toneIndigo
```

## Components

### Workflow authoring

- [Workflow editor](https://github.com/dungssj/n8n-clone/blob/master/packages/editor-ui/src/App.vue): `packages/editor-ui/src/App.vue`
- [Workflow API](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflows.controller.ts): `packages/cli/src/workflows/workflows.controller.ts`
- [Workflow service](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflow.service.ts): `packages/cli/src/workflows/workflow.service.ts`
- [Manual run API](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflows.controller.ts): `packages/cli/src/workflows/workflows.controller.ts`

### Workflow runtime

- [Execution service](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/workflows/workflow-execution.service.ts): `packages/cli/src/workflows/workflow-execution.service.ts`
- [Active workflows](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/active-workflow-manager.ts): `packages/cli/src/active-workflow-manager.ts`
- [Node execution context](https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/node-execution-context/node-execution-context.ts): `packages/core/src/execution-engine/node-execution-context/node-execution-context.ts`
- [Webhook context](https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/node-execution-context/webhook-context.ts): `packages/core/src/execution-engine/node-execution-context/webhook-context.ts`
- [Scheduled tasks](https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/execution-engine/scheduled-task-manager.ts): `packages/core/src/execution-engine/scheduled-task-manager.ts`

### Workflow capabilities

- [Integration nodes](https://github.com/dungssj/n8n-clone/tree/master/packages/nodes-base): `packages/nodes-base`
- [LangChain nodes](https://github.com/dungssj/n8n-clone/tree/master/packages/%40n8n/nodes-langchain): `packages/@n8n/nodes-langchain`
- [Chat triggers](https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/nodes-langchain/nodes/trigger/ChatTrigger/ChatTrigger.node.ts): `packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/ChatTrigger.node.ts`
- [Code node](https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/nodes-langchain/nodes/code/Code.node.ts): `packages/@n8n/nodes-langchain/nodes/code/Code.node.ts`

### Platform services

- [Binary data](https://github.com/dungssj/n8n-clone/blob/master/packages/core/src/binary-data/file-system.manager.ts): `packages/core/src/binary-data/file-system.manager.ts`
- [OAuth client](https://github.com/dungssj/n8n-clone/blob/master/packages/%40n8n/client-oauth2/src/ClientOAuth2.ts): `packages/@n8n/client-oauth2/src/ClientOAuth2.ts`
- [Workflow database](https://github.com/dungssj/n8n-clone/blob/master/packages/cli/src/db.ts): `packages/cli/src/db.ts`

### Other components

- **Technical team**
- **External services**

## Connections

- Technical team → Workflow editor: builds workflows (evidence: `README.md`)
- Workflow editor → Workflow API: saves workflows
- Workflow API → Workflow service: manages workflows (evidence: `packages/cli/src/workflows/workflows.controller.ts`)
- Workflow API → Workflow database: persists workflows (evidence: `packages/cli/src/workflows/workflows.controller.ts`)
- Technical team → Manual run API: runs workflow (evidence: `README.md`)
- Manual run API → Execution service: dispatches run (evidence: `packages/cli/src/workflows/workflows.controller.ts`)
- Execution service → Active workflows: coordinates
- Execution service → Node execution context: executes nodes
- Webhook context → Node execution context: extends (evidence: `packages/core/src/execution-engine/node-execution-context/webhook-context.ts`)
- Execution service → Integration nodes: runs integration nodes
- Execution service → LangChain nodes: runs AI nodes
- Execution service → Code node: runs code
- Execution service → Scheduled tasks: uses schedules
- Chat triggers → External services: serves chat
- Integration nodes → External services: connects services (evidence: `README.md`)
- LangChain nodes → External services: uses models (evidence: `README.md`)
- OAuth client → External services: authenticates requests
- Execution service → Binary data: stores binary data
