Wix CLI for Headless Quick Start

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

This guide explains the bare minimum steps required to get a basic headless project up and running using the Wix CLI for Headless. As part of this setup, you'll get an integrated frontend site and private app. For more information, see About the Wix CLI for Headless.

Before you begin

Before getting started, make sure that:

Step 1 | Create a new headless project

  1. Run the following command to create a new headless project:

    Copy
  2. Enter the name of your business. This is the name of your headless project on Wix. The CLI creates a Wix Headless project for you with this name. This project is added to your Wix sites list.

  3. Choose an initial template for your project. Learn more about the available templates.

  4. Enter the name of your custom frontend project. This name is used to identify the client that's automatically created for your private app.

  5. Choose the directory where you want to create your local project files. The CLI has generates the local code files for your project in a directory with the package name you chose.

  6. After the CLI finishes generating your headless site, you can choose whether to publish it now. If you select Yes, the CLI builds and publishes your site, and gives you the site URL. If you select No, you can publish later by building and releasing your project.

Step 2 | Test the project in your local environment

  1. Navigate to your project directory:

    Copy
  2. Run the following command to start the local development server:

    Copy

    The CLI builds a local environment for your project and provides links to view your site and dashboard.

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

Step 3 | Call a Wix API (optional)

Note: In this step we're calling listMembers() in the Wix Members API, but you can use any method in any Wix Javascript SDK API.

  1. Close the local development environment.

  2. Install the @wix/members package:

    Copy
  3. Add the following to your index.astro file's front matter:

    Copy

    Your front matter should look something like this:

    Copy
  4. Run the following command to restart the local development server:

    Copy
  5. Click the link to open your site.

  6. Return to the terminal. You should see the following log showing that your site currently has 0 members:

    Copy

Next steps

After completing the above steps, you have a simple headless project that you can experiment with and test locally.

You can now:

See also

Did this help?