A visual workflow editor for LangGraph that generates TypeScript code. This is a TypeScript port of the original langgraph-editor by Erickrus. This editor generates TypeScript code for LangGraph workflows.
- Visual Workflow Editor: Drag-and-drop interface using LiteGraph.js
- TypeScript Code Generation: Automatically generates TypeScript code for your LangGraph workflows
- Three Node Types:
LangGraphNode: Standard workflow nodesLangGraphConditionalNode: Conditional routing nodesLangGraphEndNode: Workflow termination nodes
- Save/Load Workflows: Persist your workflows as JSON files
- Real-time Compilation: Generate TypeScript code instantly
# Clone the repository
git clone https://github.com/mostafa-aboelnaga/langgraph-editor-ts.git
cd langgraph-editor-ts
# Install dependencies
npm install
# Run in development mode
npm run dev-
Start the server:
npm run dev
-
Open the editor: Navigate to
http://localhost:8082/static/index.html -
Create your workflow:
- Right-click on the canvas to add nodes
- Connect nodes by dragging from outputs to inputs
- Set node names using the text widgets
-
Generate TypeScript code:
- Right-click and select "Compile"
- The generated TypeScript code will be saved to
output/output.ts
-
Save/Load workflows:
- Right-click and select "Save" to save your workflow
- Right-click and select "Load" to load a saved workflow
The editor generates TypeScript code like this:
import { StateGraph, END } from '@langchain/langgraph';
import { GraphState } from './types';
// Create the workflow
const workflow = new StateGraph<GraphState>(GraphState);
// Define the nodes
workflow.addNode('query', query);
workflow.addNode('webSearch', webSearch);
// Build graph connections
workflow.setEntryPoint('query');
workflow.addConditionalEdges('query', decide, {
condition_1: END,
condition_2: 'webSearch',
});
workflow.addEdge('webSearch', END);
// Compile the workflow
const app = workflow.compile();
export { app };langgraph-editor-ts/
├── src/
│ └── server.ts # Express server
├── static/
│ └── index.html # Main editor interface
├── output/ # Generated code output
│ └── output.ts # Generated TypeScript code
├── workflow.json # Sample workflow
├── package.json
├── tsconfig.json
└── README.md
POST /api/saveCode- Save generated TypeScript codePOST /api/saveWorkflow- Save workflow as JSONPOST /api/loadWorkflow- Load workflow from JSONGET /api/health- Health check
Standard workflow node that represents a function in your workflow.
Conditional routing node that allows branching logic based on conditions.
Represents the END state of the workflow.
# Install dependencies
npm install
# Run in development mode (auto-reload)
npm run dev
# Build for production
npm run build
# Start production server
npm startThis TypeScript version differs from the original Python version in several key ways:
- Language: Generates TypeScript code
- Backend: Uses Node.js/Express
- Output: Creates
.tsfiles - Imports: Uses
@langchain/langgraphTypeScript imports
Based on the original langgraph-editor by Hu, Ying-Hao (hyinghao@hotmail.com).
This TypeScript port maintains the same visual interface and workflow concepts while generating TypeScript code for the LangGraph ecosystem.
