Add an event extension to your new Wix CLI project as part of migrating an app from the legacy Wix CLI.
| Legacy path | New path |
|---|---|
src/backend/events/<name>/event.ts | src/extensions/backend/events/<name>/<name>.ts |
| None | src/extensions/backend/events/<name>/<name>.extension.ts |
Note: <name> is your extension's folder name in the legacy project. The new folder and files use the same name.
In the new project:
src/extensions/backend/events/<name>/.src/backend/events/<name>/ folder, copy event.ts into the new folder, and rename it to <name>.ts.In <name>.ts:
Add export default before the top-level handler call if it isn't already there:
Update any imports as needed, to use the new paths, including imports of backend code.
In the new project:
In src/extensions/backend/events/<name>/, create <name>.extension.ts.
Add the following code, and set each field to the value the table below specifies:
| Field | Source in legacy project | What to specify |
|---|---|---|
id | None | The ID of the webhook component in your app's released version, or a new UUID if the event has never been released. See Get the event ID. |
source | None | Path to <name>.ts, relative to src/ |
Caution: Once your project contains a backend event, changes to your event handlers deploy to production as soon as you release, and take effect without waiting for sites to take a new version. The CLI warns you about this at release time. Test a handler on a development site before releasing it.
This applies to the handler's code. Adding an event your app hasn't released before is a change to your app's webhooks, so it reaches each site according to the app version that site has. See About Webhooks.
The id depends on whether your app has already released a version containing this event.
In the new project, in src/extensions.ts:
Import the extension:
Add a .use() call for it to the app() chain, on its own line:
Return to Install the extension's dependencies in the main migration guide.
Last updated: 10 November 2026