Backend code on Wix runs in one of 2 models. Wix-managed sites, apps, and headless projects run on a managed environment provided by the platform. Self-managed apps and headless projects run on whatever runtime and infrastructure you choose, reaching Wix services through the JavaScript SDK or the REST API.
Key properties of the Wix-managed environment:
- Serverless and managed: Wix handles deployment, runtime upgrades, and patching. You push code, and the platform handles everything else about how it runs.
- Node.js runtime: Backend code is JavaScript or TypeScript running on Node.js. You can use most npm packages alongside the SDK and APIs.
- Scales with demand: The platform handles capacity, so you don't manage server count or load.
- Integrated with Wix APIs and data: Backend code can call Wix business solutions APIs like Bookings, Stores, and eCommerce. It can also query the Wix CMS and use platform services like secrets storage, identity, and events.
The Wix backend provides a set of building blocks for common backend patterns. Each is covered in detail in this section.
- Events: Run backend code in response to platform events, such as when a contact is created, an order is placed, or a booking is confirmed.
- Exposing APIs: Expose public HTTP endpoints from your project for external systems to call. HTTP functions are the platform-managed way to do this.
- Frontend-to-Backend Communication: Call backend functions from frontend code. Web methods are the standard platform mechanism. They aren't publicly exposed and carry the caller's identity automatically. HTTP functions can also be called from the frontend when you need HTTP-specific features like custom headers.
- Recurring Tasks: Run backend code at intervals you define, such as every hour or every day at midnight. The platform executes scheduled jobs automatically.
- Custom URL Routing: Define custom URL patterns and the backend logic that resolves them, useful for dynamic pages and SEO-friendly routes.
- Custom Business Logic: Inject your own code into Wix's prebuilt business flows at specific decision points, such as calculating tax during checkout or quoting shipping. Service plugins are the platform-managed way to do this.
On Wix-managed paths the execution environment is the same, but how you author, deploy, and invoke backend code differs. Self-managed paths bring their own runtime, framework, and language.
- Sites: Author backend code in the built-in code editor inside the Wix Editor or Wix Studio, in the browser-based Wix IDE for Studio sites, or in a local IDE such as VS Code by connecting your site to GitHub through the Wix CLI for Sites. Code is deployed when you publish the site. For implementation, see Set Up Git Integration & Wix CLI for Sites in Extend Websites.
- Wix-managed headless projects: Scaffolded and deployed with the Wix CLI, with Wix hosting the backend. A headless project is a standalone project, Astro-based by default, whose backend logic runs as HTTP endpoints, with backend extensions also available for events, dashboard surfaces, and other custom logic. For implementation, see Quick Start a Headless Project with the Wix CLI in Go Headless.
- Self-managed headless projects: Run on infrastructure you choose, with any framework and language. You handle hosting, deployment, and authentication, and the project is a standalone consumer of Wix APIs.
- Wix-managed apps: Scaffolded and deployed with the Wix CLI, with Wix hosting the backend. An app consists of backend extensions, each with a defined shape that the platform invokes when the relevant condition is met on a site that has installed the app. For implementation, see Quick Start a Wix CLI App in Build Apps.
- Self-managed apps: Run on infrastructure you choose, with any framework and language. You handle hosting, deployment, and authentication. The app still registers with Wix as extensions, exposing endpoints that Wix calls during the relevant flows. For implementation, see Create a Self-Hosted App in Build Apps.
- Blocks apps: Built in the Blocks editor, with backend code running on Wix infrastructure. Most backend mechanisms work the same as on sites. Routers and backend service plugin extensions aren't supported in Blocks.