Wix CLI for Headless Development Overview

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

This article gives an overview of the methodologies for developing a project that you created using the Wix CLI for Headless.

Understanding your project

After setting up a CLI for Headless project, your files will follow the structure described in CLI Project Structure.

To understand and modify your project's code, you should be familiar with the following:

  • Wix Headless projects: Learn about building headless projects with Wix.
  • Astro: Learn about the Astro web framework used to build your headless project's frontend. Astro also provides support for backend development, including Actions for type-safe backend functions, and Endpoints for creating custom API endpoints.

Working with Wix APIs

As you build your project, you may need to interact with Wix APIs to get information about the site your project is installed on, or to access Wix business solutions.

To call Wix APIs you use:

The SDK is the preferred method of consuming Wix APIs because it offers a simpler authentication experience.

Adding extensions

You can add various extensions to your project's private app to extend the functionality of your project using the following command:

Copy

This command starts a process that guides you through adding an extension to your project.

After you select an extension, you're prompted for relevant configuration details, then your extension code is generated in your project's local files.

You can use any framework you want for developing this app's extensions, but if you want to use the Wix Design System to give your extensions the look and feel of Wix, you must use React.

Read more about CLI for Headless extensions.

Development and testing

As you work locally with the CLI, you can use the CLI to open the local version of your project's site or dashboard in your browser.

To do so, run the following command and select the part of your project to view.

Copy

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

Building, previewing, and releasing a project

Before deploying a project, you need to build it.

You can then:

  • Create preview URLs: A preview URL is a link you can share with team members that allows them to preview and test your project's site and dashboard. Each preview URL directs to a unique version of your project hosted on Wix's servers. Subsequent updates to your project won't affect any previously created versions.
  • Release your project: Releasing pushes the code for 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.

This process is documented in Build and Deploy a Project with the Wix CLI for Headless.

See also

Did this help?