About Backend Events

Many Wix APIs include events that trigger when specific conditions are met. Backend events allow you to respond to actions that occur on a site, enabling you to build reactive, event-driven functionality.

Backend events run on Wix's servers and execute automatically when triggered, regardless of whether visitors are actively browsing your site.

Backend event handlers can respond to events such as:

  • An invoice is paid
  • A file is uploaded to the Media Manager
  • A form is submitted by a site visitor
  • A member registers or updates their profile
  • Database items are created, updated, or deleted
  • Bookings are created, updated, or canceled

Note: Backend events are only triggered for published sites and don't work in preview mode.

Note: Backend events currently require Velo APIs and file naming conventions. While you can use the JavaScript SDK alongside Velo, backend event handlers must be defined using Velo syntax in the events.js backend file. Don't use the event handers in the JavaScript SDK for backend events when developing Wix sites.

Supported development environments

You can define backend event handlers using:

Using the SDK with backend events

While backend event handlers themselves must use Velo syntax, you can call SDK functions from inside your event handlers. This hybrid approach combines the event-driven architecture of backend events with the modern APIs of the JavaScript SDK.

Copy

This approach allows you to leverage both the event-driven architecture of backend events and the modern SDK APIs for data manipulation and business logic.

Testing and debugging

To test an event handler in preview mode, use functional testing. Functional testing saves you time and effort when building your own system for triggering and testing your backend functions, by allowing you to quickly test backend functions directly in the code editor.

See step-by-step instructions on how to test your backend code.

Velo package backend events

Some Velo packages include backend events, which are contained in their own events.js files. If you add a Velo package that includes backend events, you might end up with multiple events.js files in several locations.

See also

Did this help?