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.
Category | Command | Description |
---|---|---|
CLI for Headless | dev | Starts a local development environment that serves your project. |
build | Builds your project. | |
generate | Generates an extension for your project. | |
preview | Creates an online preview of your built project. | |
release | Starts a process that guides you through releasing your project. | |
env | Work with environment variables. | |
Global CLI | login | Logs in to your Wix account. |
logout | Logs out of your Wix account. | |
telemetry | Opts in or out of sending anonymous usage information (telemetry) to Wix. | |
whoami | Displays the email address of the logged-in Wix user. |
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.
Option | Description |
---|---|
--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. |
Builds your project.
You must build your project before:
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.
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.
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.
Work with environment variables. Your environment variables are stored locally in your project's .env.local
file, and remotely on Wix's servers.
Sets an environment variable on Wix's servers.
Option | Description |
---|---|
--key <key> | Name of the variable. |
--value <value> | Value of the variable. |
Removes an environment variable from Wix's servers.
Option | Description |
---|---|
--key <key> | Name of the variable. |
Pulls all your environment variables from Wix's servers and merges them into the .env.local
file.
Logs in to your Wix account.
Logs out of your Wix account.
Note: To switch to another Wix account:
wix logout
.wix login
, then click the link provided.Opts in or out of sending anonymous usage information (telemetry) to Wix.
Displays the email address of the logged-in Wix user.