Skip to content
Hekana Spray
Documentation
Getting started
Theme development
Components and tags

Localization

Apps and custom code

Examples and recipes
API reference
Publishing
Build apps
AI development

Getting started

Install the Sneferu CLI, create a theme with init, preview it with dev, check it with validate and compile it with build.

On this page

Sneferu is the language and SDK for Hekana store themes. A theme is a folder of HTML-like .snf templates with hk-* tags, a theme.json manifest, locale files and CSS. The CLI checks it, previews it with sample data and compiles it to one JSON artifact that Hekana renders.

Prerequisites

NeedVersion
Node.js20 or newer (node -v)
An editorany; .snf files are HTML, so HTML highlighting works. Format your theme sets up Prettier and format on save

Create a theme

bash
npx sneferu init my-theme
cd my-theme

init copies the starter theme into my-theme/ and sets theme.json id from the folder name (my-theme) and name to its title case (My Theme). It refuses a non-empty folder unless you pass --force.

To skip npx, install the CLI once: npm i -g sneferu. It is then available as sneferu (or the short snf), for example sneferu dev my-theme. npm create sneferu my-theme does the same as npx sneferu init my-theme. sneferu is a short name for the @hekana/sneferu package; both install the same tool.

Start from a template

init takes a template name. The default, starter, is the SDK's own complete store; the others are finished example themes, each with its own design on every page.

bash
npx sneferu init my-shop --template arcade
npx sneferu init --list
TemplateWhat you get
starterA neutral complete store: header, footer, every page type, tokens to edit. The default
arcadeGaming: neon cyan and lime on near-black, for game gift cards and top-ups
consoleGaming: clean and light, for console games and subscriptions
esportsGaming: bold and loud, for tournaments, teams and gear
creatorDigital: minimal, for a creator selling files, courses and presets
licenseDigital: dark SaaS look, for software licenses and plans
bentoDigital: soft bento tiles, for apps and templates

A template is a normal theme folder. It has a template for every page type (home, product, collection, search, cart, 404, content page), header, footer and announcement bar as section groups, theme settings, and Arabic and English locale files, so nothing falls back to the SDK's default store. init sets the theme id and name from the folder name and leaves everything else yours to change. sneferu validate, format --check and build pass on a fresh copy. A name that is not in the list prints the list and exits with an error.

Preview: dev

bash
npx sneferu dev            # current folder
npx sneferu dev ./my-theme --port 4200
Result
The top of the dev preview straight after init, 1080 px wide. The products and prices are the preview's sample data.

Open http://127.0.0.1:4100. A new theme looks like the picture: the starter's hero section and a grid of sample products, in English, left to right.

