Skip to content

Build themes with the Onivos CLI ​

The onv CLI lets you develop website themes locally — scaffold a starter, sync on save, preview through the real renderer, and publish to your organization or the marketplace. Everything you edit locally is the same virtual file tree the in-app Design Manager IDE edits, so you can switch between local files and the browser at any time. Themes live entirely in the platform: no file is ever written to a server disk.

Install & authenticate ​

bash
npm install -g @onivos/cli    # Node ≥ 24

onv auth
# API url:                  https://api.onivos.com
# Personal access token:    onv_pat_…   (Settings → Developer → Personal access tokens)
# Organization id:          your org id

Profiles are stored in ~/.onivos/config.json. Use --profile <name> for multiple organizations, or ONIVOS_URL / ONIVOS_TOKEN / ONIVOS_ORG env vars in CI.

Personal access tokens require a paid plan. A token acts as you, capped by your live role in the organization.

The theme workflow ​

bash
onv theme create "Aurora Custom"     # scaffold from the Onivos skeleton
cd aurora-custom
onv theme upload --create            # first push creates the theme
onv theme watch                      # then: every save syncs instantly
onv theme preview                    # server-rendered preview in your browser
onv lint                             # structure, JSON, drop areas, layouts, SCSS dry-run
onv theme publish --changelog "v1"   # immutable version cut
onv theme publish --list             # …and a marketplace listing

upload is hash-diffed — only changed files transfer. fetch <themeId> pulls any theme (including built-ins, read-only) down as a starting point.

Theme structure ​

my-theme/
├── theme.json                 # name/description/category + brand tokens
├── styles/main.scss           # compiled server-side, themed by the --onv-* tokens
├── scripts/main.js            # emitted before </body> on every page
├── layouts/theme.html         # the site layout (keep <!--onv:head--> + {% block %} regions)
├── globals/header.html        # shared header/footer
├── snippets/<name>.html       # partials ({% include %}) and macros ({% from … import %})
├── templates/<slug>.html      # a page template — {% dnd_area "main" %} = editable region
│   ├── <slug>.css / .js       # per-template assets
│   └── <slug>.meta.json       # { name, category, position }
└── widgets/<key>/             # reusable modules shipped with the theme
    ├── widget.html            # markup ({{ module.* }}), may declare its own {% data %}
    ├── fields.json            # JSON schema → auto-generated editor form
    └── meta.json              # { name, category, defaults }

Every file is written in the template language. A page template pastes whole pages: declare {% dnd_area "main" %} …fallback… {% end_dnd_area %} and pages made from it stay editable in the visual builder. Layout membership is declared in the code: start the file with {% extends "layouts/theme.html" %} to wrap the page in your layout (plus the global header/footer) and fill its {% block %}s; leave it out and the file is the whole document.

Storefront data ​

A template declares the storefront data it reads; the server loads it before render:

DeclarationLoads
{% data products = commerce.products() %}product cards; ?q=, ?collection=, ?page= move the window
{% data product = commerce.product(handle=request.params.handle) %}the detail for the dynamic route (/products/:handle)
{% data collections = commerce.collections() %}active collections (nav / filter chips)
jinja
{% data products = commerce.products(q=request.query.q, page=request.query.page) %}
{% for p in products.items %}
  <a href="/{{ page.lang }}/products/{{ p.handle }}">{{ p.name }}</a>
  <span>{{ p.priceRangeDisplay }}</span>
  <button data-onv-add="{{ p.defaultVariantId }}">Add to cart</button>
{% endfor %}

Add-to-cart interactivity comes from the shared storefront client, which the commerce modules (commerce-product-grid, commerce-cart, commerce-checkout) load for you — cart and checkout pages are simplest built from those modules; see the skeleton's templates/cart.html.

Design Manager (the in-app IDE) ​

Websites → Themes → your theme → Design Manager: the same file tree, a multi-tab code editor (⌘S save, ⌘P quick-open, ⌘⇧F find-in-theme) and a live preview. Local onv theme watch and the IDE can be used interchangeably — both write to the same theme.