Русский

HOBA

Build your own .hoba theme

A minimal two-file theme: a Home.tsx component and a theme.ts site definition. The result is an editable site, not a frontend application.

TSX, Node.js, and HOBA Core

TSX is TypeScript with JSX syntax. Node.js is the runtime for the build CLI. The SDK turns JSX into calls to h that produce plain block objects; direct calls to Container and Heading produce the same result. Neither React nor a DOM is needed. The build runs author code locally, so build only sources you trust. On the server, the Rust Core reads the declarative graph and renders it without executing TSX or starting Node.js.

1. Write a component: workshop/components/Home.tsx

The component returns a container, heading, text, and a link. Import h so the compiler can turn JSX into SDK calls. The target page:ru/contacts names a Russian page key instead of hard-coding a URL.

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

export function Home() {
return (
<Container key="home-content" title="Home"
layout={{ kind: 'stack', gap: 'md' }}>
<Heading key="title" level="h1" title="Workshop" />
<Text key="intro" text="A small site built with HOBA." />
<Link key="contact" label="Contacts" to="page:ru/contacts" />
</Container>
)
}

2. Describe the site: workshop/theme.ts

The entry point binds pages, locales, metadata, and assets. Keep keys stable when changing titles or slugs. The example shares Home across both locales and deliberately links to Russian contacts. Pass locale into the component to localise that navigation.

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: 'Workshop', content: Home() },
{
key: 'contacts', slug: 'contacts', locale, title: 'Contacts',
content: Container({
key: 'contacts-content', title: 'Contacts',
children: Heading({ key: 'title', title: 'Contacts', level: 'h1' }),
}),
},
]),
})

3. Build and verify the archive

From the root of the SDK checkout, install dependencies from the lockfile. Build produces one .hoba, while unpack recovers the build inputs without executing their code. Comparing after a rebuild checks reproducibility with the same SDK. Edit the sources, not the graph inside the archive.

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

4. Import and review

Select the .hoba in Admin on a compatible Core and review the inspection result before importing. Open Composer, edit a block, and check the link. For media, declare local files in assets and reference them with asset:key; check their licences. Reader revision describes how Core reads the package; it is not the database schema version.