Skip to main content
CrystalFlow uses TypeScript decorators to define nodes, inputs, outputs, and properties.
Requires experimentalDecorators: true in your tsconfig.json.

@defineNode

Define a node type with metadata.
NodeMetadata
Node metadata configuration:
  • type: string - Unique node type identifier
  • label: string - Display name
  • category: string - Category for grouping
  • description?: string - Optional description
Example:

@Input

Define an input port on a node.
InputConfig
Input configuration:
  • type: string - Data type ('string', 'number', 'boolean', 'any', etc.)
  • label: string - Display label
  • required?: boolean - Whether input is required (default: true)
  • defaultValue?: any - Default value if not connected
  • description?: string - Optional description
Example:

@Output

Define an output port on a node.
OutputConfig
Output configuration:
  • type: string - Data type
  • label: string - Display label
  • description?: string - Optional description
Example:

@Property

Define a static configuration property.
PropertyConfig
Property configuration:
  • type: 'string' | 'number' | 'boolean' | 'select' - Property type
  • label: string - Display label
  • defaultValue?: any - Default value
  • required?: boolean - Whether required
  • description?: string - Optional description
For numbers:
  • min?: number - Minimum value
  • max?: number - Maximum value
  • step?: number - Increment step
For select:
  • options: Array<{ value: string; label: string }> - Dropdown options
Example:

Property vs Input

@Property

Static configuration - Set in property panel, not connected to other nodes. Use for: URLs, timeouts, mode selection, formatting options.

@Input

Dynamic data flow - Connected via handles to other node outputs. Use for: Data processing, computed values, workflow results.
Example showing both:

Decorator Metadata

All decorator metadata is stored using reflect-metadata:

Inheritance

Decorators support inheritance:

TypeScript Configuration

Add to your tsconfig.json:

Complete Example

Creating Custom Nodes

Learn to build nodes

Property System

Deep dive into properties

Node API

Node class reference

Decorators Concept

Understand decorators