ComfloDocs

Advanced

Comflo theme development

Build, validate and publish custom storefront themes with Comflo, the Theme CLI and Theme API 1.

In Comflo: More → Theme development

Last reviewed against the Comflo product on November 19, 2026.

Comflo is Comflo's storefront theme language and package format. It combines Liquid-compatible templates, JSON page layouts, editor schemas, static assets, and a platform-provided storefront runtime. A Comflo theme controls how a store looks; Comflo continues to own product data, routing, carts, checkout, payments, and publishing.

This guide documents the code that exists today. It deliberately does not assume Shopify-only objects, tags, filters, or folder conventions.

Contents

  1. Naming and compatibility
  2. How rendering works
  3. Install the CLI
  4. Create and run a theme
  5. Theme package structure
  6. Language syntax
  7. Comflo tags
  8. Filters
  9. Global objects
  10. Page-specific objects
  11. Layouts, templates, sections, blocks, and snippets
  12. Theme and section settings
  13. Assets, CSS, JavaScript, images, and fonts
  14. Products, collections, cart, and forms
  15. Routes and page types
  16. Complete starter storefront
  17. Validate, package, and upload
  18. GitHub synchronization
  19. Preview, publish, and roll back
  20. Debugging
  21. Security and performance
  22. Current limitations and planned work
  23. Reference limits

1. Naming and compatibility

The product language may be called Comflo, but the implemented filename extension is `.comflo`:

text
layout/theme.comflo
sections/hero.comflo
snippets/product-card.comflo

Do not use .comflow. Theme API 1's package allow-list, compiler, loader, editor, and CLI all recognize .comflo. The only legacy conversion is for old store code overrides ending in .liquid; it does not make .liquid a valid new theme-package extension.

Comflo compared with Shopify Liquid

Comflo uses Liquid syntax through LiquidJS, but it is not Shopify Liquid:

  • Comflo has its own objects, custom tags, filters, editor schema, routes, and runtime hooks.
  • Shopify-specific objects such as cart, customer, all_products, product.metafields,

content_for_header, and shopify_* are not currently supplied.

  • Unknown variables render as empty values; unknown filters are errors.
  • Objects expose their own properties only. Templates cannot traverse JavaScript prototypes.
  • Templates cannot read the filesystem, open the network, access environment variables, or run

server-side JavaScript.

  • The cart and checkout are client-side UI supplied by Comflo's injected storefront runtime.

Treat this document—not Shopify's Liquid reference—as the platform contract.


2. How rendering works

For every request, Comflo performs this pipeline:

  1. Resolve the URL to a page type and template, such as product or collection.special.
  2. Load the store's immutable theme version and overlay any code edits saved in the editor.
  3. Resolve theme, section, and block setting values against the store catalogue.
  4. Build plain-data objects for the shop, request, menus, products, collections, and current page.
  5. Render the template's enabled sections in order.
  6. Insert that HTML into layout/theme.comflo as content_for_layout.
  7. Inject Comflo's cart, checkout, form, and editor-preview runtime.
  8. Return the complete HTML document.

Rendering is pure: theme templates receive plain data and produce HTML. Live rendering runs in a worker pool with a hard timeout. The same engine is used by local development, ZIP validation, GitHub imports, marketplace checks, editor previews, and live storefronts.

Engine behavior

BehaviorCurrent value
Liquid implementationLiquidJS 10.30.0
Theme API1
TruthinessLiquid truthiness (false and nil are false; 0 and empty strings are true)
Unknown filtersError (strictFilters: true)
Unknown variablesEmpty (strictVariables: false)
Property accessOwn properties only
Relative snippet referencesDisabled
Template render limit2,500 operations
Template memory limit64 MB
Worker hard deadline5 seconds

3. Install the CLI

The CLI currently runs from the Comflo monorepo and requires Node.js 20 or newer:

bash
pnpm install
pnpm --filter @comflo/theme-engine build
pnpm --filter @comflo/cli build
alias comflo="node $(pwd)/packages/cli/dist/cli.js"
comflo --help

The package is private today; npm install -g @comflo/cli is not yet a supported workflow.


4. Create and run a theme

Start from a production-tested built-in theme:

bash
comflo theme init my-theme --from aurora --name "My Theme"
cd my-theme
comflo theme dev

Available bases are aurora, crema, and atelier. The dev server opens at http://localhost:9292 and reloads when files change.

Try these routes:

text
/
/products/ceylon-black-tea
/products/gift-bundle
/collections/all
/collections/coffee?sort_by=price-ascending
/pages/about
/search?q=tea
/a-missing-page

