n8n Clone — Visual Workflow Automation & AI Agent Engine

Creator & Lead Architect · 2025 · 3 months · 1 person · 2 min read

Architected a full-stack drag-and-drop workflow automation engine with Node.js, TypeScript, custom nodes, and AI Agent nodes supporting OpenAI, Anthropic, and local LLMs.

Overview

An open-source visual workflow automation platform built from scratch. It features an interactive node-graph visual canvas, an asynchronous DAG execution engine, encrypted credential persistence, and AI Agent integration.

Problem

Existing workflow automation tools are either costly SaaS offerings or lack first-class support for local LLM tool-calling and custom developer nodes.

Constraints

  • Must support real-time visual canvas node editing and connection validation
  • Asynchronous execution of complex Directed Acyclic Graph (DAG) workflows
  • Secure encrypted storage for API credentials and OAuth tokens

Approach

Built a React-based node editor backed by a decoupled Node.js/TypeScript execution engine. Developed custom node plugins for Telegram (Send/Wait), Gmail (Send/OAuth), Webhooks, and an AI Agent node.

Key Decisions

Decouple visual canvas state from backend DAG execution graph

Reasoning:

Ensures headless execution of scheduled or webhook-triggered workflows without requiring an active browser window.

Alternatives considered:
  • Tightly coupled client-server evaluation

Integrate LLM tool-calling directly inside workflow nodes

Reasoning:

Allows AI Agent nodes to dynamically choose and execute other workflow nodes as tool functions.

Alternatives considered:
  • Separate microservice for AI agents

Tech Stack

  • TypeScript
  • React
  • Node.js
  • TypeORM
  • Prisma
  • PostgreSQL
  • SQLite
  • OpenAI API
  • Anthropic API
  • Telegram API
  • Docker

Result & Impact

  • Telegram, Gmail, Webhooks, AI
    Core Integrations
  • < 100ms per node
    Step Execution
  • Decoupled DAG Engine
    Architecture

Engineered a scalable workflow execution platform showcasing deep full-stack mastery in stateful graph traversal, async loops, and LLM tool calling.

Learnings

  • Topological sorting algorithms are essential for cleanly resolving complex node dependencies.
  • Handling async event loop state is critical to preventing node execution deadlocks.

Visual Automation & AI Tool Calling

The goal of n8n Clone was to build a developer-first automation engine capable of combining traditional API integrations (Telegram, Gmail, SMTP) with state-of-the-art AI Agent reasoning.

Architecture Highlights

  • Visual Editor: Interactive node-graph canvas built with React, featuring live connection validation and dynamic node config panels.
  • DAG Execution Engine: Evaluates node workflows using a topological sort. Supports conditional branching, wait-nodes, and retry loops.
  • AI Agent Node: Equips LLMs (OpenAI, Anthropic, or Ollama local models) with access to workflow inputs and downstream actions as callable tools.