> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: create headless link

## Article: create headless link

## Article Link: https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-creation-commands/create-headless-link.md

## Article Content:

# npm create @wix/new headless link

Links an existing Astro project to Wix.

Use this command when you have an existing Astro project that wasn't created through [`create headless`](https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-creation-commands/create-headless.md), and you want to connect it to Wix. This command creates a [Wix-managed headless project](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md).

The command provisions a Wix [business](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md#create-a-project) and site for the project.

<blockquote class="important">

**Important:**
Your project must use Astro 5 or Astro 7. Astro 6 isn't supported.

</blockquote>

Learn more about [linking an existing Astro project to Wix](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/get-started/connect-an-existing-astro-project.md).

Running the command without flags starts interactive mode, prompting you for a business name. To run non-interactively, pass the `--business-name` flag.

> **Note:** This command is provided by the [`@wix/create-new`](https://www.npmjs.com/package/@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

The link command verifies that your project:

- Contains an Astro configuration file such as `astro.config.js`, `astro.config.cjs`, `astro.config.mjs`, or `astro.config.ts`. Without one, the command fails with an `Only Astro projects can be linked to Wix.` error.
- Isn't already a Wix-managed headless project and doesn't contain a `wix.config.json` file. If it does, the command fails with a `This project is already connected to Wix, so no changes were made.` error.

In addition, the project you want to link must be an Astro 5 or Astro 7 project. Astro 6 isn't supported.

## Usage

Run this command at the root folder of your Astro project.

```bash
npm create @wix/new@latest -- headless link [flags]
```

The `--` separator tells `npm` to forward everything after it to the `@wix/create-new` package, instead of treating the flags as options for `npm create` itself.

## Flags

The following flags are available for the `link` command:

| Flag                              | Description                                                                                                                                                                                                                                                                                               |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--business-name <business-name>` | The name of your business as it appears in the Wix dashboard. Also used to generate the project identifier on Wix, so it must include at least one English letter or number.<br /><br />Required if running non-interactively; otherwise the CLI prompts you for it. |

## Examples

Link the Astro project in the current folder to a new Wix business non-interactively:

```bash
npm create @wix/new@latest -- headless link \
  --business-name "My Business"
```

## What the command does

The `npm create @wix/new -- headless link` command modifies your existing Astro project in place. It doesn't create a new project folder. Rather, the command:

- Provisions a new Wix business and site for the project. The site appears on the [Sites page](https://manage.wix.com/account/sites) of your Wix account.
- Adds a `wix.config.json` file to the project root, populated with a `siteId` for the new site and an `appId` for the project's [private app](https://dev.wix.com/docs/build-apps/get-started/overview/exposing-apps-publicly-and-privately.md).
- Updates your existing Astro configuration by:
  - Adding the `@wix/astro` and `@astrojs/react` integrations.
  - Setting `output: 'server'`.
  - Adding `static.wixstatic.com` to the allowed image domains.
  - Adding the `@wix/astro-wix-hosting-adapter` as the project's [Astro adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter), set on the top-level `adapter` key in `astro.config.mjs`: `adapter: wixHostingAdapter()`.
- Replaces your `package.json` scripts with CLI equivalents that route `dev`, `build`, `preview`, and `release` through the `wix` command. Also adds Wix and React dependencies.
- Installs dependencies automatically.

<blockquote class="note">

__Note:__
Set the adapter on the top-level `adapter` key, not in the `integrations` array. Astro's build only recognizes an adapter configured that way. Adding it to `integrations` instead is an easy mistake, since it's imported and called the same way as `wix()` or `react()`. That setup still runs and appears to succeed, but the production build then fails with a `NoAdapterInstalled` error. This matters most if you're wiring `astro.config.mjs` by hand instead of running `link`, since `link` always sets it correctly.

</blockquote>

Learn more about the [architecture and project structure](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md) of a Wix-managed headless project.

## See also

- [About Wix-Managed Headless](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md)
- [create headless](https://dev.wix.com/docs/wix-cli/cli-for-headless/command-reference/project-creation-commands/create-headless.md)