Build a Function Library in Studio Two

A function library is a manifest plus an implementation file. You generate the files first, then declare each function in the manifest and export a matching function from the implementation.

This article walks through that loop from a scaffolded library to one with your own functions.

Follow the instructions below to:

  1. Scaffold the library.
  2. Declare functions in the manifest.
  3. Implement the functions.

Step 1 | Scaffold the library

Start from a generated function library rather than an empty folder, so the file structure and registration are already in place.

For the full procedure, see Add a Function Library Extension in Studio Two.

You can find the new files under src/extensions/site/function-libraries/<extension-folder>/. The remaining steps use 2 of them: the manifest, <extension-folder>.extension.ts, and the implementation, <extension-folder>.ts. For what every file in the folder is for, see Function Library Extension Files and Code.

Step 2 | Declare functions in the manifest

<extension-folder>.extension.ts is the manifest you own. It names the library and lists each function a Wix user can connect in the editor.

A generated library includes a working formatPrice function as a starting point:

Copy

Keep the id field stable once other code or editor bindings depend on it. Change name when you want a different label in the editor.

Add an entry to functions for every function you want to expose. The key is the function name. The displayName field is what a Wix user sees when connecting the function. Each parameter and the return value needs a dataType that matches the implementation.

For every field, see About the Function Library Manifest and Function Reference.

Step 3 | Implement the functions

Write the functions in <extension-folder>.ts. Export one named function per key in the manifest's functions map. Parameter order, requiredness, and types must match the manifest.

The generated implementation for formatPrice looks like this:

Copy

Replace formatPrice or add more exports as your library grows. If you add a function to the implementation, add a matching entry to the manifest before a Wix user can connect it.

When the library behaves the way you want, click Publish to ship it with your site.

See also

Last updated: 2 November 2026

Did this help?