> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Add a Data Collections Extension with the Wix CLI ## Article: Add a Data Collections Extension with the Wix CLI ## Article Link: https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/data-collections/add-a-data-collections-extension-with-the-wix-cli.md ## Article Content: # Add a Data Collections Extension with the Wix CLI
This feature is in Developer Preview and is subject to change.
The [data collections extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/about-data-collections-extensions.md) lets your app automatically create data collections in a site's CMS. When a Wix user installs or updates your app, the collections are created with the configuration you define. Follow the instructions below to: 1. Generate the extension and 1 or more collections in your project. 2. Configure each collection's schema, permissions, and initial data. 3. Release a new app version so the collections are created on installed sites. Once complete, your app automatically creates the specified collections in the CMS whenever a Wix user installs or updates it. > **Note:** The site that installs your app must have the [CMS](https://support.wix.com/en/article/cms-formerly-content-manager-getting-started?tabs=Wix-Editor) added. Without the CMS, collections added by the extension won't appear after installation. You can bundle the CMS with your app by [adding it as a dependency](https://dev.wix.com/docs/build-apps/launch-your-app/market-listing/add-app-dependencies.md). ## Step 1 | Create the extension In the terminal: 1. Navigate to your project repo. 2. Run the [generate](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/generate.md) command. 3. The CLI displays a menu of extensions to generate. Under **Backend**, select **Data Collection** and press **Enter**. 4. Enter a collection name when prompted. The name must be 1–36 characters and can only contain letters, numbers, underscores, and hyphens. The name must also be unique in the data collections extension folder. The first time you run this command, the CLI [creates the shared extension file](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/data-collections/data-collections-extension-files-and-code.md) (`data-collections.extension.ts`) alongside the new collection's definition file. Subsequent runs add new collection definition files to the same shared extension and register them automatically. ## Step 2 | Configure the collection Each collection is defined in its own `.ts` file. The default export is an object that describes the collection's schema, permissions, indexes, and initial data. The object follows the schema documented in the [data collections extension JSON reference](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections-extension/introduction.md). You can add multiple collections with the [`generate`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/generate.md) command. The CLI generates each collection with default fields and permissions. Edit each collection's `.ts` file to fit your data model. Learn more about [data collections extension files and code](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/data-collections/data-collections-extension-files-and-code.md). ## Step 3 | Build and deploy your project [Release a new app version](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/release.md), then [build and deploy](https://dev.wix.com/docs/wix-cli/guides/development/build-and-deploy-a-project.md) your project. Learn more about [app version updates](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/about-data-collections-extensions.md#app-version-updates). > **Note:** Collection changes only affect users who update to the new major version. Users on older versions retain their existing collections. Changes can take up to 5 minutes to propagate after an update. ## Delete a collection or the entire extension To delete a single collection from your extension: 1. Delete the collection's `.ts` file. 2. In `data-collections.extension.ts`, delete the matching `import` statement and the entry for that collection from the `collections` array. To delete the entire data collections extension: 1. Delete the `src/extensions/backend/data-collections/` folder. 2. Delete the `import` and `.use()` statements for the extension from your [`extensions.ts`](https://dev.wix.com/docs/wix-cli/guides/extensions/about-the-extensions-ts-file.md) file.
__Important:__ If you already have a version of your app project, you must build and deploy the project again after removing the data collection extension files.
## See also - [Data Collections Extension Files and Code](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/data-collections/data-collections-extension-files-and-code.md) - [About Data Collections Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/about-data-collections-extensions.md) - [Add a Data Collections Extension in the App Dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/add-a-data-collections-extension-in-the-app-dashboard.md) - [Data Collections Extension JSON Reference](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections-extension/introduction.md) - [About the Wix Data Collections API](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md)