Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStoreIntegrating your storefront with Headless CMS
Part 1: Configuring your VTEX account with the Headless CMS
Let's set up all the tools you need to integrate the Headless CMS with your FastStore project. First, we will install the VTEX IO CLI. The VTEX IO CLI will help you during your development process by allowing you to perform different actions in the VTEX platform. In the following, we will install and configure the Headless CMS app in your VTEX account.

Before you begin

Before you proceed with setting up the Headless CMS in your account, please ensure the following:

Installation of the Headless CMS and its dependencies

Ensure that you have installed the vtex.admin-cms@1.x and its dependencies as described in the FastStore requirements.

Successful FastStore Onboarding

Make sure the FastStore Onboarding process has been completed successfully. The Headless CMS is installed during this onboarding phase. For detailed instructions, please refer to the Starting a new FastStore project tutorial.

Installation of VTEX IO CLI

Ensure that you have installed the VTEX IO CLI on your machine. This CLI is required to install the Headless CMS plugins and CMS dependencies. For more information, please refer to the Installing VTEX IO CLI guide.

Step by step

Step 1 - Setting up the command-line environment

  1. Access the VTEX IO CLI and Log in to your VTEX account:
Remember to replace the values between curly brackets according to your account name.

_10
vtex login {account}

  1. Install the Headless CMS plugin:

_10
vtex plugins install cms

Now, check if the installation of the Headless CMS plugin was successful by running vtex cms.
{"base64":"  ","img":{"width":2142,"height":636,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":123285,"url":"https://vtexhelp.vtexassets.com/assets/docs/src/faststore-vtex-cms___460365970fb39c94e300b9fbd497e17e.png"}}
  • Windows user: if you find problems while installing the plugin, please refer to the Troubleshooting article
  • macOS user: if you find problems, run yarn config set ignore-engines true to ignore the Node.js incompatibility version, then run vtex plugins install cms again.
Remember, we recommend using the latest Node.js version or a version higher than 15.0.0.

Step 2 - Configuring the Headless CMS

Let's configure the URLs of the webhooks used by the Headless CMS app.
  1. In the VTEX Admin, access Extensions Hub > App management.
  2. Search for the CMS (alpha) app and click on Settings.
  3. Expand the pre-filled item, Item # 0, which is automatically created during the FastStore Onboarding process for your project.
  4. If you're using the VTEX CI/CD, you must fill in the Build Webhook URL field with the following value. Replace the values between curly brackets according to your scenario.

_10
https://app.io.vtex.com/vtex.cms-builder-sf-jamstack/v1/{account}/{workspace}/build-releases

{"base64":"  ","img":{"width":2454,"height":2451,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":285226,"url":"https://vtexhelp.vtexassets.com/assets/docs/src/cms-alpha-settings___5ec952c685b0e9c70d47378e6718a0d1.png"}}
When an editor clicks to publish a page using the Headless CMS interface, the CMS calls the Build Webhook URL, which changes the status of that page to published. The CMS, then, waits for the content to be built in the background.
  1. Fill in the Preview URL field with your production URL. This URL activates the button on Headless CMS for you to preview the changes made on a page. Replace the values between curly brackets according to your scenario.

_10
https://{account}.vtex.app/api/preview

  1. Fill in the Production base URL field with your store's endpoint to preview changes in the Headless CMS before publishing them. Replace the values between curly brackets according to your scenario.

_10
https://{account}.vtex.com/

  1. Click on SAVE.

Step 3 - Communicating WebOps updates to the Headless CMS

Now, if you are developing your FastStore project with CI/CD and Headless CMS, you must ensure that CI/CD is aware of every CMS update performed via the VTEX Admin. To do so, you must configure the WebOps webhooks responsible for communicating with the Headless CMS as in the following.
  1. Open your FastStore project in any code editor of your preference.
  2. Edit the faststore.config.js file in the root directory of your project.
  3. In the Headless CMS configuration, add the webhookUrls property corresponding to your store website as in the following:
faststore.config.js

_10
"vtexHeadlessCms": {
_10
webhookUrls: [
_10
"https://{account}.myvtex.com/cms-releases/webhook-releases"
_10
]
_10
}

  1. Open a Pull Request in your project including the previous changes.
  2. Merge the Pull Request.
Now you can make changes to the Headless CMS and check if commits are being created in the project. In the following example, the Hero title was modified to 10% off on first purchase, and we can see that it generated a commit in the repository.
{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAI0lEQVR4nGP49+//69fvpOQ1GJgFGR48uHvn7gMpRS0GVlEAvR8L6oGXpxYAAAAASUVORK5CYII=","img":{"src":"https://vtexhelp.vtexassets.com/assets/docs/src/cms-example-commits___7bb21be1504033098122feb013667b49.png","width":950,"height":441,"type":"png"}}
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
See also
VTEX IO CLI
Guides
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page