Advanced
Comflo theme development
Build, validate and publish custom storefront themes with Comflo, the Theme CLI and Theme API 1.
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
- Naming and compatibility
- How rendering works
- Install the CLI
- Create and run a theme
- Theme package structure
- Language syntax
- Comflo tags
- Filters
- Global objects
- Page-specific objects
- Layouts, templates, sections, blocks, and snippets
- Theme and section settings
- Assets, CSS, JavaScript, images, and fonts
- Products, collections, cart, and forms
- Routes and page types
- Complete starter storefront
- Validate, package, and upload
- GitHub synchronization
- Preview, publish, and roll back
- Debugging
- Security and performance
- Current limitations and planned work
- Reference limits
1. Naming and compatibility
The product language may be called Comflo, but the implemented filename extension is `.comflo`:
layout/theme.comflo
sections/hero.comflo
snippets/product-card.comfloDo 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:
- Resolve the URL to a page type and template, such as
productorcollection.special. - Load the store's immutable theme version and overlay any code edits saved in the editor.
- Resolve theme, section, and block setting values against the store catalogue.
- Build plain-data objects for the shop, request, menus, products, collections, and current page.
- Render the template's enabled sections in order.
- Insert that HTML into
layout/theme.comfloascontent_for_layout. - Inject Comflo's cart, checkout, form, and editor-preview runtime.
- 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
| Behavior | Current value |
|---|---|
| Liquid implementation | LiquidJS 10.30.0 |
| Theme API | 1 |
| Truthiness | Liquid truthiness (false and nil are false; 0 and empty strings are true) |
| Unknown filters | Error (strictFilters: true) |
| Unknown variables | Empty (strictVariables: false) |
| Property access | Own properties only |
| Relative snippet references | Disabled |
| Template render limit | 2,500 operations |
| Template memory limit | 64 MB |
| Worker hard deadline | 5 seconds |
3. Install the CLI
The CLI currently runs from the Comflo monorepo and requires Node.js 20 or newer:
pnpm install
pnpm --filter @comflo/theme-engine build
pnpm --filter @comflo/cli build
alias comflo="node $(pwd)/packages/cli/dist/cli.js"
comflo --helpThe 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:
comflo theme init my-theme --from aurora --name "My Theme"
cd my-theme
comflo theme devAvailable bases are aurora, crema, and atelier. The dev server opens at http://localhost:9292 and reloads when files change.
Try these routes:
/
/products/ceylon-black-tea
/products/gift-bundle
/collections/all
/collections/coffee?sort_by=price-ascending
/pages/about
/search?q=tea
/a-missing-pageLocal 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:
comflo theme dev --port 93935. Theme package structure
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.jsonThe 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
{
"name": "My Theme",
"version": "0.1.0",
"api": 1,
"author": "Your studio",
"description": "A clean product-focused Comflo theme"
}nameis required.versionis required and must be semantic-version shaped, such as1.2.0or2.0.0-beta.1.apiis required and must be a supported integer. The current value is1.authoranddescriptionare optional for store imports but expected for marketplace themes.
6. Language syntax
Comflo supports LiquidJS's standard output, tag, expression, and filter syntax.
Output
<h1>{{ product.title }}</h1>
<p>{{ product.price | money }}</p>Use {{- and -}}, or {%- and -%}, to trim surrounding whitespace.
Variables and assignment
{% assign heading = section.settings.heading | default: shop.name %}
{% capture label %}Shop {{ collection.title }}{% endcapture %}
<h2>{{ heading }}</h2>Property and index access
{{ product.featured_image }}
{{ product.images[0].src }}
{{ settings['scheme_1_bg'] }}
{{ linklists[section.settings.menu].links }}Conditions
{% 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
{% 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:
{% for i in (1..4) %}<span>{{ i }}</span>{% endfor %}Use {% break %} and {% continue %} inside loops.
Comments and literal content
{% comment %}Not rendered{% endcomment %}
{% raw %}{{ this_is_displayed_literally }}{% endraw %}
{% # one-line Liquid comment %}Standard tags available
The engine currently registers these LiquidJS tags:
#, assign, block, break, capture, case, comment, continue, cycle,
decrement, echo, for, if, include, increment, layout, liquid, raw,
render, tablerow, unlessPrefer 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.
{% 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:
{% 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:
{% content_for 'blocks' %}Render one theme block by instance id:
{% 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
| Filter | Purpose | Example | ||
|---|---|---|---|---|
money | Cents to store-currency amount | `{{ product.price | money }}` | |
money_without_currency | Cents to numeric amount | `{{ product.price | money_without_currency }}` | |
image_url | Media URL; optional width: selects a variant | `{{ image | image_url: width: 800 }}` | |
image_srcset | Responsive media-library srcset, or empty | `{{ image | image_srcset }}` | |
asset_url | URL/data URL for a packaged asset | `{{ 'theme.css' | asset_url }}` | |
stylesheet_tag | Stylesheet link, or inline style in editor preview | `{{ 'theme.css' | asset_url | stylesheet_tag }}` |
script_tag | Deferred script, or inline script in editor preview | `{{ 'theme.js' | asset_url | script_tag }}` |
font_url | Google Fonts stylesheet URL for one or more names | `{{ settings.heading_font | font_url: settings.body_font }}` | |
font_family | Safe CSS font-family stack | `{{ settings.heading_font | font_family }}` | |
digits_only | Remove non-digits | `{{ settings.phone | digits_only }}` | |
css_safe | Remove style tags and < from CSS setting text | `{{ settings.custom_css | css_safe }}` | |
sanitize_html | Sanitize a block of merchant HTML | `{{ block.settings.html | sanitize_html }}` | |
handleize | Lowercase URL handle | `{{ title | handleize }}` | |
video_embed_url | YouTube/Vimeo URL to approved embed URL | `{{ section.settings.video | video_embed_url }}` | |
t | Look 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.
{{ 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
| Property | Type | Meaning |
|---|---|---|
shop.name | string | Store name |
shop.currency | string | Currency code, currently commonly LKR |
shop.url | string | Store URL supplied to the renderer |
request
| Property | Type | Meaning |
|---|---|---|
request.path | string | Current path |
request.page_type | string | index, product, collection, page, search, or 404 |
request.design_mode | boolean | True in editor/share preview rendering |
request.locale | string | Currently en |
routes
| Property | Current 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:
{% 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:
{% for collection in collections %}{{ collection.title }}{% endfor %}
{{ collections['coffee'].title }}
{{ collections.all.products_count }}SEO and page shell values
page_title
page_description
page_image
canonical_url
content_for_layout layout only
sort_options collection pages and anywhere else neededsort_options entries have value and name.
10. Page-specific objects
product
Available on product pages.
| Property | Type | Notes |
|---|---|---|
id | string | Platform product id |
title | string | Product name |
handle | string | URL handle |
url | string | /products/<handle> |
description | HTML string | Merchant product description |
price | integer | Lowest/current price in cents |
compare_at_price | integer or nil | Compare-at amount in cents |
available | boolean | Any purchasable inventory |
featured_image | string | Image URL |
images | image array | { src, alt } |
variants | variant array | See below |
selected_or_first_available_variant | variant or nil | Initial variant |
options_with_values | option array | Product option groups |
has_only_default_variant | boolean | True when no choice is needed |
is_bundle | boolean | Comflo flavour bundle |
bundle_size | integer | Required flavour slots |
flavour_options | array | { id, title, image } |
collections | string array | Collection handles |
created_at | ISO date string | Creation time |
seo | object, optional | { title, description } |
subscription_plans | array, optional | Subscription 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.
| Property | Type |
|---|---|
id, title, handle, url, description, image | string |
products | product array |
products_count | integer |
sort_by | string, 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>:
page.title
page.handle
page.content sanitized rich HTMLsearch
Available on /search:
search.performed
search.terms
search.results
search.results_countSearch 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:
<!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:
{
"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:
section.id
section.type
section.index
section.settings
section.blocks
section.attributesAlways put section.attributes on the meaningful section root when you want editor selection behavior. The outer Comflo wrapper already contains data-section-* attributes.
<section class="hero" {{ section.attributes }}>
<h1>{{ section.settings.heading }}</h1>
</section>Section-local blocks
{% 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:
"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:
{% 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:
[
{
"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, 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, paragraphAll types except header and paragraph require a unique id within their setting list.
Common definition fields are:
type, id, label, content, default, info, options, min, max, step, unitBehavior worth knowing:
productresolves its stored handle to a product object.collectionresolves its stored handle to a collection object.richtext,inline_richtext, andhtmlare sanitized before templates receive them.textandtextareaare HTML-escaped before templates receive them.coloraccepts six-digit hex colors.color_schemeacceptsinheritorscheme-1throughscheme-4.rangeandnumberare clamped tominandmaxwhen provided.url, image, and video values accept internal paths, HTTPS, localhost HTTP,mailto:,tel:,
anchors, or empty values.
Full section schema
{% 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
{{ '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
<img src="{{ 'hero.webp' | asset_url }}" alt="Coffee cup">Merchant/media images
{% 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:
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<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
<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:
<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
<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
<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
| URL | Template | Object |
|---|---|---|
/ | index | none page-specific |
/products/<handle> | product or assigned alternate | product, recommendations |
/collections | collection | synthetic all-products collection |
/collections/all | collection | synthetic all-products collection |
/collections/<handle> | collection or assigned alternate | collection |
/pages/<handle> | page's selected template | page |
/search?q=<terms> | search | search |
| anything else | 404 | none 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:
comflo theme init basic-store --from aurora --name "Basic Store"
cd basic-store
comflo theme validate
comflo theme devThis 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:
<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:
{
"order": ["intro"],
"sections": {
"intro": { "type": "intro" }
}
}Add responsive styles to assets/theme.css, validate, and refresh the dev server.
17. Validate, package, and upload
comflo theme validate
comflo theme packageValidation checks:
- Allowed paths, file types, sizes, and archive safety.
- Binary image/font signatures and data types.
- Required files and valid JSON.
- Manifest name, version, and Theme API compatibility.
- Known setting types and unique setting ids.
- Valid section and block schemas.
- Existing section/block references.
- Compilation of every
.comflofile with the production engine. - 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:
comflo login --store https://shop.example --key cfsk_live_...
comflo theme list
comflo theme push
comflo theme pull <theme-ref> ./downloaded-themeFor 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
- Put the theme folders at the repository root or in one subfolder.
- Commit and push the repository.
- In Comflo, open Store → Themes → Your themes → GitHub.
- Click Connect with GitHub and install the Comflo GitHub App for selected repositories.
- Select the repository, branch, and optional theme folder.
- 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
comflo theme validateErrors include the theme path and, for template problems, the line number:
snippets/product-card.comflo:18 undefined filter: moniesCommon problems
| Problem | Cause and fix |
|---|---|
| File ignored or rejected | Use lowercase allowed paths and .comflo, not .comflow |
| Missing required file | Generate a starter and restore all required templates |
undefined filter | Check the filter inventory; unknown filters are strict errors |
| Empty output | Unknown variables are not strict; check object availability for that page type |
| Section absent in editor | Add valid {% schema %} and at least one preset |
| Section rejected from page | Check schema group and templates restrictions |
| Block does not render | Add it to block_order; for theme blocks allow @theme and use content_for |
| Product add button does nothing | Use supported data-comflo-* runtime markup |
| Asset works locally but not live | Use asset_url; do not hardcode /assets |
| Broken image proportions | Supply dimensions/aspect ratio and a correct responsive sizes value |
| GitHub sync failed | Open 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
textsettings are already escaped; rich text and HTML settings are sanitized. - Use
sanitize_htmlfor HTML assembled from values not already supplied as sanitized settings. - Do not build JavaScript with unescaped template strings. Prefer
| jsonand 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 useimage_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:
.comflowas a filename extension; only.comflois 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
enand thetfilter 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 --storeagainst 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
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|woff2File 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
| Limit | Value |
|---|---|
| Files per theme | 1,000 |
| Text/package file | 500 KB |
| Uncompressed theme map | 10 MB |
| Uploaded ZIP | 10 MB |
| Code-editor file | 200 KB |
| All code-editor overrides | 1.5 MB |
| Templates per design | 60 |
| Sections per page template | 40 |
| Blocks per container | 50 unless schema lowers it |
| Block nesting | 4 levels |
| Store content pages | 50 |
| Links per menu | 30 |
| Product/collection template assignments | 2,000 each |
Implementation sources
This document was verified against:
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.tsWhen 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.