Skip to main content
CrystalFlow supports class inheritance, allowing you to create base node classes with shared functionality and decorators.

Why Use Inheritance?

Code Reuse

Share common logic across multiple nodes

Consistency

Ensure consistent behavior and properties

Maintainability

Update common code in one place

Organization

Create logical node hierarchies

Basic Inheritance

Property Inheritance

All properties defined with @Property are inherited:

Multi-Level Inheritance

Create deep inheritance hierarchies:

Abstract Methods Pattern

Use abstract patterns for enforceability:

Mixin Pattern

Combine multiple behaviors:

Override Parent Methods

Override methods while calling parent implementation:

Best Practices

Identify common patterns and create base classes early.
Avoid deep inheritance trees (3-4 levels max).
Make shared methods protected to encapsulate implementation.
Clearly document what child classes should override.
Sometimes composition (mixins) is better than inheritance.

Common Base Classes

API Client Base

Data Processor Base

File Operation Base

Next Steps

Property System

Understanding property inheritance

Creating Custom Nodes

Build nodes with inheritance

Node API

Complete Node class reference

Examples

See inheritance in action