Local development uses a demo catalogue containing ordinary products, variants, a sold-out product, collections, and a bundle. Its cart is simulated and does not create orders.

Use a different port when necessary:

bash
comflo theme dev --port 9393

5. Theme package structure

text
my-theme/
├── assets/
│   ├── theme.css
│   ├── theme.js
│   └── hero.webp
├── blocks/
│   └── button.comflo
├── config/
│   ├── theme.json
│   ├── settings_schema.json
│   └── settings_data.json          optional
├── layout/
│   └── theme.comflo
├── locales/
│   ├── en.json
│   └── en.schema.json              optional
├── sections/
│   ├── header.comflo
│   ├── footer.comflo
│   ├── hero.comflo
│   ├── main-product.comflo
│   ├── main-collection.comflo
│   ├── main-page.comflo
│   ├── main-search.comflo
│   └── main-404.comflo
├── snippets/
│   ├── image.comflo
│   ├── price.comflo
│   ├── product-card.comflo
│   └── product-form.comflo
└── templates/
    ├── index.json
    ├── product.json
    ├── collection.json
    ├── page.json
    ├── search.json
    ├── 404.json
    ├── header-group.json
    └── footer-group.json

The nine files listed under templates/ and the three files config/theme.json, config/settings_schema.json, and layout/theme.comflo are required.

Anything outside the recognized theme folders is ignored by the CLI. Package uploads allow only the paths and extensions shown in Reference limits.

config/theme.json

json
{
  "name": "My Theme",
  "version": "0.1.0",
  "api": 1,
  "author": "Your studio",
  "description": "A clean product-focused Comflo theme"
}
  • name is required.
  • version is required and must be semantic-version shaped, such as 1.2.0 or 2.0.0-beta.1.
  • api is required and must be a supported integer. The current value is 1.
  • author and description are optional for store imports but expected for marketplace themes.

6. Language syntax

Comflo supports LiquidJS's standard output, tag, expression, and filter syntax.

Output

liquid
<h1>{{ product.title }}</h1>
<p>{{ product.price | money }}</p>

Use {{- and -}}, or {%- and -%}, to trim surrounding whitespace.

Variables and assignment

liquid
{% assign heading = section.settings.heading | default: shop.name %}
{% capture label %}Shop {{ collection.title }}{% endcapture %}
<h2>{{ heading }}</h2>

Property and index access

liquid
{{ product.featured_image }}
{{ product.images[0].src }}
{{ settings['scheme_1_bg'] }}
{{ linklists[section.settings.menu].links }}

Conditions

liquid
{% if product.available and product.price > 0 %}
  <span>Available</span>
{% elsif product.variants.size > 0 %}
  <span>Unavailable</span>
{% else %}
  <span>Coming soon</span>
{% endif %}

{% unless product.available %}<span>Sold out</span>{% endunless %}

{% case request.page_type %}
  {% when 'product' %}Product page
  {% when 'collection' %}Collection page
  {% else %}Other page
{% endcase %}

Supported comparison/logical operators include ==, !=, >, <, >=, <=, contains, and, and or. Use parentheses sparingly; straightforward nested conditions are clearest.

Loops

liquid
{% for product in collection.products limit: 8 %}
  {% render 'product-card', product: product %}
{% else %}
  <p>No products found.</p>
{% endfor %}

Within a for loop, forloop provides index, index0, rindex, rindex0, first, last, and length. Ranges work too:

liquid
{% for i in (1..4) %}<span>{{ i }}</span>{% endfor %}

Use {% break %} and {% continue %} inside loops.

Comments and literal content

