Documentation sections

Русский

HOBA

How to build a HOBA theme

Build a bilingual workshop site with editable pages, blocks and links. Import it as a draft, review the generated site, then publish.

1. Download the authoring kit

Download and unzip the CLI kit linked on this page. Open the extracted root directory. Use Node.js 22+ and npm; dependency installation needs the npm registry. You do not need a HOBA repository checkout, React, or a running Core to build. The bundled workshop/ is a complete example; run node build.mjs after installing dependencies.

Download the authoring kit (ZIP)

2. Write your first component

Create my-workshop/components/Home.tsx. Keep the h import: the compiler turns JSX into SDK calls that describe editable blocks. page:ru/contacts and page:en/contacts name page keys, not public URLs.

import { h, Container, Heading, Link, Text, type Locale } from '@hoba/theme-authoring'

export function Home({ locale }: { locale: Locale }) {
const ru = locale === 'ru'
return (
<Container key="home-content" title="Home"
layout={{ kind: 'stack', gap: 'md' }}>
<Heading key="title" level="h1" title={ru ? 'Мастерская' : 'Workshop'} />
<Text key="intro" text={ru ? 'Сайт на HOBA.' : 'A small site built with HOBA.'} />
<Link key="contact" label={ru ? 'Контакты' : 'Contacts'} to={`page:${locale}/contacts`} />
</Container>
)
}

3. Define the site and its pages

Save this as my-workshop/theme.ts. A key identifies the page or block; a slug contributes to its URL. Leave keys stable when titles or URLs change. min_reader_revision describes what Core must be able to read; it is not a database schema number.

import { defineTheme, Container, Heading } from '@hoba/theme-authoring'
import { Home } from './components/Home'

export default defineTheme({
type: 'hoba.theme.graph',
version: 1,
min_reader_revision: 3,
meta: {
id: 'workshop',
release: '0.1.0',
name: { ru: 'Workshop', en: 'Workshop' },
description: { ru: 'Сайт мастерской', en: 'A workshop site' },
license: { spdx: 'CC0-1.0', text: 'Original example, released under CC0.' },
core_compat: { min: '0.2.3', max_exclusive: '0.3.0' },
},
site: {
default_locale: 'ru',
locales: ['ru', 'en'],
tokens: {
colors: { background: '#faf8f4', surface: '#ffffff', text: '#211d29',
muted: '#62596e', primary: '#47328b', accent: '#6546ac', border: '#ded8ef' },
radius: 'md',
shadow: 'none',
typography: { family: 'sans', scale: 'compact' },
},
},
assets: [],
pages: (['ru', 'en'] as const).flatMap(locale => [
{ key: 'home', slug: 'home', locale, title: locale === 'ru' ? 'Мастерская' : 'Workshop', content: Home({ locale }) },
{
key: 'contacts', slug: 'contacts', locale, title: 'Contacts',
content: Container({
key: 'contacts-content', title: 'Contacts',
children: Heading({ key: 'title', title: 'Contacts', level: 'h1' }),
}),
},
]),
})

4. Add assets, styling and shared blocks

Copy the asset and skin declarations from the bundled workshop/theme.ts. Use relative paths, correct MIME types, licences and provenance. In a block use src="asset:logo" with dimensions and meaningful alt text; set site.skin to asset:workshop-skin for CSS. Scope classes under hoba-author--*. Put shared headers and footers in definitions, assign them to the Header and Footer areas in layouts, and select the layout on each page. Do not flatten the area wrapper with display: contents: its box controls layout order.

5. Build and check reproducibility

Run these commands from the extracted kit. Unpacking restores the original build inputs, not later CMS edits. Use the same CLI and a new recovery directory. The build runs trusted author code locally; server-side Core reads the resulting graph without running your TSX.

npm ci --prefix starters/authoring
node build.mjs my-workshop/theme.ts dist/my-workshop.hoba
node starters/authoring/cli.mjs unpack dist/my-workshop.hoba --out recovered-workshop
node build.mjs recovered-workshop/theme.ts dist/my-workshop-rebuilt.hoba
cmp dist/my-workshop.hoba dist/my-workshop-rebuilt.hoba

6. Import, review and publish

In Admin, upload the .hoba under Starters, check compatibility and import it as a new draft. Open both languages in Composer, edit one block and follow the links. Generate a release and check header, content and footer order on a phone and desktop, plus keyboard focus, media and navigation. Activate only after review, then visit the public URL without an Admin session.

7. Release an update

Edit the source, bump meta.release, retain the previous archive and rebuild. Importing a new package does not automatically update an existing site. If your Core does not support the required in-place update, stage a new draft and move the binding only after review. Keep versioned download archives outside the theme; store their links in the theme and their bytes separately.

Reader revision and database schema are different contracts

min_reader_revision describes which fields and nodes Core can read; this contract uses 5. An older reader rejects the package before writing instead of importing it partially. It is not the database schema number: graph-1 requires schema 5 or a newer schema with support for this format, and a matching core_compat semver alone does not prove Container, rich text, or Freeform support. Checking the installed Core remains mandatory.

Limits enforced before writing

An archive is at most 128 MiB compressed and 256 MiB expanded; the manifest is 1 MiB, the graph 64 MiB, one blob 5 MiB, and all sources 32 MiB with 1 MiB per file. An archive has at most 4096 members, 1000 pages, 100000 nodes, depth 64, and 1000 definitions/forms/assets each. A source path is limited to 90 ASCII bytes. Exceeding a limit fails package inspection; reducing data by dropping licences or provenance is not allowed.

Archive contents and the source snapshot

A package contains manifest.json, graph.json, sources/..., and blobs/<sha256>. It contains no site.json, executable bits, links, directories, hooks, package scripts, or node_modules; sources are inert UTF-8 .ts/.tsx/.json files. source_snapshot is the build input, not the current CMS state. After edits in Composer the archive is not updated, and unpack returns the original source files.

Assets, skins, and static SVG

Images and fonts are declared in assets and referenced as asset:key; a graph theme does not accept an external URL in place of a managed image. A skin is one CSS resource up to 256 KiB: @import, network, data, root-relative, and UUID URLs are rejected, while fragments and asset: are allowed. Classes are limited to the hoba-author-- prefix and 16 unique tokens. SVG passes a conservative static subset: scripts, foreignObject, external links, SMIL, and CSS escapes are rejected.