Quick Start a Wix CLI Headless Project

The Wix CLI is in Developer Preview and is subject to change.

This guide explains the minimum steps required to get a headless project up and running using the Wix CLI. As part of this setup, you'll get a frontend site and private app integrated with a headless project.

Note: This setup also initializes useful headless settings for your project, such as adding allowed redirect domains and setting a Wix Pages domain.

Before you begin

Before getting started, make sure that you:

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. You'll see 2 categories:

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

  5. Wait for the CLI to generate your project. This includes installing dependencies, initializing a git repository, and configuring your project files.

  6. If you chose a Vibe-compatible template, the CLI prompts you to set up your project for editing in Wix Vibe:

    • Set up project for Wix Vibe and create a GitHub repository (recommended): Opens your browser to create a GitHub repository for your project. After creating the repository, the CLI syncs your code to GitHub and completes the Vibe setup.
    • Skip for now: You can set up Vibe later using the wix connect command (see Step 4).
  7. After the CLI finishes generating your headless project, the CLI builds and publishes your site, and gives you the site URL.

Step 2 | Test the project

  1. Navigate to your project directory:

  2. Run the dev command to start the local development environment. 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 (Optional) | Call a Wix API

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 that started when you ran the dev command.

  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 dev command to restart the local development environment.

  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

    Note: If you added members, you may not see their data in this list due to their status being set to PRIVATE by default. For more information, see List Members.

Step 4 (Optional) | Connect to Vibe for visual editing

If you created your project with a Vibe-compatible template and want to use Wix Vibe for AI-powered visual editing, you can connect using the wix connect command.

Your local code remains the source of truth, and changes made in Vibe are synchronized with your local project files.

Note: If you chose "Set up project for Wix Vibe and create a GitHub repository" during initial project creation, your Vibe setup is already complete and you don't need to run this command.

If you skipped the Vibe setup during initial creation:

  1. Navigate to your project directory.

  2. Run the following command:

    Copy
  3. The CLI opens your browser to create a GitHub repository, then completes the Vibe setup and provides you with a link to access the Vibe editor.

Note: The wix connect command is only available for projects created with Vibe-compatible templates. For a full list of available templates, see Wix CLI for Headless Templates.

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?