A publishing environment corresponds to one or more deployment servers or a content delivery destination where the entries need to be published. The most common publishing environments used are development, staging, and production.

Add an Environment

Go to Settings > Environments to view the list of all the available environments for a stack. Click + New Environment to create a new one. The Create Environment dialog box that appears allows you to add details about the destination.

Enter environment name

This could be a name of your choice. The most common environment names are staging, development, and production.

Specify base URL

The Base URL is the consistent part of the destination’s web address (for example, http://localhost:4000, http://www.example-site.com). It helps Contentstack identify the destination to which the content will be published. The base URL is used as a prefix when the URL of an entry is generated. It is important to note that base URL would be different if using different languages (for example, http://www.example-site.com/en/).

Note: If you wish to preview your published content, you need to provide the address of your localhost as the base URL of the environment, i.e., http://localhost:4000. Now, after publishing your content, point your browser to 'http://localhost:4000/{relative-url-of-the-published-entry}' in order to view the published content on your browser.

In case of mobile apps or other devices, you need not enter the base URL. This is because apps fetch content directly from Contentstack servers through APIs.

Advanced settings

The ‘Advanced’ option in the ‘Create Environment’ dialog box lets you add advanced settings related to the environment. When you click the Advanced link, it displays a checkbox that says ‘Deploy Content to Server(s)’.

When this option is selected, every time you publish an item to the corresponding environment, Contentstack saves a copy in the local web server. Subsequently, whenever an incoming page request is received, the content will be retrieved and rendered directly from the local server, instead of fetching it from the Contentstack database via APIs. This process is also known as push publishing.

It is recommended that you select this option only if you are using our web framework (contentstack-express) for your websites.

Note: contentstack-express framework has been deprecated. We will soon stop supporting this framework. Instead, we recommend using DataSync, which is faster and more flexible than the web framework.

For apps, unlike web pages, the content is not pushed to any external servers. Instead, the app fetches content directly using Content Delivery API. Therefore, there is no need to deploy content to servers. In this case, disabling the 'Deploy Content to Server(s)' option will let you publish the entry on an environment without deploying the content on the server.

Tutorial Video

In this short video, we will create a development environment with base URL as http://localhost:4000.

Add an Environment.png

Preview Entry

Hover on the Preview (eyeball) icon beside the URL field to view the URLs of all the environments in which the entry has been published. Click any of the links to visit the web page and view the entry.


Edit an Environment

In Settings > Environment, you can view the list of all the environments created for a stack. To edit the details, simply click the name of the environment. This will open the Update Environment dialog box, where you can update the name, base URL, language, and advanced settings of the environment.

Edit an Environment.png

Delete an Environment

To delete an existing environment of a stack, go to Settings > Environment. When you hover on any of the environments, you will notice a 'More Options' icon (three vertical ellipses) on the right. Click this icon to get the Delete option.

Tutorial Video

Delete an Environment.png
Was this article helpful?