Wix CLI for Headless Commands

This feature is in Developer Preview and is subject to change.

This article documents the CLI commands for building Wix Headless projects.

For a detailed explanation of the process and how to initially create a project, see our Quick Start article.

Command overview

CategoryCommandDescription
CLI for HeadlessdevStarts a local development environment that serves your project.
buildBuilds your project.
generateGenerates an extension for your project.
previewCreates an online preview of your built project.
releaseStarts a process that guides you through releasing your project.
envWork with environment variables.
Global CLIloginLogs in to your Wix account.
logoutLogs out of your Wix account.
telemetryOpts in or out of sending anonymous usage information (telemetry) to Wix.
whoamiDisplays the email address of the logged-in Wix user.

dev

Starts a local development environment that serves your project. Follow the prompts to open the site or dashboard of your project in the local development environment in your browser.

The development environment is set up for hot reloading, so any changes you make to your code are immediately reflected in the browser.

Copy

Options

OptionDescription
--port <port>Specify which port to run on. Defaults to 4321.
--allowed-hosts <allowedHosts>Specify a comma-separated list of allowed hosts or allow any hostname.

build

Builds your project.

You must build your project before:

  • Releasing your project.
  • Previewing your project.
Copy

generate

Starts a process that guides you through adding an extension to your project. After selecting an extension you are prompted for relevant configuration details, then your extension is generated in your project's local files.

Copy

preview

Creates an online preview of your built project and provides a preview URL in the console. By default, the code for your preview is hosted on Wix's servers.

Copy

release

Starts a process that guides you through releasing your project. Releasing pushes your project to Wix's servers and publishes your site. After releasing your project, the CLI provides preview URLs for your project's site and dashboard, and the URL of your published site.

Copy

env

Work with environment variables. Your environment variables are stored locally in your project's .env.local file, and remotely on Wix's servers.

env set

Sets an environment variable on Wix's servers.

Copy

Options

OptionDescription
--key <key>Name of the variable.
--value <value>Value of the variable.

Example

Copy

env remove

Removes an environment variable from Wix's servers.

Copy

Options

OptionDescription
--key <key>Name of the variable.

Example

Copy

env pull

Pulls all your environment variables from Wix's servers and merges them into the .env.local file.

Copy

login

Logs in to your Wix account.

Copy

logout

Logs out of your Wix account.

Note: To switch to another Wix account:

  1. Run wix logout.
  2. Run wix login, then click the link provided.
  3. Click Log in with another account.
Copy

telemetry

Opts in or out of sending anonymous usage information (telemetry) to Wix.

Copy

whoami

Displays the email address of the logged-in Wix user.

Copy
Did this help?