Use Velo Packages in Code

Velo Packages are code libraries written using Velo code. Once installed, you can import and call APIs from Velo packages in your code. Although Velo packages are written using Velo APIs, you can use them alongside the Wix JavaScript SDK.

Use a package

Once you install a package, read the package's README. It explains setup prerequisites, which APIs are exported for use, and how to use the package.

To use a package's APIs, import them in your code.

Use @velo in import paths for Velo packages. Import paths differ depending on whether the API is exported from backend or public files.

Import backend APIs

To import backend APIs, use this syntax:

Copy

For example, assuming you installed the twitter-integration package, you can call its tweet() API as follows:

Copy

Notes:

  • If you want to call backend APIs from a .js file in page code, wrap the backend API in a web module, then import and call the web module from page code.
  • Some Velo packages include web modules. You can call web module APIs directly from backend code, public code, or page code. Import them with the syntax for importing backend APIs.

Import public APIs

To import public APIs, use this syntax:

Copy

For example, assuming you installed the wix-data-helpers package, you can call its getRandomItem() API as follows:

Copy

See also

Did this help?