# heyshahid/flowpilot architecture

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

- Interactive diagram: https://gitdiagram.com/heyshahid/flowpilot
- Repository: https://github.com/heyshahid/flowpilot

## Overview

FlowPilot is a visual, self-hostable workflow automation platform. Users compose workflows in the canvas, save them, then trigger executions through the API, webhooks, or schedules; the execution runtime validates and plans the graph before running its nodes and recording traces. Separate product areas provide integrations, AI assistance, team access, monitoring, alerts, analytics, recommendations, and version rollback. The README documents the runtime design; source-index references support several internal calls. Other links are omitted where implementation excerpts do not establish them.

Main entry points: [`src/core/execution/queue.ts`](https://github.com/heyshahid/flowpilot/blob/main/src/core/execution/queue.ts) (Execution queue), [`src/app/api/v1/workflows`](https://github.com/heyshahid/flowpilot/tree/main/src/app/api/v1/workflows) (Workflow API), [`src/lib/storage/workflowStore.ts`](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/workflowStore.ts) (Workflow store), [`src/lib/storage/executionStore.ts`](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/executionStore.ts) (Execution store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Workflow Authoring"]
  node_canvas["Workflow canvas<br/>[page.tsx]"]
  node_workflow_api["Workflow API"]
  node_workflow_store[("Workflow store<br/>[workflowStore.ts]")]
  node_validation["Graph validation<br/>[graphValidator.ts]"]
  node_versioning[("Version history<br/>[versionStore.ts]")]
  node_ai["AI assistance"]
end

subgraph group_runtime["Execution Runtime"]
  node_webhook["Webhook ingress<br/>[route.ts]"]
  node_scheduler["Schedule engine<br/>[schedulerEngine.ts]"]
  node_schedule_store[("Schedule store<br/>[scheduleStore.ts]")]
  node_queue["Execution queue<br/>[queue.ts]"]
  node_planner["Execution planner<br/>[planner.ts]"]
  node_engine["DAG executor<br/>[executor.ts]"]
  node_node_runtime["Node runtime"]
  node_integrations["Integration adapters"]
  node_execution_store[("Execution store<br/>[executionStore.ts]")]
end

subgraph group_operations["Operations and Insights"]
  node_monitoring["Execution monitoring"]
  node_alerts["Alert evaluation<br/>[alertRuleEngine.ts]"]
  node_analytics["Analytics services"]
  node_recommendations["Optimization recommendations"]
end

subgraph group_platform["Platform Services"]
  node_auth["Workspace access<br/>[authContext.ts]"]
  node_workspace_store[("Workspace store<br/>[workspaceStore.ts]")]
  node_usage["Usage and costs<br/>[usageService.ts]"]
end

node_user(("Workspace user"))

node_user -->|"designs workflows"| node_canvas
node_canvas -.->|"saves workflows"| node_workflow_api
node_workflow_api -->|"resolves access"| node_auth
node_workflow_api -->|"reads and writes"| node_workflow_store
node_workflow_api -.->|"manages versions"| node_versioning
node_user -->|"triggers workflow"| node_webhook
node_webhook -->|"enqueues execution"| node_queue
node_webhook -->|"loads workflow"| node_workflow_store
node_scheduler -->|"reads schedules"| node_schedule_store
node_scheduler -->|"enqueues due runs"| node_queue
node_queue -->|"loads workflow"| node_workflow_store
node_queue -->|"records execution"| node_execution_store
node_queue -.->|"requests plan"| node_planner
node_planner -->|"validates graph"| node_validation
node_planner -->|"builds execution plan"| node_engine
node_engine -.->|"dispatches nodes"| node_node_runtime
node_node_runtime -.->|"invokes connectors"| node_integrations
node_user -->|"requests assistance"| node_ai
node_user -.->|"selects workspace"| node_auth
node_auth -->|"loads workspace"| node_workspace_store
node_monitoring -.->|"reads executions"| node_execution_store
node_alerts -->|"reads executions"| node_execution_store
node_alerts -->|"reads schedules"| node_schedule_store
node_recommendations -->|"analyzes workflows"| node_workflow_store
node_recommendations -->|"analyzes executions"| node_execution_store
node_recommendations -->|"reads usage"| node_usage
node_usage -->|"uses pricing and health"| node_analytics

click node_canvas "https://github.com/heyshahid/flowpilot/blob/main/src/app/builder/%5Bid%5D/page.tsx"
click node_workflow_api "https://github.com/heyshahid/flowpilot/tree/main/src/app/api/v1/workflows"
click node_workflow_store "https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/workflowStore.ts"
click node_validation "https://github.com/heyshahid/flowpilot/blob/main/src/core/validation/graphValidator.ts"
click node_versioning "https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/versionStore.ts"
click node_webhook "https://github.com/heyshahid/flowpilot/blob/main/src/app/api/v1/webhooks/%5Btoken%5D/route.ts"
click node_scheduler "https://github.com/heyshahid/flowpilot/blob/main/src/core/scheduler/schedulerEngine.ts"
click node_schedule_store "https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/scheduleStore.ts"
click node_queue "https://github.com/heyshahid/flowpilot/blob/main/src/core/execution/queue.ts"
click node_planner "https://github.com/heyshahid/flowpilot/blob/main/src/core/execution/planner.ts"
click node_engine "https://github.com/heyshahid/flowpilot/blob/main/src/core/engine/executor.ts"
click node_node_runtime "https://github.com/heyshahid/flowpilot/blob/main/src/core/runtime/nodeRuntimeRegistry.ts"
click node_integrations "https://github.com/heyshahid/flowpilot/tree/main/src/core/integrations"
click node_execution_store "https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/executionStore.ts"
click node_ai "https://github.com/heyshahid/flowpilot/tree/main/src/core/ai"
click node_auth "https://github.com/heyshahid/flowpilot/blob/main/src/core/auth/authContext.ts"
click node_workspace_store "https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/workspaceStore.ts"
click node_monitoring "https://github.com/heyshahid/flowpilot/blob/main/src/core/monitoring/monitoringService.ts"
click node_alerts "https://github.com/heyshahid/flowpilot/blob/main/src/core/alerts/alertRuleEngine.ts"
click node_analytics "https://github.com/heyshahid/flowpilot/tree/main/src/core/analytics"
click node_recommendations "https://github.com/heyshahid/flowpilot/blob/main/src/core/recommendations/recommendationEngine.ts"
click node_usage "https://github.com/heyshahid/flowpilot/blob/main/src/core/usage/usageService.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_canvas,node_workflow_api,node_workflow_store,node_validation,node_versioning,node_ai,node_user toneBlue
class node_webhook,node_scheduler,node_schedule_store,node_queue,node_planner,node_engine,node_node_runtime,node_integrations,node_execution_store toneAmber
class node_monitoring,node_alerts,node_analytics,node_recommendations toneMint
class node_auth,node_workspace_store,node_usage toneRose
```

## Components

### Workflow Authoring

- [Workflow canvas](https://github.com/heyshahid/flowpilot/blob/main/src/app/builder/%5Bid%5D/page.tsx): `src/app/builder/[id]/page.tsx`
- [Workflow API](https://github.com/heyshahid/flowpilot/tree/main/src/app/api/v1/workflows): `src/app/api/v1/workflows`
- [Workflow store](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/workflowStore.ts): `src/lib/storage/workflowStore.ts`
- [Graph validation](https://github.com/heyshahid/flowpilot/blob/main/src/core/validation/graphValidator.ts): `src/core/validation/graphValidator.ts`
- [Version history](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/versionStore.ts): `src/lib/storage/versionStore.ts`
- [AI assistance](https://github.com/heyshahid/flowpilot/tree/main/src/core/ai): `src/core/ai`

### Execution Runtime

- [Webhook ingress](https://github.com/heyshahid/flowpilot/blob/main/src/app/api/v1/webhooks/%5Btoken%5D/route.ts): `src/app/api/v1/webhooks/[token]/route.ts`
- [Schedule engine](https://github.com/heyshahid/flowpilot/blob/main/src/core/scheduler/schedulerEngine.ts): `src/core/scheduler/schedulerEngine.ts`
- [Schedule store](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/scheduleStore.ts): `src/lib/storage/scheduleStore.ts`
- [Execution queue](https://github.com/heyshahid/flowpilot/blob/main/src/core/execution/queue.ts): `src/core/execution/queue.ts`
- [Execution planner](https://github.com/heyshahid/flowpilot/blob/main/src/core/execution/planner.ts): `src/core/execution/planner.ts`
- [DAG executor](https://github.com/heyshahid/flowpilot/blob/main/src/core/engine/executor.ts): `src/core/engine/executor.ts`
- [Node runtime](https://github.com/heyshahid/flowpilot/blob/main/src/core/runtime/nodeRuntimeRegistry.ts): `src/core/runtime/nodeRuntimeRegistry.ts`
- [Integration adapters](https://github.com/heyshahid/flowpilot/tree/main/src/core/integrations): `src/core/integrations`
- [Execution store](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/executionStore.ts): `src/lib/storage/executionStore.ts`

### Operations and Insights

- [Execution monitoring](https://github.com/heyshahid/flowpilot/blob/main/src/core/monitoring/monitoringService.ts): `src/core/monitoring/monitoringService.ts`
- [Alert evaluation](https://github.com/heyshahid/flowpilot/blob/main/src/core/alerts/alertRuleEngine.ts): `src/core/alerts/alertRuleEngine.ts`
- [Analytics services](https://github.com/heyshahid/flowpilot/tree/main/src/core/analytics): `src/core/analytics`
- [Optimization recommendations](https://github.com/heyshahid/flowpilot/blob/main/src/core/recommendations/recommendationEngine.ts): `src/core/recommendations/recommendationEngine.ts`

### Platform Services

- [Workspace access](https://github.com/heyshahid/flowpilot/blob/main/src/core/auth/authContext.ts): `src/core/auth/authContext.ts`
- [Workspace store](https://github.com/heyshahid/flowpilot/blob/main/src/lib/storage/workspaceStore.ts): `src/lib/storage/workspaceStore.ts`
- [Usage and costs](https://github.com/heyshahid/flowpilot/blob/main/src/core/usage/usageService.ts): `src/core/usage/usageService.ts`

### Other components

- **Workspace user**

## Connections

- Workspace user → Workflow canvas: designs workflows
- Workflow canvas → Workflow API: saves workflows
- Workflow API → Workspace access: resolves access (evidence: `src/app/api/v1/workflows/route.ts`)
- Workflow API → Workflow store: reads and writes (evidence: `src/app/api/v1/workflows/route.ts`)
- Workflow API → Version history: manages versions
- Workspace user → Webhook ingress: triggers workflow
- Webhook ingress → Execution queue: enqueues execution (evidence: `src/app/api/v1/webhooks/[token]/route.ts`)
- Webhook ingress → Workflow store: loads workflow (evidence: `src/app/api/v1/webhooks/[token]/route.ts`)
- Schedule engine → Schedule store: reads schedules (evidence: `src/core/scheduler/schedulerEngine.ts`)
- Schedule engine → Execution queue: enqueues due runs (evidence: `src/core/scheduler/schedulerEngine.ts`)
- Execution queue → Workflow store: loads workflow (evidence: `src/core/execution/queue.ts`)
- Execution queue → Execution store: records execution (evidence: `src/core/execution/queue.ts`)
- Execution queue → Execution planner: requests plan
- Execution planner → Graph validation: validates graph
- Execution planner → DAG executor: builds execution plan
- DAG executor → Node runtime: dispatches nodes
- Node runtime → Integration adapters: invokes connectors
- Workspace user → AI assistance: requests assistance
- Workspace user → Workspace access: selects workspace
- Workspace access → Workspace store: loads workspace (evidence: `src/core/auth/authContext.ts`)
- Execution monitoring → Execution store: reads executions
- Alert evaluation → Execution store: reads executions (evidence: `src/core/alerts/alertRuleEngine.ts`)
- Alert evaluation → Schedule store: reads schedules (evidence: `src/core/alerts/alertRuleEngine.ts`)
- Optimization recommendations → Workflow store: analyzes workflows (evidence: `src/core/recommendations/recommendationEngine.ts`)
- Optimization recommendations → Execution store: analyzes executions (evidence: `src/core/recommendations/recommendationEngine.ts`)
- Optimization recommendations → Usage and costs: reads usage (evidence: `src/core/recommendations/recommendationEngine.ts`)
- Usage and costs → Analytics services: uses pricing and health (evidence: `src/core/usage/usageService.ts`)
