npm create @wix/new init

Initializes a new Wix-managed headless project in the current folder.

Run this command at the root of the folder you want to connect. The command signs you in, creates the project, and saves the generated configuration locally so you can start developing. It runs without prompts: the business name is derived from the current folder's name, and the project is created from the blank template.

Note: This command is provided by the @wix/create-new package, which is invoked through npm create. It's a separate package from @wix/cli and operates on the project in the current working directory.

Before you begin

You need to have a folder that already contains your project code.

Usage

Copy

This command takes no flags other than -h, --help to display help for the command.

After the command runs

The command operates on the current folder in place — it doesn't create a new project folder or modify your existing files. It:

  • Provisions a Wix site for your project, listed on the Sites page of your Wix account.
  • Writes a wix.config.json file containing the site's siteId and the appId of its private app.

After the command runs, your folder contains a wix.config.json similar to the following:

Copy

To start a local development environment, run wix dev.

Errors

The command fails if the current folder already contains a wix.config.json file.

create headless vs. init

Both commands provision the same Wix headless project and write a local wix.config.json file that connects it to your code. A Wix headless project consists of:

  • Site: The Wix site your code targets, identified by the siteId in wix.config.json. It's the same entity as your business, which is the workspace in your Wix account with a dashboard, billing, and business solutions, listed on the Sites page.
  • Private app: Authorizes that code to call the site's APIs and add extensions, identified by the appId in wix.config.json.

When to use each

  • create headless scaffolds a complete, opinionated Astro project for you. It generates project files from a site template, installs dependencies, initializes a Git repository, and publishes your site. Use it when you want Wix to set up the project structure and frontend for you.
  • init connects project code you already have. It only provisions the Wix headless project and writes wix.config.json, leaving the rest of your folder untouched. It doesn't generate a template, install dependencies, initialize Git, or publish your site. Use it when you just want to connect existing code to Wix.
Did this help?