> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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: About Wix Site Development

## Article: About Wix Site Development

## Article Link: https://dev.wix.com/docs/api-reference/articles/platform-overview/about-wix-site-development.md

## Article Content:

# About Extending Wix Sites          

[Extending websites on Wix](https://dev.wix.com/docs/develop-websites.md) combines regular Wix site creation with the ability to add custom code to extend out-of-the-box functionality. You can build your site using Wix's visual editor and then enhance it with custom JavaScript code to add specific features, integrate with external services, or create unique user experiences.

## Which APIs to use

Extend Wix sites using the [Wix JavaScript SDK](https://dev.wix.com/docs/sdk.md) and [Velo APIs](https://dev.wix.com/docs/velo.md). These tools allow you to add custom functionality, integrate with Wix business solutions, and build rich, interactive experiences directly in your Wix site.

> **Note:** [Wix REST APIs](https://dev.wix.com/docs/rest.md) aren't intended for use when extending Wix sites.

## Transition from Velo to the Wix JavaScript SDK

Until recently, custom code on Wix sites was written using Velo APIs. You can now also use the Wix JavaScript SDK for both extending sites and app building with Blocks. If you have sites with existing Velo code, you might want to [migrate](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/develop-with-the-sdk/migrate-from-velo-to-the-sdk.md) them to use the SDK instead.

Wix's transition to the SDK is a gradual process. At this stage, the SDK doesn't currently support the functionality of all Velo APIs for extending sites or for app creation with Blocks. For functionality that isn't yet supported in the SDK, use Velo APIs alongside the SDK.

The Velo APIs that you should still use at this stage fall into 2 categories:

- APIs that are imported from Velo modules.
- APIs that work by file and method name conventions.

### APIs that are imported from Velo modules

The APIs in the [Velo-Only APIs](https://dev.wix.com/docs/velo/velo-only-apis/about-velo-only-apis-and-the-sdk.md) section of the Velo reference don't have functionality supported by the SDK. There are also APIs in the [APIs](https://dev.wix.com/docs/velo/apis/about-velo-apis-and-the-sdk.md) section of the Velo reference that don't currently have functionality that's fully supported by the SDK. To learn which Velo APIs are fully, partially, or not supported by the SDK, see [Velo to SDK API Mapping](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/develop-with-the-sdk/velo-to-sdk-api-mapping.md).

If you need the functionality of these APIs, you need to use their Velo versions. When necessary, import and use these APIs as described in the [Velo reference](https://dev.wix.com/docs/velo.md).

### APIs that work by file and method name conventions

The following APIs may have SDK counterparts, but the SDK versions don't work for extending sites and for app creation with Blocks. Therefore, if you need the functionality of these APIs, you need to use them with their Velo file and method name conventions as described below.

- [**Backend event handlers**](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/backend-code/events/about-backend-events.md): Handlers for backend events, such as when a booked service is canceled. Place Velo backend event handlers in a backend **events.js** file using the naming conventions described in the Velo reference.
- [**Service plugins**](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/about-service-plugins.md): Plugins that allow you to inject custom logic into existing flows, such as conditionally adding additional fees on checkout. Install service plugins in the editor, update the `getConfig()` method in the plugin's **-config.js file**, and implement the main service plugin method in the **.js** file that's added to a site.
- [**Data hooks**](https://dev.wix.com/docs/velo/apis/wix-data/hooks/introduction.md): Hooks that run before or after data operations, such as updating an item. Place data hooks in a backend **data.js** file using the naming conventions described in the Velo reference.
- [**Routers**](https://dev.wix.com/docs/velo/events-service-plugins/routers/service-plugins/wix-router/introduction.md): For custom routing of incoming requests. Place router code in a backend **routers.js** file using the naming conventions described in the Velo reference. Note that some functionality from the Routers API works by convention while other functionality must be imported from Velo modules.

## Wix hosting

Wix site code runs on Wix's cloud infrastructure, where authentication is handled automatically. When using the SDK for extending sites, you don't need to [create a Wix client](https://dev.wix.com/docs/sdk/articles/set-up-a-client/about-the-wix-client.md) because the SDK already knows the caller's identity. Just call the SDK's APIs directly, and authentication is taken care of for you.

## Example

This example demonstrates using SDK functionality alongside Velo APIs. This example creates a router using the Velo API by using method naming conventions and some methods imported from the `wix-router` module. The router retrieves data using the `@wix/data` SDK package.

```javascript
// In backend/routers.js

import { items } from "@wix/data"; // SDK module
import { ok, notFound } from "wix-router"; // Velo module

export async function myRouter_Router(request) {
  // Empty path - show index page
  if (request.path.length < 1) {
    return ok("index-page");
  }

  // Path with item - show item page with data from collection
  const queryResult = await items
    .query("myCollection")
    .eq("title", request.path[0])
    .find();

  if (queryResult.length > 0) {
    return ok("item-page", queryResult.items[0]);
  }

  return notFound();
}
```