Theme structure
Every folder and file in a Sneferu theme: theme.json, layout, templates, sections, blocks, snippets, assets, locales and size limits.
On this page
my-theme/
├── theme.json manifest (required)
├── layout/
│ └── theme.snf page frame (required)
├── templates/
│ └── index.snf home page (required); one file per page type
├── groups/<name>.json first content of the shared header, footer, announcement
├── sections/*.snf page parts merchants add, reorder and configure
├── blocks/*.snf repeatable items inside a section
├── snippets/*.snf partials for {% render %}
├── assets/ css, js, images, fonts
├── locales/
│ └── en.json UI strings, one file per locale
└── migrations/*.json settings migrations (reserved)node_modules/, dist/, .git/, .sneferu-dev/ and .DS_Store are ignored by
the CLI, and so are, at the top of the folder only, package.json and lock files,
README.md, LICENSE, CHANGELOG.md, AGENTS.md, CLAUDE.md and a docs/
folder (for notes, screenshots and AI agent instructions). None of these is checked or pushed. Anything else in the folder is
part of the theme and is checked.
Files and what they are for
| Path | Role | Notes |
|---|---|---|
theme.json | Identity, version, design tokens, theme-wide settings | See the field table below |
layout/theme.snf | Wraps every page: header, footer, and <hk-slot name="content" /> where the page goes | Exactly this file name |
templates/<name>.snf | A page type. Usually <hk-sections /> plus a <hk-schema> listing the default sections | index is required. Also product, collection, search, cart, page, 404 (and alternates such as product.codes); a page type you do not write comes from the SDK's default store. See Page types |
groups/<name>.json | The sections a store starts with in a shared group (header, footer, announcement) | See Section groups |
sections/<type>.snf | A section type. File name = type (sections/hero.snf is type hero). Has a <hk-schema> with name and settings | Rendered inside <div data-hk-section="<id>"> |
blocks/<type>.snf | An item a merchant can add inside a section (a quote, a slide, a feature) | Rendered inside <div data-hk-block="<id>"> |
snippets/<name>.snf | A reusable partial, no schema | {% render 'name', key: value %} |
assets/ | CSS, JS, images, fonts: .css .js .png .jpg .jpeg .webp .avif .gif .svg .woff .woff2 .ttf .otf .ico | The only folder that may have sub-folders. assets/*.css is the theme stylesheet. Font files are accepted but not served on the store: use tokens.fonts |
locales/<xx>.json | Flat { "key": "text" } maps, values strings only | Used by t('key') and | t |
migrations/*.json | Settings migrations between theme versions | Accepted, not used yet |
Section, block and snippet file names may not start with hk- (SN3043): that prefix is reserved
for the default store's own sections, blocks and snippets, which a theme borrows under hk-<name>.
A minimal layout:
<header class="site-header">
<hk-container><a href="/" class="logo">{{ store.name }}</a></hk-container>
</header>
<main><hk-slot name="content" /></main>
<footer class="site-footer">
<hk-container><hk-text text="{{ store.name }}" size="14" /></hk-container>
</footer>A template:
<hk-sections />
<hk-schema>{"sections":[
{"type":"hero","settings":{"title":"Welcome"}},
{"type":"featured"}
]}</hk-schema><hk-slot> and <hk-sections /> are allowed only in the layout and in
templates (SN2011).
theme.json
{
"id": "nile-fashion",
"name": "Nile Fashion",
"description": "A theme for clothing stores",
"version": "1.0.0",
"author": "Hekana",
"category": "fashion",
"engine": "hk2",
"engineCompatibility": "^2.0.0",
"defaultLocale": "en",
"locales": ["en"],
"settings": {
"accent": { "type": "color", "label": "Accent", "default": "#B45309" }
},
"tokens": {
"colors": {
"primary": "#111827", "secondary": "#1F2937", "accent": "#B45309",
"background": "#FFFFFF", "text": "#111827", "muted": "#6B7280"
},
"layout": { "contentWidth": "1200px" }
}
}| Field | Required | Rule | Error |
|---|---|---|---|
id | yes | 3-41 characters, lower-case letters, digits, -, starts with a letter. Equals the package slug you push to | SN3012 |
name | yes | a string, e.g. "Nile Fashion" | SN3013 |
description | yes | a string | SN3016 |
version | yes | x.y.z. Bump it for every push; a pushed version cannot be replaced | SN3014 |
author | yes | non-empty string | SN3015 |
category | yes | non-empty string (general, fashion, electronics, …) | SN3017 |
engine | yes | exactly "hk2" | SN3010 |
engineCompatibility | yes | ^2.0.0 or an exact version; must include the current engine 2.0.0 | SN3011 |
defaultLocale | yes | "en" or "ar" | SN3018 |
locales | yes | array that includes defaultLocale, e.g. ["en"] | SN3018 |
settings | yes | object of fields (may be {}), same field format as sections. Merchants edit these for the whole theme; read them as settings.accent or settings('accent'). The id checkout is reserved | SN3021, SN3048 |
tokens.colors | yes | primary, secondary, accent, background, text as #RRGGBB. Extra keys (muted, border, …) are allowed | SN3019 |
tokens.layout.contentWidth | no | "<3-4 digits>px", e.g. "1200px", or "full"; becomes --hk-content-width (none for full, plus --hk-gutter). Default 1280px | SN3059 (ignored if malformed) |
tokens.fonts | no | heading, body, mono: font families from the catalogue (see Fonts) | SN3032 |
money.format | no | "decimal" (default, 1,290.00) or "whole" (1,290, two decimals kept when there are piastres): the default for money, <hk-price> and product cards (see Money formats) | SN3033 |
tokens.radius | no | accepted in the manifest, not turned into CSS yet | |
previews | no | array of preview image names | |
checkout | no | branding for Hekana's own checkout: colours, font, radius, button shape, logo, header and footer, trust note (see Checkout branding) | SN3049–SN3057 (warnings) |
Labels and names (name, description, every setting label, section and block
names) are plain strings. Arabic labels are optional: you may write
{ "en": "Accent", "ar": "…" }, and when ar is missing merchants see the en label.
How tokens become CSS variables is in chapter 5.
Locales
// locales/en.json
{ "shop_now": "Shop now", "view_all": "View all" }- Keys are flat; every value must be a string (SN3025). No nesting, no plurals.
- A missing key falls back to the default locale's file, then to the key itself.
- Put interface words (buttons, empty states, labels) in locales. Put content the merchant should change (titles, descriptions) in section settings instead.
Names and paths
- File and folder names: lower-case letters, digits,
.,_,-; must start with a letter or digit. A name that starts with_or.(such asassets/_old/) is rejected: rename it. No spaces, upper case,.., absolute paths, backslashes or symlinks (SN3002). - Only the folders above, one level deep (except
assets/), with the listed extensions (SN3003).sections/hero/hero.snfis rejected. - Template files end in
.snf. The older.sneferustill works, and one theme can mix the two, but one name may exist in only one form per folder:sections/hero.snfnext tosections/hero.sneferuis an error (SN3044). - Every text file must be UTF-8 (SN3022).
Size limits
| Limit | Value | Error |
|---|---|---|
| Files per theme | 400 | SN3005 |
| Whole theme | 25 MB | SN3006 |
| One asset | 2 MB | SN3007 |
One template (.snf or .sneferu) | 300 KB | SN3008 |
All assets/*.css together (checked by the platform on push) | 512 KB | HK2_CSS_TOO_LARGE |
Compress images before adding them (WebP or AVIF), and prefer the platform's product images over bundled photos.