WhatDetail
Addresshttp://127.0.0.1:4100 (local only; --port changes the port)
LanguageThe theme's defaultLocale. ?locale=<code> shows another locale the theme lists in locales
Other templateshttp://127.0.0.1:4100/__template/<name> renders templates/<name>.snf
Live reloadSaving any file recompiles and reloads the open page
ErrorsA theme that does not compile shows the diagnostics list instead of the page
CSSEvery assets/*.css file (top level of assets/) is inlined after the token variables
Assetsasset_url('logo.svg') points at /__assets/logo.svg

The preview uses sample data, not a real store:

DataSample value
store.nameSample store
CurrencyEGP, so money prints EGP 520.00
collection('featured'), 'new', 'gift-cards', 'subscriptions'4 to 6 products each, with title, url (/products/<handle>, or /en/products/<handle> in English), price (piastres), compare_at, image.url
product('sample-1')the first of those products
Theme settingsevery setting at its default
Sectionsthe default sections listed in the template's <hk-schema> (see chapter 3)

Any other collection is empty and any other product is nothing, which is a good way to check your empty states.

Your own sample data

To preview with products like your store's, put a .sneferu-dev/data.json in the theme folder (or pass --data <file>). Folders starting with a dot are never part of the theme and are never pushed.

.sneferu-dev/data.jsonJSON
{
  "store": { "name": "Pages" },
  "collections": {
    "ebooks": {
      "title": "E-books",
      "products": [
        { "title": "Notes on design", "url": "/products/notes", "price": 9900,
          "compare_at": null, "image": { "url": "https://example.com/notes.png" } }
      ]
    }
  }
}
KeyEffect
storemerged over the sample store, e.g. store.name
collectionsadded to the sample collections; a handle you list (even featured) replaces the sample one
productsadded to the product('handle') lookups, keyed by handle; a product has a page at /products/<handle> only when it is listed here
menusmenus by handle, { "handle", "title", "items": [{ "title", "url", "children"? }] }; they replace the sample main and footer

Local images in sample data

hk-image renders only https:// and store-relative (/…) URLs, in sneferu dev and on a store alike. So that sample data can use pictures you have on disk, the dev server also accepts a relative file path in any image value of data.json:

.sneferu-dev/data.jsonJSON
{ "products": { "notes": { "title": "Notes", "price": 9900, "image": { "url": "images/notes.webp" } } } }

The path is looked up next to data.json first (so put pictures in .sneferu-dev/images/), then from the theme folder. A file found inside the theme folder is served under /__dev-images/<path> and shown. Only .png, .jpg, .jpeg, .webp, .gif, .avif and .svg files inside the theme folder are served, and only by sneferu dev: nothing about hk-image or a published theme changes, and these files are not part of the package.

A value that would be dropped (an http:// URL, a //host/… URL, a path with no file behind it, a path outside the theme folder) is not hidden: sneferu dev prints a warning naming it, once per value.

For different text per language, split the file by locale: { "ar": { "store": … }, "en": { "store": … } }. The file is read on every request: save it and reload the page. A file that is not valid JSON shows an error page naming the file.

init writes a complete store: a layout with header, footer and announcement groups, a template for every page type (home, product, collection, search, cart, page, 404), the sections, blocks and snippets they use, tokens in theme.json and assets/theme.css. npx sneferu init --template starter is the same thing. Everything in it is editable by the merchant: see Make everything editable.

Check: validate

bash
npx sneferu validate
code
✔ theme [email protected] is valid

or, with problems, one line per diagnostic and a non-zero exit code:

code
sections/hero.snf:3:5 error SN2004 unknown property "colour" on <hk-heading>. Did you mean "color"?
✖ 1 error, 0 warnings

Format: file:line:col severity CODE message. Every code is listed in diagnostics.md. validate exits 0 when valid and 1 when not, so it can gate CI.

Compile: build

bash
npx sneferu build            # → dist/my-theme-0.1.0.sneferu.json
npx sneferu build --out out  # another output folder

build runs the same checks as validate, writes <out>/<id>-<version>.sneferu.json (the artifact) and copies assets/ to <out>/assets/. It prints the artifact hash. You do not upload this file: sneferu push sends the source and Hekana compiles it itself (see chapter 7).

Commands

CommandArgumentsOptions
init [dir]folder to create, default my-theme--force write into a non-empty folder; --template <name> what to scaffold (default starter); --list list the templates. Also writes an AGENTS.md for AI coding agents (see Build themes with AI agents)
dev [dir]theme folder, default .--port <n> default 4100; --data <file> sample data JSON, default .sneferu-dev/data.json when it exists
validate [dir]theme folder, default .
build [dir]theme folder, default .--out <dir> default dist
format [dir]theme folder, default .--check only report files that are not formatted and exit 1 (for CI). Formats .snf files, theme.json and locales/ with Prettier and the Sneferu plugin; see Format your theme
login--api-url <url> API to sign in to, default https://api.hekana.com/api/v1. Signs in through the browser and saves a developer key to ~/.config/sneferu/credentials.json; revokes the previously saved key for the same API
logoutrevokes the saved key on Hekana and deletes the file
whoamiprints the account, key prefix and dev store the CLI uses
push [dir]theme folder, default .--package <slug> required, must equal theme.json id, and not a reserved slug (starter, hekana, default, admin, official, theme, themes, test, demo, preview, and anything starting with hekana-); --dev-store also installs and publishes the version on your dev store and prints its URL. Uses the key saved by login, or env HEKANA_TOKEN; env HEKANA_API_URL

login, logout, whoami and push are covered in Get an API key and Push and publish.

Next

  1. Theme structure: what every file does.
  2. Sections and blocks: the parts merchants edit.
  3. Data and expressions: {{ }}, filters, loops.
  4. Styling and responsive: tokens, CSS, RTL.
  5. Security and limits: what a theme cannot do.
  6. Get an API key: developer access, sneferu login, CI. Push and publish: sneferu push, your dev store, review.
  7. Cookbook: five complete store sections, with pictures. Format your theme: sneferu format, Prettier and VS Code.
  8. Tutorial: build a digital products store theme: a whole theme, from mockup to live store. Tutorial: build a gaming store theme: another whole theme, a dark gaming top-up store.
  9. Tag reference: every hk-* tag and prop.

Next steps