# About virtual environments

## Introduction

Virtual environments are a great way for enterprise organisations to manage large-scale sync requirements with minimal process flows and no replication of effort.&#x20;

This page provides detailed context and background information, but if you prefer to get straight into seeing how this feature works, our CTO walks through some key benefits in the demonstration video below:

{% embed url="<https://www.youtube.com/watch?v=8JI1LHnFU9A>" %}

## The problem

Some customers run multiple stores and brands through a single Patchworks account, with duplicate process flows to cover testing, staging and production.&#x20;

To illustrate the complexities of this, imagine running an international online shop where your online storefronts operate through Shopify - one per country and environment.

Suppose you operate in 5 countries (UK, FR, DE, ES and US) - so that’s 5 stores. Each store then requires a *sandbox* and *live* environment, so you would need 10 instances of a Shopify connector.

Next, we come to process flows. Let's assume you need 5 process flows to meet all operational requirements (orders sync, warehouse sync, accounts sync, inventory sync, CRM sync). A single process flow receives source data from a single Shopify instance, which means creating and managing 50 process flows.

Now, suppose you need to update a process flow. This change would need to be replicated in all 50 process flows. You can see this illustrated below:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWQUVOSCFLOIGlS57p5tR%2Foverview%201a.png?alt=media&#x26;token=dab76377-e39a-4ff5-9d35-c48166bc68d9" alt=""><figcaption></figcaption></figure>

## The solution

A *virtual environmen*t is a collection of overrides (known as *replacements*) that can be applied when a 'master' process flow runs, so the requirements for a particular environment can be met. To better understand, let's go back to our scenario [above](#the-problem).&#x20;

In this case, we can create 5 'master' process flows:

* Orders sync
* Warehouse sync
* Accounts sync
* CRM sync
* Inventory sync

&#x20;And 10 virtual environments:

* UK (Sandbox)
* UK (Live)
* FR (Sandbox)
* FR (Live)
* DE (Sandbox)
* DE (Live)
* ES (Sandbox)
* ES (Live)
* US (Sandbox)
* US (Live)

Each virtual environment is configured with the required overrides for your 'master' process flows - i.e. components to be replaced in the 'master' flow when it's deployed and running in this environment.

You may think this is still a lot of setup, and it is when we have such a high number of environments to consider. However, this is a one-off effort - the benefit comes when you need to update a process flow further down the line. Instead of replicating the same change in 50 process flows, you make it once in the relevant  'master' process flow and then deploy that change to all virtual environments. &#x20;

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FeR4GvQs4j5WvKmGjbHrp%2Foverview%20b.png?alt=media&#x26;token=284aadf8-74ce-47ae-81be-ed9a7bb5f290" alt=""><figcaption></figcaption></figure>

## What replacements can I configure for a virtual environment?

For any virtual environment, you can define overrides/replacements for the following process flow components:

| Item                                                                                                                                                                                                  | Related shape/area                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Connector instances](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance)                                                       | [Connector](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape)                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Data pools](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/de-dupe-shape/working-with-data-pools#adding-a-data-pool) | [De-dupe](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/de-dupe-shape)                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Cross-reference lookups](https://doc.wearepatchworks.com/product-documentation/process-flows/cross-reference-lookups/adding-a-cross-reference-lookup)                                                | [Map shape (transform function](https://doc.wearepatchworks.com/product-documentation/process-flows/cross-reference-lookups/using-a-cross-reference-lookup-in-field-transformations))                                                                                                                                                                                                                                                                                                                                                                        |
| [Scripts](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts)                                                                   | <p><a href="../process-flows/building-process-flows/process-flow-shapes/advanced-shapes/script-shape">Script shape</a></p><p><a href="../process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions/other-transform-functions/script-transform-function">Map shape (transform function)</a></p>                                                                                                                                                                     |
| [Company caches](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape)                             | <p><a href="../process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape">Add to cache shape</a><br><a href="../process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/load-from-cache-shape">Load from cache shape</a><br><a href="../process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions/other-transform-functions/cache-lookup-transform-function">Map shape (transform function)</a></p> |
| [Flow variables](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables)                                                         | [Process flow settings](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-settings)                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Flow queue priority](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-settings#understanding-process-flow-settings)                           | [Process flow settings](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-settings)                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Virtual environments at scale

A process flow can be [deployed to virtual environments directly from the process flow canvas](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment) - select the required flow version, then a virtual environment, and confirm.

However, deploying multiple process flows to different virtual environments can be streamlined using [packages](https://doc.wearepatchworks.com/product-documentation/virtual-environments/virtual-environment-packages). Here, you create a 'package' containing the required process flow versions and any virtual environments where these should be deployed. You can then deploy the package, updating all virtual environments in a single operation.

{% hint style="info" %}
When managing multiple flows in different environments, it can be useful to compare what's deployed to where - the [compare](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments/comparing-process-flow-versions) feature allows you to do this.
{% endhint %}

## API

All dashboard functionality for virtual environments can be replicated programmatically using the Patchworks API. This allows you to:

* Integrate deployments into your CI/CD pipelines
* Automate environment-specific deployments
* Dynamically manage configuration versions and environment settings
* Maintain consistency and version control at scale

For a full list of available endpoints and example requests, please refer to our Postman documentation:

{% embed url="<https://postman.wearepatchworks.com/>" %}

## Enabling virtual environments for your company profile

The virtual environments feature is available for all subscription tiers - you'll find it in the main navigation menu

## Virtual environment allowances

The virtual environments feature is available on all [core subscription tiers](https://doc.wearepatchworks.com/product-documentation/getting-started/core-subscription-tiers). By default, all tiers allow for the creation of up to 2 virtual environments (for example, a `test` and a `live` environment). If you require more environments, please [contact our Sales team](https://www.wearepatchworks.com/pages/contact-us) for details.&#x20;

Existing subscription tier and bolt-on allowances apply when creating process flows for (and running process flows) in virtual environments.
