# Environments

## What do environments do?

In Formsort, **environments** are spaces you can deploy your variants to for different purposes, and the variant environment it is deployed to will correspond to the environment set up in [integrations](https://docs.formsort.com/integrations/integration-reference).

For example, you want to test the changes your team is making to a variant in a mocked "live" environment, but also do not want these changes available to your users. In this case you'll want to set up a **staging** environment to run testing. First, you'd configure the staging environment endpoints (see **editing environments** below) to make sure you can receive test answers; then, you'll deploy your variant to the staging environment.&#x20;

{% hint style="info" %}
Non-production environments are only available to clients that are on the [Enterprise](https://formsort.com/pricing/) plan. Enerprise clients will by default have access to two environments: **production** and **staging**, plus the option to create as many as are necessar&#x79;**.**
{% endhint %}

* **Production** should always be used for the "live" version of a flow. [Flowstarts](https://docs.formsort.com/flow-variant-management#flow-starts) are counted when users *load and interact with* flows deployed to the **production** environment.&#x20;
* **Staging** can be used to integrate with mock or test versions of your integrations, to create a production-like version of a flow that only talks to non-production systems. This is ideal for preventing production data contamination. It is optional to use staging, but for complex forms it is useful to have. **Flowstarts** do not count in this environment.
* You can [create new environments](#creating-new-environments) if you need them. **Flowstarts** do not count in any new environments created. Test away!&#x20;

## Editing environments

Environments are defined per flow, and are shared across all [variants](https://docs.formsort.com/flow-variant-management#variants) of that flow, to ensure data integrity between variants.

From the flow index page, the **Integrations** tab will show the environments editor for your integrations.

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FUCJRn6oEKxGU5NgbfDMP%2Fimage.png?alt=media&#x26;token=b59fa2c8-b5d5-4e9d-bf04-10928100cc69" alt=""><figcaption></figcaption></figure>

Here it is possible to edit all aspects of integrations:&#x20;

* create a new integration environment (e.g. create a "dev" environment)&#x20;
* configure setup for a new integration target
* make updates to existing integration targets

Since adjustments are made on a per-environment basis, your production environment will likely have a different integration configuration than your staging environment.&#x20;

### Creating new environments

Clicking **Edit...** on the top right of the environment editor shows a list of the current environments and allows the addition of new environments. You will see that a **production** and **staging** environment are added by default.&#x20;

Click **+Add environment** if you'd like to create a new environment. You can also **delete** environments in this menu.&#x20;

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FhdJZF1aghw9jiIx71Mhl%2Fimage.png?alt=media&#x26;token=306e0d6b-e9e3-47d9-a14a-97b2d7bd58d1" alt=""><figcaption></figcaption></figure>

Once you've added a new environment, you will see it's availability in the dropdown list of environments.&#x20;

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2F8BtGuiHmcd49LqVpb6mz%2Fimage.png?alt=media&#x26;token=f14e5b5e-03ea-4753-8a27-2714a885a3b6" alt=""><figcaption><p>Newly-created dev environment is available. </p></figcaption></figure>

### Saving and propagating changes

When changes have been made to any of the integrations, you will be prompted to save them, regardless of which environment you are in.

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FLchaZooztQAwHBzgeD45%2Fimage.png?alt=media&#x26;token=673f3e50-e884-476f-b3e7-52214b07dae5" alt=""><figcaption><p>Save your changes</p></figcaption></figure>

### Deploying your variants to different environments

After saving the changes you've made to your integrations, your live variants need to be **redeployed** to the matching environment so that the changes can be propagated to your flow.&#x20;

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FK2Q1PFV5SJGLtnoDPtyY%2Fimage.png?alt=media&#x26;token=c313be0b-48a5-4847-880e-c0d1e28ace48" alt=""><figcaption></figcaption></figure>

For instance, if integration changes have been made in your **staging** environment, make sure to deploy or redeploy any variants you are using to **staging**. &#x20;

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FsQHprPyu02Ajx9K7q4Jl%2Fimage.png?alt=media&#x26;token=18564759-7a66-4dfb-be77-9f918880cf9b" alt=""><figcaption></figcaption></figure>

When you're ready to test, proceed to [Loading different environments](https://docs.formsort.com/publishing-and-deployment/environments/setting-the-environment). Happy testing!&#x20;
