New features available! Check the changelog
Subscribfy

How It Works

The compilation pipeline and runtime behind the visual builder

Behind the canvas, your graph is validated, compiled into a compact configuration, and pushed to Shopify, where one shared Shopify Function interprets it at checkout.


Design Principles

Config-driven runtime

Every merchant's rules live as configuration data, not generated code. Deploying a new discount means writing a setting, not building software.

One shared interpreter

A single Shopify Function serves all merchants and all discounts across two Shopify targets.

Graph is the contract

The visual editor is the source of truth. The compiler flattens branches into rules before saving.

Deterministic

Conditions are pure functions of the configuration and the cart input, so the same inputs always give the same result.


The Compilation Pipeline


What Happens on Save

Validate

The request is checked end to end: title, dates, flow shape, targeting, and combinations. The same validator runs whether you save or the form checks a change in real time, so inline errors match exactly what a save would reject.

Persist

The graph and its nodes, ports, and links are stored. On update, the previous graph is replaced wholesale so there is never a half-updated flow.

Compile and Sync

The compiler walks from the Initial node, folds branch conditions into the rules they lead to, and produces a flat list of rules. That configuration is pushed to Shopify as an app-owned metafield.

Because branches are folded into each rule's accumulated condition, a deeply branched graph still compiles into a simple, flat list of independent rules.


At Checkout

The shared Shopify Function exposes two handlers:

  • One serves Product and Order discounts (cart lines target).
  • One serves Shipping discounts (delivery options target).

On every cart change, the function:

Load the config

Read the compiled configuration from the metafield.

Evaluate conditions

For each rule, evaluate its condition tree against the current cart.

Resolve the target

If the condition is true, filter the cart lines or delivery options the rule applies to.

Apply the selection

Use the selection strategy (First, All, Maximum, Minimum) to choose the winning candidates.

Emit the discount

Return the discount operations to Shopify for the checkout to apply.

Compiled configurations carry a schema version. When the schema changes, existing configurations are migrated forward automatically, so live discounts keep working after updates.


On the Roadmap

These capabilities exist in the framework but are not exposed to merchants at launch.


Was this page helpful?

On this page

AI Chat

Ask a question about Subscribfy