
Vitrin CLI in depth: from login to preview, push and troubleshooting
The core Vitrin CLI commands: install, login, creating a theme, previewing on a development store, install and activate, build and push, and fixing common errors.
What the CLI gives you
Vitrin CLI is Zid's command-line tool for theme developers. It lets you develop, validate and publish themes from your local environment, and it's published on npm as @zidsa/vitrin-cli.
npm install -g @zidsa/vitrin-cli
vitrin # Launch the interactive TUI (recommended)The interactive TUI is what the docs recommend: a dashboard with quick access to commands, real-time build status, and theme and authentication info. It lets you create, browse and select themes, deploy a preview in one click, and detects the theme in the current directory automatically. Everything is also available as direct commands, which is what this guide covers.
VITRIN_API_URL: API endpoint (defaulthttps://api.zid.sa).VITRIN_PARTNER_URL: Partner Dashboard URL (defaulthttps://partner.zid.sa).LOG_LEVEL: logging level (debug,infoorerror).
Sign in: vitrin login
vitrin login opens the Partner Dashboard in your browser for the OAuth flow, then saves your credentials locally. While it waits, the CLI listens for the callback on http://localhost:4444/auth/callback:
$ vitrin login
Opening Zid Partner Dashboard in your default browser...
Listening for authentication callback on http://localhost:4444/auth/callback
✅ Authentication successful!
Token saved to ~/.vitrin/config.json- The token is stored in
~/.vitrin/config.json. To log out, runvitrin logout(in version 1.3.0), or delete the file as the docs describe:rm ~/.vitrin/config.json. - To check you're still authenticated, run
vitrin list themes. If you see "Authentication required", runvitrin loginagain.
~/.vitrin/config.json as a secret: don't commit it to a repository or share it.Create a theme: vitrin new
vitrin new <theme-name> [options] creates a new theme. In version 1.3.0 on npm it clones the official Growth theme template from zidsa/growth-theme by default, -e or --from-existing <path> registers a directory you already have as a Vitrin theme instead of cloning, and --no-git skips Git initialization. The -t or --template option (basic, minimal or advanced) listed on the docs commands page isn't in version 1.3.0. Once it's created, the CLI suggests you cd into the folder and run vitrin push. This is the structure the CLI expects, per the docs introduction page:
my-theme/
├── assets/
│ ├── styles.css
│ ├── scripts.js
│ └── images/
├── templates/
│ ├── home.jinja
│ ├── product.jinja
│ └── cart.jinja
├── layout.jinja
├── footer.jinja
├── header.jinja
├── package.json
└── theme.jsonThe Architecture page in the docs adds sections/, components/, the translation file locale/ar/LC_MESSAGES/messages.po, and layout.schema.json, header.schema.json and footer.schema.json. Treat the CLI's tree as the minimum.
vitrin download to fetch a version's .zip, and vitrin link to link the unzipped folder to the theme. To start from existing work, the docs point to the sample themes on GitHub (zidsa/soft-theme-vitrin and the Growth theme at zidsa/growth-theme), and the TUI lets you browse and select your existing themes.Preview on a development store
List your development stores to get the store ID, then preview on it. With --build, the CLI builds the theme, creates it, creates a version, uploads the package and installs it on the store, then prints three IDs:
vitrin list stores
vitrin preview 123 --build
# From the preview output:
# Theme ID: 45678
# Version: 90123
# Installation: 11111Preview ends with the theme installed but not active, and the CLI suggests the activation command. To install a specific version yourself, use vitrin install with the store, theme and version IDs, then activate with the installation ID:
vitrin install <store-id> <theme-id> <version-id>
vitrin activate <store-id> <installation-id>
# Example
vitrin activate 123 11111.json file named after the template (such as home.json, layout.json, header.json or footer.json) containing the settings, and it's uploaded to the store during preview. Then add /validate to your preview link to read the validation report.Build and push: vitrin build and vitrin push
vitrin build [theme-path] validates the structure and packages the theme as a distributable .zip. The docs example shows dist/theme.zip; in version 1.3.0 the file is named after the theme folder plus a timestamp (for example my-theme-1714492800000.zip), and -o or --output <path> sets the output directory. vitrin push builds the theme and pushes it to Zid's servers, creating or updating it:
vitrin build
vitrin build --validate
vitrin push --store 123 --activate-sor--store <id>: the development store ID to install on (the docs page says email; version 1.3.0 takes the store ID).-aor--activate: activate the theme after installation.-vor--version <version>: version number (default: fromtheme.json).-cor--changelog <text>: version changelog.-nor--new-version(version 1.3.0): creates a new theme version; by defaultpushupdates the latest version in place.
A good practice is to pass --changelog on every push, and an explicit --version whenever you create a new version, so each version is easy to trace. Keep in mind that push doesn't submit your theme for Theme Market review; that's a separate step: Submit to Publish under My Themes → Themes Management in the Partner Dashboard, or vitrin status --target pending_review in version 1.3.0. Our pre-submission checklist article covers the steps.
Common errors and fixes
- Authentication required: the token is missing or expired. Run
vitrin login. - Build fails: run
vitrin build --validate. Common causes are missingassets/ortemplates/directories, or an invalid or missingpackage.json..DS_Storefiles are cleaned automatically during the build. - Preview fails: an expired token (run
vitrin login), an invalid store ID (check withvitrin list stores), or a theme name conflict, which the CLI resolves by generating a unique name. - Undefined-variable errors in the preview: since December 2025 these are shown in the development preview. Add fallbacks, handle optional values and use
safeget.
For more detail, run the preview with debug logging:
# macOS
LOG_LEVEL=debug vitrin preview 123
# Windows
$env:LOG_LEVEL="debug"; vitrin preview 123zidsa/vitrin-cli/issues.Key takeaways
- Install with
npm install -g @zidsa/vitrin-cli, and runvitrinalone for the interactive TUI. vitrin loginstores the token in~/.vitrin/config.json;vitrin logout(or deleting the file) logs you out.- Use
vitrin list stores, thenvitrin preview <id> --build, and activate with the installation ID viavitrin activate. vitrin pushtakes--store,--activate,--versionand--changelog, and does not submit for review.- When something breaks, start with
LOG_LEVEL=debugandvitrin build --validate.
Sources
Start building on Zid
Sign up in the partner portal, then build and test on a development store.


