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

Tutorial: build a gaming store theme

Tutorial: build a Sneferu theme for a gaming top-up and gift-card store, from a design mockup to a live Hekana store, with the Arcade example theme.

On this page

This tutorial builds Arcade, the home page of a shop that sells game gift cards, in-game currency and top-up packs as codes, from a design mockup to a live store. It uses only the CLI and the parts of Sneferu described in the earlier chapters. The finished theme is live at demo-arcade.hekana.com (Arabic) and demo-arcade.hekana.com/en (English).

This page shows the key part of each file. Full theme on GitHub: examples/themes/arcade, with a longer walkthrough in its README.md. Every excerpt links to its whole file. To run it yourself:

bash
git clone --depth 1 https://github.com/hekanahq/sneferu
cd sneferu/examples/themes/arcade
npx sneferu dev

The mockup was generated as a design brief. Its Arabic is placeholder text, its prices were in dollars, and its cyan-to-magenta glow becomes cyan-to-lime.

The home page template lists its sections, and seeds the repeated items (tabs, amount chips, tiles, steps, questions) as blocks, so a fresh install shows the whole page and the merchant can add, remove and reorder each item. The excerpt shows the first section and its first block.

examples/themes/arcade/templates/index.snf (excerpt)Sneferu
<hk-sections />
<hk-schema>
  {
    "sections": [
      {
        "type": "arcade-hero",
        "blocks": [
          {
            "type": "tab",
            "settings": {
              "label": {
                "ar": "PC",
                "en": "PC"
              },
              "link": "/products"
            }
          },

View full file on GitHub

Result
A dark mockup: platform tabs, a title, a row of glowing amount chips, an instant delivery line and category tiles
The mockup the theme reproduces.

Two more gaming themes were built the same way:

ThemeWhat it showsLiveFiles
Consolewhite and royal blue, a product carousel, an amount selector, platform iconsdemo-console.hekana.comexamples/themes/console
Esportsblack and deep green, a slanted hero with SVG art, top-up cards with ribbonsdemo-esports.hekana.comexamples/themes/esports
examples/themes/console/templates/index.snf (excerpt)Sneferu
<hk-sections />
<hk-schema>
  {
    "sections": [
      {
        "type": "console-showcase"
      },
      {
        "type": "console-amounts",
        "blocks": [
          {
            "type": "amount",
            "settings": {
              "amount": 200,
              "highlight": false
            }
          },

View full file on GitHub

examples/themes/esports/templates/index.snf (excerpt)Sneferu
<hk-sections />
<hk-schema>
  {
    "sections": [
      {
        "type": "esports-hero"
      },
      {
        "type": "esports-products",
        "blocks": [
          {
            "type": "tab",
            "settings": {
              "label": {
                "ar": "الكل",
                "en": "All"
              },
              "link": "/products"
            }
          },

View full file on GitHub

Result
Console: a white page with a grey logo pill, a search field, two large product cards, a blue amount selector and platform icons
Console, examples/themes/console/.

1. Create the theme

  1. npx sneferu init arcade, then cd arcade.
  2. Delete sections/hero.snf, sections/featured.snf and blocks/.
  3. Keep npx sneferu dev running in a second terminal and open http://127.0.0.1:4100 (Arabic is the default locale once step 2 below is done; add ?locale=en for English).

The store needs products and four categories with these handles: gift-cards, game-currency, top-ups, subscriptions.

2. Tokens

examples/themes/arcade/theme.json (excerpt)JSON
  "defaultLocale": "ar",
  "locales": ["ar", "en"],
  "settings": {},
  "tokens": {
    "colors": {
      "primary": "#22D3EE",
      "secondary": "#0D141C",
      "accent": "#A3E635",
      "background": "#070A0F",
      "text": "#E6EDF3",
      "muted": "#8B98A9",
      "surface": "#0C1219",
      "line": "#1C2A36"
    },
    "layout": { "contentWidth": "1200px" },
    "fonts": {
      "heading": "Rubik",
      "body": "Rubik"
    }
  }

View full file on GitHub

  1. defaultLocale: "ar" makes / Arabic, right to left; /en is English.
  2. primary is the cyan and accent the lime. Extra keys (muted, surface, line) become --hk-color-muted and so on.
  3. tokens.fonts picks Rubik, a catalogue font with Arabic and Latin glyphs, for headings and body text. Hekana serves the font files and writes the @font-face rules; the theme ships no font files and no font-family.
  4. The stylesheet builds its one gradient from the two tokens. Its first rules:
examples/themes/arcade/assets/theme.css (excerpt)css
/* Arcade: near-black ground, neon cyan + lime. Colours come from theme.json tokens. */
[data-hk-theme='arcade'] {
  --arc-cyan: var(--hk-color-primary);
  --arc-lime: var(--hk-color-accent);
  --arc-grad: linear-gradient(90deg, var(--arc-cyan), var(--arc-lime));
  --arc-glow: 0 0 0 1px rgba(34, 211, 238, 0.35), 0 0 18px rgba(34, 211, 238, 0.18);
  min-height: 100vh;
  line-height: 1.6;
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(34, 211, 238, 0.12), transparent 70%),
    radial-gradient(700px 360px at 85% 30%, rgba(163, 230, 53, 0.06), transparent 70%),
    var(--hk-color-background);
}
:where([data-hk-theme='arcade'] a) { color: inherit; text-decoration: none; }
:where([data-hk-theme='arcade'] h1, [data-hk-theme='arcade'] h2, [data-hk-theme='arcade'] p) { margin: 0; }
.arc-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 24px; height: 24px; flex: none; }
/* Block wrappers take no room: tabs, chips, tiles and steps lay out as before. */
[data-hk-theme='arcade'] [data-hk-block] { display: contents; }

View full file on GitHub

:where(…) keeps the link and heading resets at zero specificity, so a single class such as .arc-chip can still set its own colour. [data-hk-block] { display: contents; } lets a block's wrapper <div> disappear from the layout, so tabs, chips and tiles sit directly in their flex or grid row.

Words the merchant may change are settings with "localized": true and a default in both languages, so the editor shows one field per language:

examples/themes/arcade/sections/arcade-hero.snf (excerpt)JSON
      "title": {
        "type": "text",
        "label": "Title",
        "localized": true,
        "default": {
          "ar": "كروت الألعاب والشحن",
          "en": "Game cards and top-ups"
        },
        "maxLength": 80
      },

View full file on GitHub

{{ section.settings.title }} prints the value for the page's language. Words that belong to the interface (menu, cart, "View all", empty states) stay in locales/ar.json and locales/en.json:

examples/themes/arcade/locales/en.json (excerpt)JSON
{
  "menu": "Menu",
  "cart": "Cart",
  "nav_home": "Home",
  "nav_all": "All products",
  "nav_faq": "Questions",
  "search_placeholder": "Search for a game or card",
  "platforms": "Platforms",
  "cat_gift_cards": "Gift cards",
  "cat_currency": "In-game currency",
  "cat_topups": "Top-up packs",
  "view_all": "View all",

View full file on GitHub

Internal links go through url(): href="{{ url('/products') }}" is /products on an Arabic page and /en/products on an English one. A plain href="/products" would send an English shopper to the Arabic page. <hk-button href="/products"> does this by itself.

The header and the footer are the same on every page, so they are section groups: the layout places them, and each is an ordinary section the merchant can edit once for the whole store.

examples/themes/arcade/layout/theme.snfSneferu
<svg class="arc-defs" width="0" height="0" aria-hidden="true">
  <defs>
    <linearGradient id="arc-grad" x1="2" y1="2" x2="22" y2="22" gradientUnits="userSpaceOnUse">
      <stop offset="0" stop-color="#22D3EE" />
      <stop offset="1" stop-color="#A3E635" />
    </linearGradient>
  </defs>
</svg>
<hk-section-group name="header" />
<main class="arc-main"><hk-slot name="content" /></main>
<hk-section-group name="footer" />

View full file on GitHub

groups/header.json says which section the header group starts with (groups/footer.json does the same for arcade-footer):

examples/themes/arcade/groups/header.jsonJSON
{
  "sections": [
    {
      "id": "header",
      "type": "arcade-header",
      "settings": {
        "drawer_on_add": true
      }
    }
  ]
}

View full file on GitHub

examples/themes/arcade/sections/arcade-header.snf (excerpt)Sneferu
<header class="arc-header">
  <hk-container>
    <div class="arc-bar">
      <details class="arc-menu">
        <summary aria-label="{{ t('menu') }}"><hk-icon name="menu" size="24" class="ic" /></summary>
        <nav class="arc-menu-panel">
          {% if menu(section.settings.menu).items %}{% for item in menu(section.settings.menu).items %}<a
                href="{{ item.url }}"
                aria-current="{{ item.active }}"
              >{{ item.title }}</a>{% endfor %}{% else %}<a href="{{ url('/') }}">{{ t('nav_home') }}</a>
            <a href="{{ url('/products') }}">{{ t('nav_all') }}</a>
            <a href="{{ url('/category/gift-cards') }}">{{ t('cat_gift_cards') }}</a>
            <a href="{{ url('/category/game-currency') }}">{{ t('cat_currency') }}</a>
            <a href="{{ url('/') }}#faq">{{ t('nav_faq') }}</a>{% endif %}
        </nav>
      </details>
      <a class="arc-logo" href="{{ url('/') }}">{{ store.name }}</a>
      <hk-search-form placeholder="{{ t('search_placeholder') }}" class="arc-search" />
      <a class="arc-cart" href="{{ url('/cart') }}" data-hk-open="cart-drawer" aria-label="{{ t('cart') }}"><hk-icon
          name="shopping-cart"
          size="24"
          class="ic"
        /><hk-cart-count /></a>
    </div>

View full file on GitHub

examples/themes/arcade/sections/arcade-header.snf (excerpt)Sneferu
<hk-schema>
  {
    "name": "Header",
    "version": 1,
    "templates": ["header"],
    "settings": {

View full file on GitHub

Result
A dark header: the store name in a cyan-to-lime gradient, a rounded search field and a cart icon
The header in English, 1440 px wide.
  1. The <svg class="arc-defs"> in the layout declares one gradient, arc-grad, that every tile icon reuses through CSS.
  2. <details> and <summary> are the phone menu: it opens with no JavaScript. CSS shows it only under 640 px. Its links are the store's menu (menu(section.settings.menu), the main menu by default) and the theme's own links while the store has none; see Menus.
  3. <hk-search-form> is the search field: a real form that sends the shopper to the store's search page (/en/search on English pages). The theme only styles it: .arc-search draws the rounded field around the input and the button.
  4. <hk-icon name="shopping-cart" size="24" class="ic" /> draws an icon from the bundled Lucide set. class="ic" lets the stylesheet size and colour it like the theme's own glyphs.
  5. The cart link carries data-hk-open="cart-drawer": with the controllers running it opens <hk-cart-drawer>, without them it is a plain link to the cart page. <hk-cart-count /> shows the number of items (see Cart and controllers).
  6. "templates": ["header"] keeps the section in the header group; the #faq link goes through url('/') so it works from every page.

5. Hero: tabs, title and amount chips

examples/themes/arcade/sections/arcade-hero.snf (excerpt)Sneferu
<hk-section padding-y="32" mobile-padding-y="16" class="arc-hero">
  <nav class="arc-tabs" aria-label="{{ t('platforms') }}">
    {% for block in section.blocks %}
      {% if block.type == 'tab' %}<hk-block of="{{ block }}" />{% endif %}
    {% endfor %}
  </nav>
  <hk-stack gap="28" mobile-gap="20" align="center">
    <hk-heading
      text="{{ section.settings.title }}"
      level="h1"
      size="44"
      tablet-size="36"
      mobile-size="24"
      align="center"
      class="arc-title"
    />
    <div class="arc-chips">
      {% for block in section.blocks %}
        {% if block.type == 'chip' %}<hk-block of="{{ block }}" />{% endif %}
      {% endfor %}
    </div>

View full file on GitHub

examples/themes/arcade/blocks/tab.snfSneferu
<a class="arc-tab" href="{{ url(block.settings.link) }}">{{ block.settings.label }}</a>
<hk-schema>
  {
    "name": "Platform tab",
    "version": 1,
    "settings": {
      "label": {
        "type": "text",
        "label": "Label",
        "localized": true,
        "default": {
          "ar": "PC",
          "en": "PC"
        },
        "maxLength": 24
      },
      "link": {
        "type": "link",
        "label": "Link",
        "default": "/products"
      }
    }
  }
</hk-schema>

View full file on GitHub

examples/themes/arcade/blocks/chip.snf (excerpt)Sneferu
{% if block.settings.amount %}
  <a class="arc-chip" href="{{ url('/search') }}">
    <span class="arc-chip-icon">{% render 'glyph', name: 'coin' %}</span>
    <span class="arc-chip-amount">{{ block.settings.amount | money: 'whole', 'major' }}</span>
    <span class="arc-chip-short">{{ block.settings.amount }}</span>
  </a>
{% endif %}

View full file on GitHub

Result
Platform tabs in a pill with a gradient border, the title Game cards and top-ups, eight cyan-to-lime chips from 100 to 2000 EGP, a Browse cards button and an Instant delivery line
The hero in English.
  1. The hero takes two block types, tab and chip, and loops over its blocks twice: tabs into the <nav>, chips into the chip row. The template seeds five tabs and eight chips; the merchant edits, adds or removes them.
  2. The first tab gets the glow from CSS (.arc-tabs > [data-hk-block]:first-child .arc-tab), so there is no is-active setting to keep in sync.
  3. url(block.settings.link) keeps a tab's link in the page's language.
  4. The amounts are whole pounds, so money: 'whole', 'major' reads the number as pounds and prints EGP 100 / 100 ج.م. On phones a second, plain number replaces it, so six chips fit in one row.
  5. Below the chips, an hk-button with class="arc-browse" links to the gift cards, and the stylesheet draws its gradient border.
examples/themes/arcade/assets/theme.css (excerpt)css
/* Hero: platform tabs, title, amount chips */
.arc-tabs { display: flex; justify-content: center; gap: 4px; width: fit-content; max-width: 100%; margin: 0 auto 40px; padding: 4px; border-radius: 999px; border: 1px solid transparent; background: linear-gradient(var(--hk-color-background), var(--hk-color-background)) padding-box, linear-gradient(90deg, rgba(34, 211, 238, 0.7), rgba(163, 230, 53, 0.55)) border-box; overflow-x: auto; scrollbar-width: none; }
.arc-tab { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 26px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--hk-color-text); white-space: nowrap; border: 1px solid transparent; }
.arc-tab:hover { color: var(--arc-cyan); }
.arc-tabs > [data-hk-block]:first-child .arc-tab { border-color: var(--arc-cyan); box-shadow: 0 0 14px rgba(34, 211, 238, 0.45), inset 0 0 10px rgba(34, 211, 238, 0.15); }
.arc-title { font-weight: 700; letter-spacing: 0; }
.arc-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
@media (min-width: 1024px) { .arc-chips { flex-wrap: nowrap; } }
.arc-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: 10px 12px; border-radius: 8px; background: var(--arc-grad); color: #04131A; font-weight: 700; font-size: 17px; white-space: nowrap; box-shadow: 0 0 16px rgba(34, 211, 238, 0.35), 0 0 22px rgba(163, 230, 53, 0.18); transition: transform 0.15s, box-shadow 0.15s; }
.arc-chip:hover { transform: translateY(-2px); box-shadow: 0 0 22px rgba(34, 211, 238, 0.55), 0 0 30px rgba(163, 230, 53, 0.3); }
.arc-chip-icon { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(4, 19, 26, 0.85); color: var(--arc-cyan); }
.arc-chip-icon .ic { width: 18px; height: 18px; }
.arc-chip-short { display: none; }
.arc-actions { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.arc-browse { justify-self: start; }
.sn-btn.arc-browse { display: inline-flex; align-items: center; line-height: 1; min-height: 44px; padding-inline: 18px; border-radius: 12px; border: 1px solid transparent; font-size: 14px; color: var(--hk-color-text); background: linear-gradient(var(--hk-color-background), var(--hk-color-background)) padding-box, linear-gradient(90deg, var(--arc-cyan), var(--arc-lime)) border-box; }
.arc-instant { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: 17px; }
.arc-instant-icon { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid var(--arc-cyan); color: var(--arc-cyan); box-shadow: 0 0 12px rgba(34, 211, 238, 0.4); }
.arc-instant-icon .ic { width: 18px; height: 18px; }

View full file on GitHub

6. Category tiles

examples/themes/arcade/sections/arcade-categories.snf (excerpt)Sneferu
<hk-section padding-y="24" mobile-padding-y="16" class="arc-cats">
  {% if section.settings.heading %}
    <hk-heading text="{{ section.settings.heading }}" level="h2" size="24" mobile-size="20" class="arc-h2" />
  {% endif %}
  <hk-grid columns="3" mobile-columns="2" gap="16" mobile-gap="12">
    {% for block in section.blocks %}
      <hk-block of="{{ block }}" />
    {% endfor %}
  </hk-grid>
</hk-section>

View full file on GitHub

examples/themes/arcade/blocks/tile.snf (excerpt)Sneferu
<a class="arc-tile" href="{{ url(block.settings.link) }}">
  <span class="arc-tile-icon">
    {% if block.settings.icon == 'gem' %}
      {% render 'glyph', name: 'gem' %}
    {% else %}
      <hk-icon name="{{ block.settings.icon }}" class="ic" />
    {% endif %}
  </span>
  <span class="arc-tile-title">{{ block.settings.title }}</span>
</a>

View full file on GitHub

Result
Six dark tiles in two rows of three, each with a cyan-to-lime outline icon and a label: Gift cards, In-game currency, Top-up packs, Subscriptions, Console cards, Mobile games
Three a row on desktop; two a row on phones.
  1. hk-grid columns="3" mobile-columns="2" sets the columns per width.
  2. Each tile is a tile block with a localized title, a link and an icon (a select setting). The template seeds six; the merchant can add up to twelve.
  3. Most icons are hk-icon. The set has no gem, so in-game currency keeps one inline SVG from snippets/glyph.snf: a theme can still draw a glyph the set lacks.
  4. The icons take the shared gradient in CSS: .arc-tile-icon .ic { stroke: url(#arc-grad); }.

7. How you get your code

examples/themes/arcade/sections/arcade-steps.snf (excerpt)Sneferu
<hk-section padding-y="48" mobile-padding-y="32" class="arc-steps">
  <hk-stack gap="24" align="center">
    <hk-heading
      text="{{ section.settings.heading }}"
      level="h2"
      size="28"
      mobile-size="20"
      align="center"
      class="arc-h2"
    />
    <div class="arc-step-list">
      {% for block in section.blocks %}
        <hk-block of="{{ block }}" />
      {% endfor %}
    </div>
  </hk-stack>
</hk-section>

View full file on GitHub

examples/themes/arcade/blocks/step.snf (excerpt)Sneferu
<div class="arc-step">
  <span class="arc-step-icon"><hk-icon name="{{ block.settings.icon }}" class="ic" /></span>
  <span class="arc-step-n"></span>
  <strong class="arc-step-title">{{ block.settings.title }}</strong>
  <span class="arc-step-text">{{ block.settings.text }}</span>
</div>

View full file on GitHub

Result
Three numbered cards: Pick and pay online, The code arrives by email, Redeem it
The three steps in English.

Each step is a block. The number is not a setting: a CSS counter on the list (counter-reset: arc-step and content: counter(arc-step)) numbers the steps in the merchant's order. The copy describes what a Hekana digital store does: after an online payment is confirmed, the code is sent by email automatically.

8. Products and questions

examples/themes/arcade/sections/arcade-products.snf (excerpt)Sneferu
<hk-section padding-y="40" mobile-padding-y="28" class="arc-products">
  <hk-stack gap="20">
    <div class="arc-row-head">
      <hk-heading text="{{ section.settings.heading }}" level="h2" size="28" mobile-size="20" class="arc-h2" />
      <a class="arc-more" href="{{ url('/products') }}">{{ t('view_all') }}</a>
    </div>
    {% if collection(section.settings.list).products %}
      <hk-product-grid
        products="{{ collection(section.settings.list).products }}"
        limit="{{ section.settings.count }}"
        columns="4"
        tablet-columns="3"
        mobile-columns="2"
        class="arc-grid"
      />
    {% else %}
      <p class="arc-empty">{{ t('empty_products') }}</p>
    {% endif %}
  </hk-stack>
</hk-section>

View full file on GitHub

examples/themes/arcade/sections/arcade-products.snf (excerpt)JSON
      "list": {
        "type": "collection",
        "label": "Collection",
        "default": "featured"
      },

View full file on GitHub

Result
A grid of dark product cards with gift card, gem and coin artwork, titles and lime prices in EGP, two crossed-out old prices
hk-product-grid with the store products.

The list setting is a collection picker that defaults to featured; collection(section.settings.list) reads whatever the merchant picks. hk-product-grid renders one sn-product-card per product; the stylesheet styles .arc-grid .sn-product-card, .sn-title and .sn-price.

examples/themes/arcade/sections/arcade-faq.snf (excerpt)Sneferu
<hk-section padding-y="48" mobile-padding-y="32" class="arc-faq">
  <div id="faq" class="arc-faq-wrap">
    <hk-heading text="{{ section.settings.heading }}" level="h2" size="28" mobile-size="20" class="arc-h2" />
    {% for block in section.blocks %}
      <hk-block of="{{ block }}" />
    {% endfor %}
  </div>
</hk-section>

View full file on GitHub

examples/themes/arcade/blocks/faq-item.snf (excerpt)Sneferu
{% if block.settings.question %}
  <details class="arc-faq-item">
    <summary>{{ block.settings.question }}<hk-icon name="chevron-down" class="ic" /></summary>
    <p>{{ block.settings.answer }}</p>
  </details>
{% endif %}

View full file on GitHub

Result
Five closed questions in dark rows, each with a cyan chevron
The questions, closed.

Each question is a block, and a <details>: it opens on tap, with no JavaScript. The questions are about codes and payment, not shipping.

9. Check, preview and push

  1. npx sneferu format indents every file.
  2. npx sneferu validate prints ✔ theme [email protected] is valid.
  3. In dev, check ?locale=en and a window under 640 px.
  4. Change id in theme.json to a slug of your own, then npx sneferu push . --package <your-slug> --dev-store.

Every page of the store goes through the theme: Arcade 2.0 has its own product, collection, search, cart, content page and 404 templates, and a shared header, footer and announcement bar the merchant edits once (see Page types and Section groups).

What to know before you build your own

The three gaming themes were first built on Sneferu 0.2; version 2.0 (Sneferu 0.6) made them complete stores. The list of early gaps is in examples/GAPS-gaming.md. What is still missing:

LimitWhat the three gaming themes do
no carousel and no JavaScriptmenus and questions use <details>; the Console carousel is scroll-snap with anchor links
images in assets/ are served, but these themes bundle noneicons are hk-icon plus a few inline SVG glyphs, hero art is inline SVG, product art comes from products
the icon set has 71 iconsa glyph the set lacks (a gem, a coin) is inline SVG in snippets/glyph.snf

Next steps