# jamestrichmond/n8n architecture

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

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

## Overview

n8n is a visual workflow-automation platform with AI-agent capabilities, integrations, and self-hosted or cloud deployment. The principal journey is to design a workflow in the editor, configure its steps and connections, then run it to automate work across services; AI workflows add model, tool, and memory capabilities. The graph also includes app hosting and workflow-governance branches visible in the repository. Evidence is limited to the README, tree, and supplied excerpts/index, so unverified runtime links are omitted or marked dashed.

Main entry points: [`packages/@n8n/agents/src/runtime/loop/agent-runtime.ts`](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/loop/agent-runtime.ts) (Agent runtime), [`packages/@n8n/engine/src`](https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/engine/src) (Workflow engine), [`packages/modules/apps/backend/src/apps.service.ts`](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/apps.service.ts) (App lifecycle), [`packages/frontend/editor-ui/src`](https://github.com/jamestrichmond/n8n/tree/master/packages/frontend/editor-ui/src) (Workflow builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_design["Workflow design"]
  node_builder["Workflow builder"]
  node_nodecatalog["Node catalog search<br/>[search-engine.ts]"]
end

subgraph group_runtime["Execution runtime"]
  node_workflowengine["Workflow engine"]
  node_executionquery["Execution queries"]
  node_connectors["Service integrations"]
end

subgraph group_ai["AI capabilities"]
  node_agentruntime["Agent runtime<br/>[agent-runtime.ts]"]
  node_agenttools["Agent tools"]
  node_modelconnectors["Model providers<br/>[model-factory.ts]"]
  node_agentmemory["Agent memory"]
  node_guardrails["AI guardrails"]
  node_vectorstores["Vector stores"]
end

subgraph group_governance["Governance and apps"]
  node_appapi["App API<br/>[apps.controller.ts]"]
  node_appservice["App lifecycle<br/>[apps.service.ts]"]
  node_apprepository[("App persistence<br/>[app.repository.ts]")]
  node_appversions[("App versions")]
  node_apphosting["App hosting"]
  node_migrationservice["Breaking-change analysis"]
  node_migrationquery["Finding queries"]
  node_migrationregistry["Migration registry"]
  node_ruleregistry["Rule registry"]
  node_findingrepository[("Finding persistence")]
  node_workflowdependencies["Dependency analysis"]
  node_workflowreviews["Review authorization"]
end

node_user(("Workflow author"))
node_externalservices(("Connected services"))
node_modelproviders(("Model services"))

node_user -->|"designs"| node_builder
node_builder -.->|"searches nodes"| node_nodecatalog
node_builder -.->|"runs workflows"| node_workflowengine
node_workflowengine -.->|"executes steps"| node_connectors
node_workflowengine -->|"queries executions"| node_executionquery
node_workflowengine -.->|"runs agents"| node_agentruntime
node_agentruntime -.->|"dispatches tools"| node_agenttools
node_agentruntime -.->|"calls models"| node_modelconnectors
node_modelconnectors -->|"requests completion"| node_modelproviders
node_agentruntime -.->|"uses memory"| node_agentmemory
node_agentruntime -.->|"applies checks"| node_guardrails
node_agentruntime -.->|"uses retrieval"| node_vectorstores
node_externalservices -->|"integrates with"| node_connectors
node_user -.->|"manages apps"| node_appapi
node_appapi -->|"delegates"| node_appservice
node_appservice -->|"persists apps"| node_apprepository
node_appservice -->|"manages versions"| node_appversions
node_appservice -->|"serves app URLs"| node_apphosting
node_migrationquery -->|"queries findings"| node_migrationservice
node_migrationquery -->|"reads findings"| node_findingrepository
node_migrationservice -->|"uses migrations"| node_migrationregistry
node_migrationservice -->|"uses rules"| node_ruleregistry
node_workflowreviews -.->|"authorizes review"| node_user

click node_builder "https://github.com/jamestrichmond/n8n/tree/master/packages/frontend/editor-ui/src"
click node_nodecatalog "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/ai-utilities/src/node-catalog/search-engine.ts"
click node_workflowengine "https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/engine/src"
click node_executionquery "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/engine/src/execution/execution-query.service.ts"
click node_connectors "https://github.com/jamestrichmond/n8n/tree/master/packages/nodes-base/nodes"
click node_agentruntime "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/loop/agent-runtime.ts"
click node_agenttools "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/tools/tool-call-runner.ts"
click node_modelconnectors "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/model/model-factory.ts"
click node_agentmemory "https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/memory/memory-orchestrator.ts"
click node_guardrails "https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/ai-utilities/src/guardrails"
click node_vectorstores "https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/agents/src/vector-stores"
click node_appapi "https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/apps.controller.ts"
click node_appservice "https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/apps.service.ts"
click node_apprepository "https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/app.repository.ts"
click node_appversions "https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/versions/app-version.repository.ts"
click node_apphosting "https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/serving/app-host.service.ts"
click node_migrationservice "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.service.ts"
click node_migrationquery "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/query/migration-finding-query.service.ts"
click node_migrationregistry "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.migration-registry.service.ts"
click node_ruleregistry "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.rule-registry.service.ts"
click node_findingrepository "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/database/repositories/migration-finding.repository.ts"
click node_workflowdependencies "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/workflow-index/workflow-dependency-query.service.ts"
click node_workflowreviews "https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/workflow-reviews.ee/workflow-review-authorization.service.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_builder,node_nodecatalog toneBlue
class node_workflowengine,node_executionquery,node_connectors toneAmber
class node_agentruntime,node_agenttools,node_modelconnectors,node_agentmemory,node_guardrails,node_vectorstores toneMint
class node_appapi,node_appservice,node_apprepository,node_appversions,node_apphosting,node_migrationservice,node_migrationquery,node_migrationregistry,node_ruleregistry,node_findingrepository,node_workflowdependencies,node_workflowreviews toneRose
class node_user,node_externalservices,node_modelproviders toneIndigo
```

## Components

### Workflow design

- [Workflow builder](https://github.com/jamestrichmond/n8n/tree/master/packages/frontend/editor-ui/src): `packages/frontend/editor-ui/src`
- [Node catalog search](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/ai-utilities/src/node-catalog/search-engine.ts): `packages/@n8n/ai-utilities/src/node-catalog/search-engine.ts`

### Execution runtime

- [Workflow engine](https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/engine/src): `packages/@n8n/engine/src`
- [Execution queries](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/engine/src/execution/execution-query.service.ts): `packages/@n8n/engine/src/execution/execution-query.service.ts`
- [Service integrations](https://github.com/jamestrichmond/n8n/tree/master/packages/nodes-base/nodes): `packages/nodes-base/nodes`

### AI capabilities

- [Agent runtime](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/loop/agent-runtime.ts): `packages/@n8n/agents/src/runtime/loop/agent-runtime.ts`
- [Agent tools](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/tools/tool-call-runner.ts): `packages/@n8n/agents/src/runtime/tools/tool-call-runner.ts`
- [Model providers](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/model/model-factory.ts): `packages/@n8n/agents/src/runtime/model/model-factory.ts`
- [Agent memory](https://github.com/jamestrichmond/n8n/blob/master/packages/%40n8n/agents/src/runtime/memory/memory-orchestrator.ts): `packages/@n8n/agents/src/runtime/memory/memory-orchestrator.ts`
- [AI guardrails](https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/ai-utilities/src/guardrails): `packages/@n8n/ai-utilities/src/guardrails`
- [Vector stores](https://github.com/jamestrichmond/n8n/tree/master/packages/%40n8n/agents/src/vector-stores): `packages/@n8n/agents/src/vector-stores`

### Governance and apps

- [App API](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/apps.controller.ts): `packages/modules/apps/backend/src/apps.controller.ts`
- [App lifecycle](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/apps.service.ts): `packages/modules/apps/backend/src/apps.service.ts`
- [App persistence](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/app.repository.ts): `packages/modules/apps/backend/src/app.repository.ts`
- [App versions](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/versions/app-version.repository.ts): `packages/modules/apps/backend/src/versions/app-version.repository.ts`
- [App hosting](https://github.com/jamestrichmond/n8n/blob/master/packages/modules/apps/backend/src/serving/app-host.service.ts): `packages/modules/apps/backend/src/serving/app-host.service.ts`
- [Breaking-change analysis](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.service.ts): `packages/cli/src/modules/breaking-changes/breaking-changes.service.ts`
- [Finding queries](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/query/migration-finding-query.service.ts): `packages/cli/src/modules/breaking-changes/query/migration-finding-query.service.ts`
- [Migration registry](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.migration-registry.service.ts): `packages/cli/src/modules/breaking-changes/breaking-changes.migration-registry.service.ts`
- [Rule registry](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/breaking-changes.rule-registry.service.ts): `packages/cli/src/modules/breaking-changes/breaking-changes.rule-registry.service.ts`
- [Finding persistence](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/breaking-changes/database/repositories/migration-finding.repository.ts): `packages/cli/src/modules/breaking-changes/database/repositories/migration-finding.repository.ts`
- [Dependency analysis](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/workflow-index/workflow-dependency-query.service.ts): `packages/cli/src/modules/workflow-index/workflow-dependency-query.service.ts`
- [Review authorization](https://github.com/jamestrichmond/n8n/blob/master/packages/cli/src/modules/workflow-reviews.ee/workflow-review-authorization.service.ts): `packages/cli/src/modules/workflow-reviews.ee/workflow-review-authorization.service.ts`

### Other components

- **Workflow author**
- **Connected services**
- **Model services**

## Connections

- Workflow author → Workflow builder: designs
- Workflow builder → Node catalog search: searches nodes
- Workflow builder → Workflow engine: runs workflows
- Workflow engine → Service integrations: executes steps
- Workflow engine → Execution queries: queries executions (evidence: `packages/@n8n/engine/src/execution/execution-query.service.ts`)
- Workflow engine → Agent runtime: runs agents
- Agent runtime → Agent tools: dispatches tools
- Agent runtime → Model providers: calls models
- Model providers → Model services: requests completion
- Agent runtime → Agent memory: uses memory
- Agent runtime → AI guardrails: applies checks
- Agent runtime → Vector stores: uses retrieval
- Connected services → Service integrations: integrates with
- Workflow author → App API: manages apps
- App API → App lifecycle: delegates (evidence: `packages/modules/apps/backend/src/apps.controller.ts`)
- App lifecycle → App persistence: persists apps (evidence: `packages/modules/apps/backend/src/apps.service.ts`)
- App lifecycle → App versions: manages versions (evidence: `packages/modules/apps/backend/src/apps.service.ts`)
- App lifecycle → App hosting: serves app URLs (evidence: `packages/modules/apps/backend/src/apps.service.ts`)
- Finding queries → Breaking-change analysis: queries findings (evidence: `packages/cli/src/modules/breaking-changes/query/migration-finding-query.service.ts`)
- Finding queries → Finding persistence: reads findings (evidence: `packages/cli/src/modules/breaking-changes/query/migration-finding-query.service.ts`)
- Breaking-change analysis → Migration registry: uses migrations (evidence: `packages/cli/src/modules/breaking-changes/breaking-changes.service.ts`)
- Breaking-change analysis → Rule registry: uses rules (evidence: `packages/cli/src/modules/breaking-changes/breaking-changes.service.ts`)
- Review authorization → Workflow author: authorizes review
