Keep Stacks in Sync

If you have some content published on an environment (for example, “testing” or “staging”), and you want to publish the same content on another environment (say “production”) without impacting any content or code, you can do this in two possible ways. 

Also, cross referencing between stack is not supported while using a reference field. Even in this case, you can use the following two methods to keep your stacks' data in sync.

Use Multiple Environments

The first recommended way is to create and use multiple environments. For example, you can create two environments in your stack, let's say “development” and “production.” In this case, “development” will serve as a test environment and “production” is the environment where your feature or content will be available for users.

When using multiple environments, you can first publish the content on the development environment. Here, you can verify that all changes that you have made are correct and there are no errors. Your production or other environments will not be affected by this action.

Once you are satisfied, then you can publish the content on the production environment. Another alternative is to use Workflows as it will help you restrict users from publishing to the “Production” environment and only authorized users can make content live or public. This also gives you an opportunity to verify content before it goes live.

Use Multiple Stacks

If you want to maintain separate content types and entries, you can use the multiple stack option. In this way, all the content types and entries will be isolated from each other. You can use a script, in this case, to enable our Content Management API requests to reflect the changes on each stack using Webhooks and the REST API requests.

Note: SSO-enabled organizations can use the management token to make API requests.

We have crated a few guides on how to keep stacks in sync. Refer to the following guides for more information:

  1. Share Content Between Stacks Using a Web Proxy
  2. Sync Data Between Stacks Using Contentstack Webhooks and AWS Lambda
  3. Share Assets Between Stacks Using an Extension

Was this article helpful?