liquid
{% comment %}Not rendered{% endcomment %}
{% raw %}{{ this_is_displayed_literally }}{% endraw %}
{% # one-line Liquid comment %}

Standard tags available

The engine currently registers these LiquidJS tags:

text
#, assign, block, break, capture, case, comment, continue, cycle,
decrement, echo, for, if, include, increment, layout, liquid, raw,
render, tablerow, unless

Prefer render over include. Comflo's package structure has one fixed page layout, so the LiquidJS layout and block tags are available from the underlying engine but are not needed for normal Comflo themes.


7. Comflo tags

schema

Defines editor metadata for a section or theme block. It renders no HTML.

liquid
{% schema %}
{
  "name": "Hero",
  "settings": [
    { "type": "text", "id": "heading", "label": "Heading", "default": "Welcome" }
  ],
  "presets": [{ "name": "Hero" }]
}
{% endschema %}

sections

Renders a section group stored in the design. The standard layout uses it for the global header and footer:

liquid
{% sections 'header-group' %}
{{ content_for_layout }}
{% sections 'footer-group' %}

Only groups present in the design render. Theme API 1 defines header-group and footer-group.

content_for

Renders nested theme blocks allowed by a section or another theme block:

liquid
{% content_for 'blocks' %}

Render one theme block by instance id:

liquid
{% content_for 'block', id: block.id %}

This tag renders only standalone files from blocks/*.comflo admitted through a schema entry of { "type": "@theme" }. Section-local blocks are normally rendered by iterating section.blocks and switching on block.type.


8. Filters

Unknown filters fail compilation or rendering. The following inventory is generated from the installed LiquidJS 10.30.0 engine plus Comflo's registered filters.

Comflo filters

FilterPurposeExample
moneyCents to store-currency amount`{{ product.pricemoney }}`
money_without_currencyCents to numeric amount`{{ product.pricemoney_without_currency }}`
image_urlMedia URL; optional width: selects a variant`{{ imageimage_url: width: 800 }}`
image_srcsetResponsive media-library srcset, or empty`{{ imageimage_srcset }}`
asset_urlURL/data URL for a packaged asset`{{ 'theme.css'asset_url }}`
stylesheet_tagStylesheet link, or inline style in editor preview`{{ 'theme.css'asset_urlstylesheet_tag }}`
script_tagDeferred script, or inline script in editor preview`{{ 'theme.js'asset_urlscript_tag }}`
font_urlGoogle Fonts stylesheet URL for one or more names`{{ settings.heading_fontfont_url: settings.body_font }}`
font_familySafe CSS font-family stack`{{ settings.heading_fontfont_family }}`
digits_onlyRemove non-digits`{{ settings.phonedigits_only }}`
css_safeRemove style tags and < from CSS setting text`{{ settings.custom_csscss_safe }}`
sanitize_htmlSanitize a block of merchant HTML`{{ block.settings.htmlsanitize_html }}`
handleizeLowercase URL handle`{{ titlehandleize }}`
video_embed_urlYouTube/Vimeo URL to approved embed URL`{{ section.settings.videovideo_embed_url }}`
tLook up a key in locales/en.json; missing key returns itself`{{ 'general.search't }}`

Prices are integer cents. Never divide a price before passing it to money.

Standard filters available

Strings and HTML: append, capitalize, downcase, escape, escape_once, lstrip, newline_to_br, normalize_whitespace, number_of_words, prepend, remove, remove_first, remove_last, replace, replace_first, replace_last, rstrip, slice, slugify, split, squish, strip, strip_html, strip_newlines, truncate, truncatewords, upcase, xml_escape.

Math: abs, at_least, at_most, ceil, divided_by, floor, minus, modulo, plus, round, times, to_integer.

Arrays and collections: compact, concat, find, find_exp, find_index, find_index_exp, first, group_by, group_by_exp, has, has_exp, join, last, map, pop, push, reject, reject_exp, reverse, sample, shift, size, sort, sort_natural, sum, uniq, unshift, where, where_exp.

Encoding, URLs, dates, and representation: array_to_sentence_string, base64_decode, base64_encode, cgi_escape, date, date_to_long_string, date_to_rfc822, date_to_string, date_to_xmlschema, default, hmac_sha256, inspect, json, jsonify, raw, sha256, uri_escape, url_decode, url_encode.

The crypto filters operate on template values only; they do not expose platform secrets.


9. Global objects

These objects are present on every rendered page.

settings

Resolved global theme settings from config/settings_schema.json.

liquid
{{ settings.store_name }}
{{ settings.logo }}
{{ settings.heading_font }}

Product and collection picker settings resolve to full objects. link_list settings remain menu handles and are used with linklists[handle].

shop

PropertyTypeMeaning
shop.namestringStore name
shop.currencystringCurrency code, currently commonly LKR
shop.urlstringStore URL supplied to the renderer

request

PropertyTypeMeaning
request.pathstringCurrent path
request.page_typestringindex, product, collection, page, search, or 404
request.design_modebooleanTrue in editor/share preview rendering
request.localestringCurrently en

routes

PropertyCurrent value
root_url/
search_url/search
collections_url/collections
all_products_collection_url/collections/all
cart_url#cart

Use these values rather than duplicating paths.

linklists

Menus keyed by handle:

liquid
{% for link in linklists.main.links %}
  <a href="{{ link.url }}"{% if link.active %} aria-current="page"{% endif %}>
    {{ link.title }}
  </a>
{% endfor %}

A menu has title, handle, and links. Each link has title, url, and active. Nested menu links are not currently supplied.

collections

An array of store collections with two convenience access patterns:

liquid
{% for collection in collections %}{{ collection.title }}{% endfor %}
{{ collections['coffee'].title }}
{{ collections.all.products_count }}

SEO and page shell values

text
page_title
page_description
page_image
canonical_url
content_for_layout       layout only
sort_options             collection pages and anywhere else needed

sort_options entries have value and name.


10. Page-specific objects

product

Available on product pages.

PropertyTypeNotes
idstringPlatform product id
titlestringProduct name
handlestringURL handle
urlstring/products/<handle>
descriptionHTML stringMerchant product description
priceintegerLowest/current price in cents
compare_at_priceinteger or nilCompare-at amount in cents
availablebooleanAny purchasable inventory
featured_imagestringImage URL
imagesimage array{ src, alt }
variantsvariant arraySee below
selected_or_first_available_variantvariant or nilInitial variant
options_with_valuesoption arrayProduct option groups
has_only_default_variantbooleanTrue when no choice is needed
is_bundlebooleanComflo flavour bundle
bundle_sizeintegerRequired flavour slots
flavour_optionsarray{ id, title, image }
collectionsstring arrayCollection handles
created_atISO date stringCreation time
seoobject, optional{ title, description }
subscription_plansarray, optionalSubscription plans

Variant properties are id, title, price (cents), available, options, option1, option2, option3, image, and optional sku.

Option properties are name, position (starting at 1), and values.

Subscription plan properties are id, name, description, billing_cycle, delivery_frequency, price, currency, and variant_selection_mode.

recommendations

On product pages, up to 12 available products, prioritizing products sharing collections with the current product.

collection

Available on collection pages.

PropertyType
id, title, handle, url, description, imagestring
productsproduct array
products_countinteger
sort_bystring, optional
seo{ title, description }, optional

Supported sort_by query values are manual, created-descending, price-ascending, price-descending, and title-ascending.

page

Available on /pages/<handle>:

text
page.title
page.handle
page.content     sanitized rich HTML

Available on /search:

text
search.performed
search.terms
search.results
search.results_count

Search matches every word against product title and plain-text description, using at most eight words and 100 characters.


11. Layouts, templates, sections, blocks, and snippets

Layout

layout/theme.comflo must output a complete HTML document. Its essential structure is:

liquid
<!doctype html>
<html lang="{{ request.locale | default: 'en' }}">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ page_title | escape }}</title>
    {{ 'theme.css' | asset_url | stylesheet_tag }}
  </head>
  <body class="template-{{ request.page_type }}">
    {% sections 'header-group' %}
    <main id="main">{{ content_for_layout }}</main>
    {% sections 'footer-group' %}
    {{ 'theme.js' | asset_url | script_tag }}
  </body>
</html>

Comflo injects its runtime immediately before </head> and </body>, so both closing tags must be present.

JSON templates

A template selects section types and their initial order:

json
{
  "order": ["hero", "products"],
  "sections": {
    "hero": { "type": "hero", "settings": { "heading": "Welcome" } },
    "products": { "type": "featured-products" }
  }
}

Section ids must contain only letters, numbers, _, and -, up to 40 characters. A page can contain at most 40 sections.

Required base templates are index, product, collection, page, search, and 404. Alternate templates use names such as product.subscription.json or page.story.json. Products and collections can be assigned alternate templates in the editor. A request can also select an existing alternate with ?view=subscription.

Sections

A section receives a section object:

text
section.id
section.type
section.index
section.settings
section.blocks
section.attributes

Always put section.attributes on the meaningful section root when you want editor selection behavior. The outer Comflo wrapper already contains data-section-* attributes.

liquid
<section class="hero" {{ section.attributes }}>
  <h1>{{ section.settings.heading }}</h1>
</section>

Section-local blocks

liquid
{% for block in section.blocks %}
  <div {{ block.attributes }}>
    {% case block.type %}
      {% when 'heading' %}<h2>{{ block.settings.text }}</h2>
      {% when 'text' %}<div>{{ block.settings.content }}</div>
    {% endcase %}
  </div>
{% endfor %}

A block exposes id, type, settings, blocks, attributes, and theme. Disabled blocks are not included. Containers allow 50 blocks by default unless max_blocks is lower. Block nesting is limited to four levels including the section-to-block path.

Theme blocks

Theme blocks live in blocks/<type>.comflo and can be used by any section that declares:

json
"blocks": [{ "type": "@theme" }]

Render them with {% content_for 'blocks' %}. Theme blocks may themselves allow @theme blocks.

Snippets

Snippets live in snippets/ and use isolated render scope:

liquid
{% render 'product-card', product: product, show_button: true %}

Globals such as settings, shop, and routes remain available inside snippets. Explicitly pass local values such as product, section, or block for clarity.


12. Theme and section settings

Global settings are grouped in config/settings_schema.json:

json
[
  {
    "name": "Brand",
    "settings": [
      { "type": "text", "id": "store_name", "label": "Store name", "default": "My store" },
      { "type": "image", "id": "logo", "label": "Logo" },
      { "type": "color", "id": "accent", "label": "Accent", "default": "#14532d" }
    ]
  }
]

Section and block settings use the same definitions inside {% schema %}.

Supported setting types

text
text, textarea, richtext, inline_richtext, html, image, url,
video_url, video, color, color_scheme, font, range, number,
select, radio, checkbox, text_alignment, product, collection,
link_list, header, paragraph

All types except header and paragraph require a unique id within their setting list.

Common definition fields are:

text
type, id, label, content, default, info, options, min, max, step, unit

Behavior worth knowing:

  • product resolves its stored handle to a product object.
  • collection resolves its stored handle to a collection object.
  • richtext, inline_richtext, and html are sanitized before templates receive them.
  • text and textarea are HTML-escaped before templates receive them.
  • color accepts six-digit hex colors.
  • color_scheme accepts inherit or scheme-1 through scheme-4.
  • range and number are clamped to min and max when provided.
  • url, image, and video values accept internal paths, HTTPS, localhost HTTP, mailto:, tel:,

anchors, or empty values.

Full section schema

liquid
{% schema %}
{
  "name": "Feature grid",
  "category": "Content",
  "templates": ["index", "page"],
  "settings": [
    { "type": "text", "id": "heading", "label": "Heading", "default": "Why us" },
    { "type": "range", "id": "columns", "label": "Columns", "min": 2, "max": 4, "step": 1, "default": 3 }
  ],
  "blocks": [
    {
      "type": "feature",
      "name": "Feature",
      "limit": 4,
      "settings": [
        { "type": "text", "id": "title", "label": "Title", "default": "Fast delivery" },
        { "type": "textarea", "id": "text", "label": "Text" }
      ]
    }
  ],
  "max_blocks": 4,
  "presets": [
    {
      "name": "Feature grid",
      "blocks": [{ "type": "feature" }, { "type": "feature" }, { "type": "feature" }]
    }
  ]
}
{% endschema %}

group may be header or footer, restricting the section to that group. templates restricts the section to the listed base page types. presets make a section addable in the editor and provide initial settings and blocks.


13. Assets, CSS, JavaScript, images, and fonts

CSS and JavaScript

liquid
{{ 'theme.css' | asset_url | stylesheet_tag }}
{{ 'theme.js' | asset_url | script_tag }}

In editor previews, text assets are inlined. Live pages use versioned asset URLs. Do not hardcode the live asset route.

Theme JavaScript runs in the shopper's browser, not on the server. Use progressive enhancement, deferred scripts, event delegation, and accessible HTML that remains useful if JavaScript fails.

Packaged images

liquid
<img src="{{ 'hero.webp' | asset_url }}" alt="Coffee cup">

Merchant/media images

liquid
{% assign src = section.settings.image | image_url: width: 1200 %}
{% assign srcset = section.settings.image | image_srcset %}
<img src="{{ src }}"{% if srcset != blank %} srcset="{{ srcset }}"{% endif %}
     sizes="(max-width: 750px) 100vw, 50vw" alt="{{ section.settings.alt | escape }}"
     width="1200" height="800" loading="lazy">

Use explicit dimensions or aspect-ratio to prevent layout shifts. Use eager loading only for the actual above-the-fold image.

Fonts

The editor offers these font names:

text
Inter, DM Sans, Manrope, Outfit, Poppins, Plus Jakarta Sans,
Space Grotesk, Nunito, Fraunces, Playfair Display,
Cormorant Garamond, Lora, DM Serif Display,
Bricolage Grotesque, Syne, System
liquid
<link rel="stylesheet" href="{{ settings.heading_font | font_url: settings.body_font }}">
<style>:root { --font-heading: {{ settings.heading_font | font_family }}; }</style>

Self-hosted .woff and .woff2 files may also be packaged and referenced through asset_url in an @font-face rule.

Responsive design

Comflo does not prescribe a CSS framework. Prefer:

  • mobile-first media queries;
  • fluid type with clamp();
  • CSS Grid/Flexbox instead of absolute desktop-only positioning;
  • responsive images and sensible sizes;
  • visible focus states and keyboard-accessible controls;
  • testing at approximately 390 px, 768 px, and desktop widths in the editor.

14. Products, collections, cart, and forms

Product cards

liquid
<article class="product-card">
  <a href="{{ product.url }}">
    <img src="{{ product.featured_image | image_url: width: 700 }}"
         alt="{{ product.title | escape }}" loading="lazy">
    <h3>{{ product.title }}</h3>
  </a>
  <p>{{ product.price | money }}</p>
  <button type="button"
          data-comflo-add="{{ product.id }}"
          data-variant-id="{{ product.selected_or_first_available_variant.id }}"
          {% unless product.available %}disabled{% endunless %}>
    {% if product.available %}Add to cart{% else %}Sold out{% endif %}
  </button>
</article>

For production bundle behavior, start from the built-in snippets/product-card.comflo; it adds the bundle size, URL, title, and serialized flavour choices required by the runtime.

Product forms

The runtime handles a form with these hooks:

liquid
<form data-comflo-product-form data-product-id="{{ product.id }}">
  <input type="hidden" name="variant_id" value="{{ product.selected_or_first_available_variant.id }}">
  <input type="number" name="quantity" value="1" min="1" max="99">
  <button type="submit" data-add-button>Add to cart</button>
  <button type="submit" data-buy-now>Buy now</button>
  <p data-form-error role="alert" hidden></p>
</form>

Products with option combinations need the exact option-picker and data-variants structure used by the generated starter's snippets/product-form.comflo. Bundle selectors use data-flavour-slot. Subscription UI uses data-comflo-subscription-form, data-purchase-type, data-subscription-plans, and data-subscription-plan.

Open the cart

html
<button type="button" data-comflo-cart-open>
  Cart <span data-comflo-cart-count hidden>0</span>
</button>

There is no server-side cart template object in Theme API 1. The platform runtime creates and updates the cart drawer and shared checkout using the store's public API.

Lead/contact forms

html
<form data-comflo-lead-form data-source="contact-page">
  <label>Name <input name="name" required></label>
  <label>Phone <input name="phone" required></label>
  <label>Email <input name="email" type="email"></label>
  <label>Message <textarea name="message"></textarea></label>
  <button type="submit">Send</button>
  <p data-form-status role="status" hidden></p>
</form>

Supported fields include name, phone, email, company, message, repeated topics, and a short source. Name and phone are required by the runtime.

Other built-in runtime hooks

The generated starter themes demonstrate supported hooks for drawers, quantity steppers, galleries, sliders, collection sorting, product option selection, accordions, and popups. Cart, checkout, product-form, and lead-form hooks are implemented by assets/comflo-runtime.js; visual theme interactions such as drawers and sliders are implemented by the starter's assets/theme.js. When building from scratch, copy the relevant accessible markup from a current starter instead of guessing attributes.


15. Routes and page types

URLTemplateObject
/indexnone page-specific
/products/<handle>product or assigned alternateproduct, recommendations
/collectionscollectionsynthetic all-products collection
/collections/allcollectionsynthetic all-products collection
/collections/<handle>collection or assigned alternatecollection
/pages/<handle>page's selected templatepage
/search?q=<terms>searchsearch
anything else404none page-specific

Only visible pages resolve. Missing products, collections, and pages render the 404 template.


16. Complete starter storefront

The supported complete example is generated from the same files bundled into production:

bash
comflo theme init basic-store --from aurora --name "Basic Store"
cd basic-store
comflo theme validate
comflo theme dev

This produces a functional theme with:

  • global layout, metadata, header, navigation, footer, and responsive styling;
  • homepage sections and merchant-editable settings;
  • collection grid, sorting, and reusable product cards;
  • product gallery, variants, bundles, subscriptions, cart, and checkout;
  • content pages, contact/lead forms, search, and 404 handling;
  • packaged CSS/JavaScript, images, icons, locales, and editor schemas.

Because theme init copies the current built-in theme, this example cannot drift from the engine. Use it as the source of truth for complex runtime markup.

Build a new homepage section

Create sections/intro.comflo:

liquid
<section class="intro {{ section.settings.color_scheme }}" {{ section.attributes }}>
  <div class="page-width intro__inner">
    {% if section.settings.eyebrow != blank %}<p class="intro__eyebrow">{{ section.settings.eyebrow }}</p>{% endif %}
    <h1>{{ section.settings.heading }}</h1>
    <div class="intro__text">{{ section.settings.text }}</div>
    {% if section.settings.link != blank %}
      <a class="button" href="{{ section.settings.link }}">{{ section.settings.label }}</a>
    {% endif %}
  </div>
</section>

{% schema %}
{
  "name": "Introduction",
  "templates": ["index"],
  "settings": [
    { "type": "text", "id": "eyebrow", "label": "Eyebrow", "default": "Welcome" },
    { "type": "text", "id": "heading", "label": "Heading", "default": "Made for everyday life" },
    { "type": "richtext", "id": "text", "label": "Text", "default": "<p>Tell customers what makes the store special.</p>" },
    { "type": "text", "id": "label", "label": "Button label", "default": "Shop now" },
    { "type": "url", "id": "link", "label": "Button link", "default": "/collections/all" },
    { "type": "color_scheme", "id": "color_scheme", "label": "Colours", "default": "scheme-1" }
  ],
  "presets": [{ "name": "Introduction" }]
}
{% endschema %}

Add it to templates/index.json or use the theme editor after importing:

json
{
  "order": ["intro"],
  "sections": {
    "intro": { "type": "intro" }
  }
}

Add responsive styles to assets/theme.css, validate, and refresh the dev server.


17. Validate, package, and upload

bash
comflo theme validate
comflo theme package

Validation checks:

  1. Allowed paths, file types, sizes, and archive safety.
  2. Binary image/font signatures and data types.
  3. Required files and valid JSON.
  4. Manifest name, version, and Theme API compatibility.
  5. Known setting types and unique setting ids.
  6. Valid section and block schemas.
  7. Existing section/block references.
  8. Compilation of every .comflo file with the production engine.
  9. Rendering of homepage, ordinary product, bundle, collection, page, search, and 404 routes.

The package command writes <theme-name>-<version>.zip. Upload it under Store → Themes → Your themes → Upload ZIP. Importing creates an unpublished immutable theme version and never changes the live storefront.

Developer API workflow

Create a store secret key with Theme Development access, then:

bash
comflo login --store https://shop.example --key cfsk_live_...
comflo theme list
comflo theme push
comflo theme pull <theme-ref> ./downloaded-theme

For CI, use COMFLO_STORE and COMFLO_KEY. Do not commit either secret.

theme push validates and uploads a version. It does not publish. Uploading identical content is recognized as unchanged; uploading a changed package with the same theme identity creates a new version.


18. GitHub synchronization

  1. Put the theme folders at the repository root or in one subfolder.
  2. Commit and push the repository.
  3. In Comflo, open Store → Themes → Your themes → GitHub.
  4. Click Connect with GitHub and install the Comflo GitHub App for selected repositories.
  5. Select the repository, branch, and optional theme folder.
  6. Import the theme.

The first sync validates and stores an immutable version. Later pushes to the connected branch are verified by the GitHub App webhook and go through the same validation. A failed commit is recorded in the sync log and does not replace the previous valid version or live storefront.

GitHub updates never auto-publish. The merchant explicitly chooses a version, reviews the draft, and publishes it.

The platform GitHub App configuration is documented separately in docs/github-app.md.


19. Preview, publish, and roll back

Local preview

comflo theme dev uses demo data and never writes store data.

Store editor preview

Choose an imported theme with Use, then edit sections/settings in the editor. Autosave updates the unpublished draft only. Desktop, tablet, and mobile preview sizes use the real store catalogue.

Shareable preview

Click Share preview in the editor. Comflo saves the exact draft and creates a signed, tenant-bound, read-only link for the current route. The current implementation expires links after 15 minutes and returns noindex, nofollow responses.

Anyone holding a valid link can view that unpublished draft without admin access. Treat the URL as a temporary secret.

Publish and rollback

Publish validates and render-checks the saved draft, creates a numbered snapshot, and then atomically makes it live. Only one snapshot is live. Published versions remain available in the editor's history; restoring a version loads it into the draft for review and requires a later Publish action to make it live again.


20. Debugging

Use the validator first

bash
comflo theme validate

Errors include the theme path and, for template problems, the line number:

text
snippets/product-card.comflo:18  undefined filter: monies

Common problems

ProblemCause and fix
File ignored or rejectedUse lowercase allowed paths and .comflo, not .comflow
Missing required fileGenerate a starter and restore all required templates
undefined filterCheck the filter inventory; unknown filters are strict errors
Empty outputUnknown variables are not strict; check object availability for that page type
Section absent in editorAdd valid {% schema %} and at least one preset
Section rejected from pageCheck schema group and templates restrictions
Block does not renderAdd it to block_order; for theme blocks allow @theme and use content_for
Product add button does nothingUse supported data-comflo-* runtime markup
Asset works locally but not liveUse asset_url; do not hardcode /assets
Broken image proportionsSupply dimensions/aspect ratio and a correct responsive sizes value
GitHub sync failedOpen the package sync log; fix the reported commit/file/line and push again

Inspect generated HTML

Use browser developer tools for CSS and runtime behavior. Editor previews add design-mode, data-section-id, and data-block-id hooks. Do not depend on the editor bridge for live behavior; it exists only in design mode.


21. Security and performance

Security rules

  • Never put API keys, payment secrets, private customer data, or GitHub credentials in a theme.
  • Theme files are delivered to browsers; anything inside them is public.
  • Escape plain data in HTML attributes: {{ value | escape }}.
  • Merchant text settings are already escaped; rich text and HTML settings are sanitized.
  • Use sanitize_html for HTML assembled from values not already supplied as sanitized settings.
  • Do not build JavaScript with unescaped template strings. Prefer | json and replace < when

embedding JSON inside <script>.

  • Use rel="noopener" on external links opened in a new tab.
  • Do not use eval, new Function, cookie scraping, or external data exfiltration. Marketplace

checks may reject these patterns.

  • Forms must use Comflo's public runtime/API hooks. Do not collect payment card details in theme

code.

Performance rules

  • Keep loops bounded and avoid repeated full-catalog scans in nested loops.
  • Request appropriately sized images through image_url: width: and use image_srcset.
  • Lazy-load below-the-fold media.
  • Keep JavaScript small and deferred; prefer CSS for visual behavior.
  • Avoid large inline data structures. Theme files are limited to 500 KB each.
  • Preserve semantic markup and ensure the page remains useful before scripts initialize.
  • Run comflo theme validate; render-limit or timeout failures prevent import/publish.

22. Current limitations and planned work

These are not supported in the current implementation:

  • .comflow as a filename extension; only .comflo is accepted.
  • Arbitrary server-side code, network calls, filesystem access, or custom server filters/tags.
  • Shopify-only objects and APIs, including server-side cart, customer, metafields,

all_products, checkout objects, or Shopify form tags.

  • Nested navigation menus.
  • Multiple locales selected by the request; rendering currently uses en and the t filter reads

locales/en.json.

  • Pagination objects/tags for collections and search; current objects contain their result arrays.
  • A public npm release of @comflo/cli.
  • comflo theme dev --store against a remote store catalogue.
  • A CLI command that publishes directly; publishing remains an explicit admin action.

Document future features in a separate roadmap until the engine, validator, CLI, and live renderer all support them.


23. Reference limits

Allowed package paths

text
layout/theme.comflo
sections/[a-z0-9_-].comflo
blocks/[a-z0-9_-].comflo
snippets/[a-z0-9_-].comflo
templates/[a-z0-9_.-].json
config/theme.json
config/settings_schema.json
config/settings_data.json
locales/xx.json
locales/xx.schema.json
assets/[a-z0-9_.-].css
assets/[a-z0-9_.-].js
assets/[a-z0-9_.-].svg
assets/[a-z0-9_.-].png|jpg|jpeg|webp|gif|ico
assets/[a-z0-9_.-].woff|woff2

File basenames start with a lowercase letter or digit and are at most 61 characters before the extension under the current validator.

Size and design limits

LimitValue
Files per theme1,000
Text/package file500 KB
Uncompressed theme map10 MB
Uploaded ZIP10 MB
Code-editor file200 KB
All code-editor overrides1.5 MB
Templates per design60
Sections per page template40
Blocks per container50 unless schema lowers it
Block nesting4 levels
Store content pages50
Links per menu30
Product/collection template assignments2,000 each

Implementation sources

This document was verified against:

text
packages/theme-engine/src/render-core.ts
packages/theme-engine/src/theme-package.ts
packages/theme-engine/src/theme-schema.ts
packages/theme-engine/src/design.ts
packages/theme-engine/src/routes.ts
packages/theme-engine/src/theme-check.ts
packages/theme-engine/src/runtime/comflo-runtime.js
packages/theme-engine/src/themes/_shared/
packages/cli/src/cli.ts
packages/cli/src/dev-server.ts
apps/client-api/src/modules/store-theme/
apps/client-api/src/modules/storefront/storefront-site.service.ts

When the engine contract changes, update this guide in the same change and re-run the theme engine, CLI, built-in theme, ZIP, GitHub, and storefront render tests.

Related guides