This guide is for using @crystalflow/core only (no UI). For visual workflow builders with React, see Visual Builder Quick Start.
When to Use Core-Only
- ✅ Backend automation and scheduled workflows
- ✅ CLI tools with workflow execution
- ✅ Node.js servers or serverless functions
- ✅ Pre-defined workflows (not user-created)
- ✅ Custom UI from scratch
Step 1: Create a Node
Let’s create a simple math node that adds two numbers:AddNode.ts
Understanding the code
Understanding the code
- @defineNode: Registers the node with metadata (type, label, category)
- @Input: Defines an input port that can receive data
- @Output: Defines an output port that produces data
- execute(): Contains the node’s logic, runs when the workflow executes
Step 2: Register Nodes
Before using nodes, register them with the NodeRegistry:registry.ts
Step 3: Create a Workflow
Now create a workflow and add nodes:workflow.ts
Step 4: Execute the Workflow
Execute the workflow and get results:execute.ts
Step 5: Serialize to JSON
Save your workflow as JSON:serialize.ts
Complete Example
Here’s everything together:index.ts
With React UI
If you’re using@crystalflow/react, you can create a visual workflow builder:
App.tsx
Next Steps
Core Concepts
Learn about nodes, workflows, and execution
Creating Custom Nodes
Deep dive into node creation
Workflow Builder
Build visual workflow interfaces
API Reference
Explore the complete API