Developer docs
Theme spec
In short
The complete theme format, every token and list, the product model and every rule the checks enforce.
This is the complete contract for a storefront theme. Give it to the AI you build with. A theme that follows it passes dftheme check, and a theme that passes dftheme check passes the platform's automated checks: they are the same code.
A theme is HTML, CSS and JavaScript for the marketing pages of a telehealth store. Each page runs in an isolated frame inside the store: it has no cookies, no storage, no session, and no network except the hosts the theme declares. Checkout, the cart, the account, the consultation and the legal pages are drawn by the platform and cannot be themed.
Package layout
theme.json the manifest
assets/theme.css shared styles, prepended to every page's own
assets/theme.js shared script, prepended to every page's own (optional)
templates/<page>.html|.css|.js one per page below
templates/pages/<slug>.html|... extra content pages, served at /<slug>
patterns/<category>/product.html a category's own product page (optional)
patterns/<category>/collection.html a category's own collection page (optional)
snippets/<name>.html reusable markup:
Text files only (html, css, js, json, md, txt), at most 200 files and 2048KB in all, each compiled page under 512KB. Images are https addresses, never files in the package.
theme.json
{
"formatVersion": 1,
"slug": "my-theme",
"name": "My Theme",
"version": "1.0.0",
"tagline": "One line for the marketplace card.",
"description": "What it looks like and who it suits.",
"author": {
"name": "Your name",
"url": "https://example.com"
},
"priceCents": 4900,
"categories": [
"weight-loss",
"trt"
],
"styles": [
"clinical"
],
"tokens": {
"primary": "#1f6f5c",
"accent": "#e0a458",
"surface": "light",
"fontPairing": "modern",
"radius": "soft",
"motion": "subtle"
},
"previewImages": [
"https://example.com/home.png"
],
"network": {
"connect": [],
"scripts": []
},
"changelog": "What changed in this version."
}
slug: 2 to 48 lowercase letters, numbers and dashes. Fixed for the life of the theme.version: semantic version. Each version sent for review must be higher than the last.priceCents: 0 for free, or 500 to 100000 (USD 5 to 1,000), one-time.categories: any ofweight-loss,trt,hair-loss,skin,sexual-health,menopause,longevity,supplements.styles: up to four ofminimal,clinical,editorial,bold,warm,luxury,playful,dark,apothecary,modern.tokens: the theme's default look. On install the merchant keeps their own brand colors or takes these; fonts, corners, motion and surface come from the theme.network.connect/network.scripts: https hosts (no path, no wildcard) your script may call or load scripts from. The merchant sees the list before installing. Everything else is blocked by the page's security policy.
Pages
templates/home.html(required): The store's front page. Stored ashome.templates/product.html(required): One layout for every product. The platform fills in the product in the address. Stored asproduct_detail.templates/collection.html(required): One layout for every category page.productsis the category's products. Stored ascollection.templates/bundle.html: The product page a bundle gets. Reads the sameproduct.*tokens, plus thebundleItemslist. Stored asproduct_detail@bundle.templates/about.html: About the store. Stored asabout.templates/contact.html: How to reach the store. Link to{{store.contactHref}}; a page cannot post a form. Stored ascontact.templates/faq.html: Questions and answers, served at /faq. Stored asfaq.
Never: account, auth, cart, checkout, consultation, flow, intake, legal, login, orders, policies, privacy, reintake, safety, signup, start, terms, visit.
Category design patterns
A store's categories are mapped onto design categories by their names. A product in a TRT category is served patterns/trt/product.html when the theme has one, and templates/product.html otherwise; the same for collection pages. Give a category its own layout, imagery and tone without branching in one template.
weight-loss: Weight losstrt: Testosterone (TRT)hair-loss: Hair lossskin: Skinsexual-health: Sexual healthmenopause: Menopauselongevity: Longevity and peptidessupplements: Supplements- anything else is
generaland gets the plain template.
Data: tokens and lists
Write {{scope.name}}; the platform fills it in, HTML-escaped. Repeat with <template data-df-each="list">...{{item.name}}...</template>. <template data-df-if="list"> renders once when the list has items (the first is item), data-df-unless when it is empty. Scope a list to a store category with data-df-category="slug" or data-df-if="products:slug". Nothing else: no expressions, no filters. A token a page cannot use is refused by the checks.
home
{{store.name}}: The brand name.{{store.productsHref}}: The catalog page.{{store.cartHref}}: The cart.{{store.startHref}}: Start a consultation, with no product chosen.{{store.contactHref}}: The store's contact page.{{compliance.prescriberNotice}}: A page offering a prescription treatment has to say that a licensed provider decides, and may decide the treatment is not right. Writing your own version of this is what gets a store asked about.{{compliance.disclaimer}}: Every public page carries it. It is what makes clear the store is not giving medical advice.- Lists:
products,bundles,collections,programs - Must carry:
{{compliance.prescriberNotice}},{{compliance.disclaimer}}
product (also bundle and product patterns)
{{store.name}}: The brand name.{{store.productsHref}}: The catalog page.{{store.cartHref}}: The cart.{{store.startHref}}: Start a consultation, with no product chosen.{{store.contactHref}}: The store's contact page.{{product.name}}: The product's name.{{product.price}}: Formatted price, e.g. $149.00. Empty when the price is set after review.{{product.compareAtPrice}}: The struck-through price, or empty.{{product.description}}: Plain-text description.{{product.descriptionHtml}}: The description as the merchant formatted it. Safe to drop into markup.{{product.imageUrl}}: The main image. Empty when the product has none.{{product.ctaHref}}: Where the buy button goes: the cart for an over-the-counter product, the consultation for a prescription one.{{product.ctaLabel}}: "Add to cart" or "Start your consultation", matching ctaHref.{{product.form}}: Dose form, e.g. "Injection". Empty when unset.{{product.safetyInfo}}: The product's own safety text, or empty.{{product.videoHtml}}: The product's first video as a ready-made player (press to play, never autoplays). Empty when it has none.{{product.kind}}: "product" or "bundle".{{product.shortDescription}}: The description's first sentence, at most 160 characters.{{product.fromPrice}}: The lowest price a customer can pay (the cheapest dose), formatted. Empty when unpriced.{{product.dosageForm}}: Normalized dose form: tablet, capsule, odt, troche, injection_vial, pen, prefilled_syringe, cream, gel, foam, ointment, solution, spray, drops, patch, kit, powder, gummy, other. Empty when unknown or for a bundle.{{product.dosageFormLabel}}: The dose form in words, e.g. "Injection pen".{{product.formFamily}}: oral, injectable, topical, nasal, kit, bundle or other: the design pattern a product card or page takes.{{product.route}}: oral, injection, topical, nasal or other.{{product.routeLabel}}: How it is taken, in words, e.g. "By mouth".{{product.frequency}}: daily, twice_daily, weekly, monthly, as_needed, or empty, from the directions.{{product.frequencyLabel}}: How often, in words, e.g. "Once a week". Empty when the directions do not say.{{product.strengths}}: The doses on offer, e.g. "0.25 mg, 0.5 mg, 1 mg". Empty for a single dose.{{product.category}}: The name of the product's first category.{{product.designCategory}}: The design category: weight-loss, trt, hair-loss, skin, sexual-health, menopause, longevity, supplements or general.{{product.rxStatus}}: "rx" for a prescription product, "otc" otherwise.{{product.requiresPrescription}}: "Prescription required" for an Rx product, otherwise empty.{{product.availability}}: Where it can be shipped, in words, e.g. "Available in 41 states".{{product.membership}}: The membership the product needs, by name, or empty.{{compliance.productSafety}}: The product's safety information as a platform component: the monograph's wording, never the theme's. Place and space it; it cannot be restyled away. Required on every product page a theme ships.{{compliance.prescriberNotice}}: A page offering a prescription treatment has to say that a licensed provider decides, and may decide the treatment is not right. Writing your own version of this is what gets a store asked about.{{compliance.disclaimer}}: Every public page carries it. It is what makes clear the store is not giving medical advice.- Lists:
products,variants,videos,bundleItems,bundles,collections,programs - Must carry:
{{compliance.prescriberNotice}},{{compliance.disclaimer}},{{compliance.productSafety}}
collection (also collection patterns)
{{store.name}}: The brand name.{{store.productsHref}}: The catalog page.{{store.cartHref}}: The cart.{{store.startHref}}: Start a consultation, with no product chosen.{{store.contactHref}}: The store's contact page.{{collection.name}}: The category in the address.{{collection.description}}: The category's description, or empty.{{collection.count}}: How many items are in it.{{compliance.prescriberNotice}}: A page offering a prescription treatment has to say that a licensed provider decides, and may decide the treatment is not right. Writing your own version of this is what gets a store asked about.{{compliance.disclaimer}}: Every public page carries it. It is what makes clear the store is not giving medical advice.- Lists:
products,bundles,collections,programs - Must carry:
{{compliance.prescriberNotice}},{{compliance.disclaimer}}
about (also contact, faq and extra pages)
{{store.name}}: The brand name.{{store.productsHref}}: The catalog page.{{store.cartHref}}: The cart.{{store.startHref}}: Start a consultation, with no product chosen.{{store.contactHref}}: The store's contact page.{{compliance.disclaimer}}: Every public page carries it. It is what makes clear the store is not giving medical advice.- Lists:
products,bundles,collections,programs - Must carry:
{{compliance.disclaimer}}
Inside a list (item.*)
{{item.name}}: The item's name.{{item.price}}: Formatted price, or empty when it is set after review.{{item.compareAtPrice}}: The struck-through price, or empty.{{item.description}}: Plain-text description.{{item.imageUrl}}: The item's image, or empty.{{item.href}}: The item's own page.{{item.ctaHref}}: The cart, or the consultation for a prescription item.{{item.ctaLabel}}: The label matching ctaHref.{{item.badge}}: "Prescription" for an Rx item, otherwise empty.{{item.kind}}: "product" or "bundle" in the products and bundles lists.{{item.fromPrice}}: The lowest price a customer can pay, formatted.{{item.dosageForm}}: Normalized dose form (see product.dosageForm).{{item.dosageFormLabel}}: The dose form in words.{{item.formFamily}}: oral, injectable, topical, nasal, kit, bundle or other.{{item.designCategory}}: The item's design category.{{item.rxStatus}}: "rx" or "otc".
Lists
products: On a collection page, the products in that category. Everywhere else, the store's published products.variants: On a product page, the product's dose steps:item.nameis the step,item.priceits price,item.imageUrlits own picture when it has one. Empty for a product with one dose.videos: On a product page, the product's videos:item.videoHtmlis the player,item.namethe title,item.descriptionits description,item.imageUrlits poster anditem.videoUrlthe video's address. Empty for a product with no videos.bundleItems: On a bundle's page, the products in it:item.name,item.description,item.imageUrl,item.dosageForm,item.formFamilyanditem.href. Empty on a product.bundles: The store's published bundles.collections: The store's categories.item.hrefis the category's page.programs: The store's membership programs.item.priceis the monthly fee,item.compareAtPricethe first month when it differs, anditem.badgeany minimum term.
The product model
Normalized by the platform from each merchant's catalog, so a design can key off it. Values are lowercase identifiers, safe in a class name: <article class="card card--{{item.formFamily}}">.
- dosageForm:
tablet,capsule,odt,troche,injection_vial,pen,prefilled_syringe,cream,gel,foam,ointment,solution,spray,drops,patch,kit,powder,gummy,other - formFamily:
oral,injectable,topical,nasal,kit,bundle,other - route:
oral,injection,topical,nasal,other - frequency:
daily,twice_daily,weekly,monthly,as_needed, or empty - designCategory:
weight-loss,trt,hair-loss,skin,sexual-health,menopause,longevity,supplements,general - rxStatus:
rx,otc
Brand colors
The merchant's brand reaches every page as CSS variables on :root. Use them for every brand color, with your default as the fallback, so the theme re-skins to any store: background: var(--st-color-primary, #1f6f5c);. A stylesheet that never reads --st-color-primary or --st-color-accent is refused.
--st-color-primary--st-color-primary-foreground--st-color-primary-soft--st-color-primary-strong--st-color-accent--st-color-accent-foreground--st-color-background--st-color-surface--st-color-ink--st-color-ink-muted--st-color-border--st-font-heading--st-font-body--st-radius-sm--st-radius-md--st-radius-lg--st-radius-pill--st-motion-multiplier--st-motion-duration
Platform components
The compliance statements and the product safety information are the platform's: .df-prescriber-notice, .df-disclaimer, .df-safety-information, .df-product-safety. Place them with their token and style their spacing, border, background and type. Never hide, shrink, clip, move out of the flow, or touch them from script.
Rules the checks enforce
- theme.json is complete and valid; home, product and collection templates exist.
- Every page carries its required statements; every product page places
{{compliance.productSafety}}. - Only known tokens and lists; category scopes are slugs.
- No card, password, date-of-birth or ID fields; no form that posts; no iframes, plugins,
<base>or<meta http-equiv>. - No claim language: guarantees, "no prescription needed", "FDA approved", sameness with a brand-name drug, star ratings.
- Accessible: one h1, alt on images, named links, buttons and fields, no positive tabindex, no autoplay, a visible focus style, motion inside prefers-reduced-motion.
- Nothing anywhere names the platform: stores carry only the merchant's brand.
- CSS reads the brand variables and never hides a platform component; https only; no expression() or bindings.
- Script: no eval or new Function, no obfuscation, no cookies or storage, no parent/top/opener or postMessage, no workers, no location, camera, credentials or payment APIs, no touching platform components, network only to declared hosts.
Every marketplace version is also reviewed by a person before it is listed.
Workflow
npx @dispenseflow/theme-cli init my-theme # a starter theme that passes every check
npx dftheme dev # preview with sample data per category, reloads on save
npx dftheme check # the platform's checks, offline
npx dftheme package # my-theme-1.0.0.zip
DFTHEME_API_KEY=dfdev_... npx dftheme push # upload a version to your developer account