Skip to content
New Webhooks added: Inventory and Order modifications. Check the changelog →
Cartly Developers

Theme Development

Build custom Liquid themes for Cartly. Understand the three-layer resolver, fork-on-write semantics, section schema, and how the code editor tracks your customizations.

Architecture

Cartly themes use a three-layer file resolver. Every file request — from the storefront renderer or the code editor — is checked in order: (1) DB row (merchant fork), (2) Platform embed FS (current binary bundle at backend/internal/theme/embed/), (3) Boilerplate FS (legacy fallback).

Fork-on-write: no DB row is created until the merchant explicitly saves an edit. Platform updates flow automatically into all unforked stock files on every deploy.

Code Editor Workflow

File tree badges: Synced (stock embed), Custom (merchant forked), New (merchant-created). Filter with All / Modified / Synced chips. To fork: click a Synced file → click Edit file or press ⌘E → confirm in the modal. First save creates the DB row and records the upstream_hash.

Amber Upstream updated banner appears when the platform ships a new embed version of a file you forked. Use View diff (Monaco diff editor with hide-unchanged-regions) or Sync upstream to revert.

Section Schema

Every sections/*.liquid file must end with a {%- schema -%} block. The presets array is required — without it the section is invisible in the + Add panel.

Setting types

typeWidget
textSingle-line input
textareaMulti-line
image_pickerMedia selector
colorColor picker
rangeSlider (min/max/step)
selectDropdown (options array)
checkboxToggle
urlURL input
productProduct typeahead
collectionCollection typeahead

Inline Editing

Add data-cartly-edit="<settingId>" to any element to make it directly editable in the visual editor preview iframe. For block settings also add data-block-id="{{ block.id }}".

API Reference

MethodPathDescription
GET/admin/theme/library/:id/filesList all files with source, badges, upstream_changed
GET/admin/theme/library/:id/files/:keyGet single file including embed_content for diff
PUT/admin/theme/library/:id/files/:keyCreate or update (fork) a file — CAS via version
DELETE/admin/theme/library/:id/files/:keyDelete or revert — body: action reverted|deleted
GET/admin/theme/library/:id/sections-sourceBulk sections metadata (DB union embed)
GET/admin/theme/library/:id/eventsSSE stream of file-save events
POST/admin/theme/library/:id/preview-tokenGenerate signed 15-minute preview token

All /admin/* endpoints require Authorization: Bearer <admin-jwt>. The :key parameter must be URL-encoded, e.g. sections%2Fhero.liquid.

Full Theme Development guide →