The node is the unit of processing in CRANQ. It takes data from signals and parameters through input ports, processes the data, and sends the result via output ports.

Most nodes have internal structure made up of child nodes and connections between them.

Some nodes are implemented using text code (like JavaScript), but we rarely need to create or edit them. Business logic in CRANQ programs tends to exist in the connections, rather than in code. It's fair to say that CRANQ code is the connections.

If you took away all the connections and grouping from a CRANQ program, only a bunch of fundamental (code) nodes would remain.

Prototypes and instances

Nodes can be made reusable.

Reusing nodes is very important because that's how we speed up development both for ourselves and for others.

Reusable nodes are called prototypes.

When we add a node from the Repo, we're actually reusing a node. A node in the Repo is therefore always a prototype - and when dragged to the canvas it becomes an instance of a node.

Node instances inherit every property of the prototype - ports, data types, structure, and code - but in addition to these, they can also have parameter values set on input ports. Instances can only exist in the context of a parent node, whereas prototypes live in the Repo without context.

If you've used Sketch or Figma before, this concept may already be familiar. In Sketch, reusable elements are called symbols; in Figma - components, and they work pretty much the same way as prototypes do in CRANQ.

In CRANQ, we also call prototypes components sometimes.

Last updated