A data collections extension is available in Wix CLI apps and Wix-managed headless projects.
Note: A Studio Two site doesn't use this extension. A site creates collections directly instead. See Create a Collection in Studio Two.
When you add the extension, the generated files land under src/extensions/backend/data-collections/. One builder file registers every collection, and each collection has its own definition file:
| File | What it's for |
|---|---|
data-collections.extension.ts | The builder file that registers the project's collections. A project has one, shared by all its collections. |
<collection-name>.ts | The definition of one collection, including its fields, permissions, indexes, and initial data. |
<collection-name> comes from the name you give the collection. It must be 1 to 36 characters, using only letters, numbers, underscores, and hyphens, and it must be unique in the folder.
The extension is also registered in the project's src/extensions.ts, with an import and a .use() call. When you add more collections, their definition files go in the same folder, and the builder file imports them.
The data-collections.extension.ts file calls extensions.dataCollections() with the collections to register. Import extensions from @wix/astro/builders, in both a Wix CLI app and a headless project:
This example registers two collections:
The configuration object takes these fields:
| Field | Type | Description |
|---|---|---|
id | string | Required. The extension ID as a GUID. It's generated with the file, and it must be unique across extensions in the project. |
name | string | Required. A name for the extension. Defaults to 'Data Collections'. |
collections | array | Required. The default export of each collection definition file to register. |
Each <collection-name>.ts file defines one collection. Its default export is a collection definition. A generated file starts with two fields and default permissions:
The file also exports collectionIdSuffix, the same string as idSuffix, so other code in the project can refer to the collection without repeating the string.
A collection definition takes these top-level fields:
| Field | Type | Description |
|---|---|---|
idSuffix | string | Required. The last part of the collection ID. The full ID is the app namespace followed by / and idSuffix. 1 to 36 characters, using only letters, numbers, underscores, and hyphens. |
displayName | string | The collection's name in the CMS. |
fields | array | Required. The collection's fields. Each field has a key, a type, and an optional displayName. |
displayField | string | The key of the field that identifies an item when another collection references it. |
dataPermissions | object | Required. The role that each item action needs. The actions are itemInsert, itemRead, itemRemove, and itemUpdate. |
indexes | array | Indexes that speed up queries on the collection. |
initialData | array | Items Wix adds when it creates the collection on a site. Each item must match fields. |
For every field type, field option, and index option, and for the initial data format, see the Data Collections Extension JSON Reference.
Each dataPermissions action takes one of these roles, from the most open to the most restricted:
ANYONESITE_MEMBERSITE_MEMBER_AUTHORCMS_EDITORPRIVILEGEDFor who each role includes, see About the Data Permissions API.
Last updated: 2 November 2026