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:
git clone --depth 1 https://github.com/hekanahq/sneferu
cd sneferu/examples/themes/arcade
npx sneferu devThe 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.
<hk-sections />
<hk-schema>
{
"sections": [
{
"type": "arcade-hero",
"blocks": [
{
"type": "tab",
"settings": {
"label": {
"ar": "PC",
"en": "PC"
},
"link": "/products"
}
},


Two more gaming themes were built the same way:
| Theme | What it shows | Live | Files |
|---|---|---|---|
| Console | white and royal blue, a product carousel, an amount selector, platform icons | demo-console.hekana.com | examples/themes/console |
| Esports | black and deep green, a slanted hero with SVG art, top-up cards with ribbons | demo-esports.hekana.com | examples/themes/esports |
<hk-sections />
<hk-schema>
{
"sections": [
{
"type": "console-showcase"
},
{
"type": "console-amounts",
"blocks": [
{
"type": "amount",
"settings": {
"amount": 200,
"highlight": false
}
},<hk-sections />
<hk-schema>
{
"sections": [
{
"type": "esports-hero"
},
{
"type": "esports-products",
"blocks": [
{
"type": "tab",
"settings": {
"label": {
"ar": "الكل",
"en": "All"
},
"link": "/products"
}
},

1. Create the theme
npx sneferu init arcade, thencd arcade.- Delete
sections/hero.snf,sections/featured.snfandblocks/. - Keep
npx sneferu devrunning in a second terminal and openhttp://127.0.0.1:4100(Arabic is the default locale once step 2 below is done; add?locale=enfor English).
The store needs products and four categories with these handles:
gift-cards, game-currency, top-ups, subscriptions.
2. Tokens
"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"
}
}defaultLocale: "ar"makes/Arabic, right to left;/enis English.primaryis the cyan andaccentthe lime. Extra keys (muted,surface,line) become--hk-color-mutedand so on.tokens.fontspicks Rubik, a catalogue font with Arabic and Latin glyphs, for headings and body text. Hekana serves the font files and writes the@font-facerules; the theme ships no font files and nofont-family.- The stylesheet builds its one gradient from the two tokens. Its first rules:
/* 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; }: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.
3. Words, settings and links
Words the merchant may change are settings with "localized": true and a
default in both languages, so the editor shows one field per language:
"title": {
"type": "text",
"label": "Title",
"localized": true,
"default": {
"ar": "كروت الألعاب والشحن",
"en": "Game cards and top-ups"
},
"maxLength": 80
},{{ 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:
{
"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",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.
4. Header and footer
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.
<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" />groups/header.json says which section the header group starts with
(groups/footer.json does the same for arcade-footer):
{
"sections": [
{
"id": "header",
"type": "arcade-header",
"settings": {
"drawer_on_add": true
}
}
]
}<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><hk-schema>
{
"name": "Header",
"version": 1,
"templates": ["header"],
"settings": {
- The
<svg class="arc-defs">in the layout declares one gradient,arc-grad, that every tile icon reuses through CSS. <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), themainmenu by default) and the theme's own links while the store has none; see Menus.<hk-search-form>is the search field: a real form that sends the shopper to the store's search page (/en/searchon English pages). The theme only styles it:.arc-searchdraws the rounded field around the input and the button.<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.- 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). "templates": ["header"]keeps the section in the header group; the#faqlink goes throughurl('/')so it works from every page.
5. Hero: tabs, title and amount chips
<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><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>{% 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 %}
- The hero takes two block types,
tabandchip, 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. - The first tab gets the glow from CSS
(
.arc-tabs > [data-hk-block]:first-child .arc-tab), so there is nois-activesetting to keep in sync. url(block.settings.link)keeps a tab's link in the page's language.- The amounts are whole pounds, so
money: 'whole', 'major'reads the number as pounds and printsEGP 100/100 ج.م. On phones a second, plain number replaces it, so six chips fit in one row. - Below the chips, an
hk-buttonwithclass="arc-browse"links to the gift cards, and the stylesheet draws its gradient border.
/* 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; }6. Category tiles
<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><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>
hk-grid columns="3" mobile-columns="2"sets the columns per width.- Each tile is a
tileblock with a localized title, a link and an icon (aselectsetting). The template seeds six; the merchant can add up to twelve. - Most icons are
hk-icon. The set has no gem, soin-game currencykeeps one inline SVG fromsnippets/glyph.snf: a theme can still draw a glyph the set lacks. - The icons take the shared gradient in CSS:
.arc-tile-icon .ic { stroke: url(#arc-grad); }.
7. How you get your code
<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><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>
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
<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> "list": {
"type": "collection",
"label": "Collection",
"default": "featured"
},
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.
<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>{% 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 %}
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
npx sneferu formatindents every file.npx sneferu validateprints✔ theme [email protected] is valid.- In
dev, check?locale=enand a window under 640 px. - Change
idintheme.jsonto a slug of your own, thennpx 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:
| Limit | What the three gaming themes do |
|---|---|
| no carousel and no JavaScript | menus and questions use <details>; the Console carousel is scroll-snap with anchor links |
images in assets/ are served, but these themes bundle none | icons are hk-icon plus a few inline SVG glyphs, hero art is inline SVG, product art comes from products |
| the icon set has 71 icons | a glyph the set lacks (a gem, a coin) is inline SVG in snippets/glyph.snf |
