Staging is dead: The rise of preview environments
Published: 2022-12-22 15:28:08

While the embers of staging environments are still smoldering, like a phoenix, preview environments have risen from their ashes. 

Modern software development teams are increasingly using preview environments, also known as [ephemeral environments](https://ephemeralenvironments.io/), to test and preview their features. Unlike traditional staging environments, which were typically shared by multiple teams and often led to bottlenecks and delays, preview environments are created on-demand for each developer. This allows for greater collaboration and feedback, as well as improved testing due to production parity. Preview environments are fully automated, which saves time, costs, and resources compared to manually setting up and maintaining staging. 

Overall, preview environments provide a superior solution for modern software development teams who need to ship to production multiple times a day. The goal is to empower teams to ship higher quality code at a higher velocity.

## Traditional staging bottlenecks

Having only a single staging server can quickly become a bottleneck for developers, as they must wait their turn to deploy to production. Maintaining a staging environment is always challenging, as it is difficult to keep it [in sync with production](https://squeaky.ai/blog/development/why-we-dont-use-a-staging-environment#whats-wrong-with-staging-environments). The challenges and frustrations associated with using a single staging environment often lead developers to devise workarounds, such as creating their own "staging" environments. This can introduce additional complexity, overhead, and security risks. 

Ephemeral environments, on the other hand, eliminate these issues by providing each piece of work with its own dedicated environment.

## Collaboration & feedback

Before the use of preview environments, developers often had to rely on screenshots and videos to showcase their work to stakeholders and other teams. This usually resulted in "review meetings" where various teams, such as product, design, and stakeholders, would gather to review the work. Collaboration and feedback were difficult to do asynchronously and a lot of time was often wasted in these meetings. 

Instead of sharing screenshots and videos, or holding "review meetings," preview environments can be easily shared via a URL. This allows for asynchronous collaboration and feedback, saving time and resources. Sales teams can also benefit from using preview environments, as they allow for easy demos of new features to prospective customers. 

Overall, preview environments provide a more efficient and effective way to review and demo work.

## Testing

There are several benefits to using ephemeral environments for testing. These environments are nearly identical to production, which gives developers increased confidence that their code will work when it's deployed.

Using ephemeral environments also makes it easier for developers to perform code reviews. They don't have to spend time rebuilding their local environments, which can be time-consuming and difficult. This means that developers are more likely to test their code thoroughly, leading to better code quality and fewer bugs. Ephemeral environments require little to no maintenance, which means that teams can focus on testing their work with the level of quality and thoroughness that it deserves; eliminating the need to cut corners in testing.

## Automated infrastructure

Preview environments and the underlying infrastructure that powers them are automated and require little human intervention. Whenever a developer opens a new pull request, a new environment is created specifically for that piece of work. These environments are designed to be created and destroyed quickly, so if an environment breaks for any reason, a new one can be spun up in a couple of minutes. 

Since these environments are automated, your DevOps team has one less thing to worry about as we all know that DevOps teams are often [under significant stress](https://spacelift.io/blog/are-it-jobs-stressful). 

## Cost control & savings

Preview environments are designed to be ephemeral, meaning they only exist for as long as you need them. This can save you money since you don't have to pay for environments that aren't being used. For example, you can automate these environments to spin up for every pull request and have them automatically destroyed when the request is approved and merged. The environment only exists for as long as necessary, so you only pay for what you actually use.

## Preview environments and the Coherence SDLC

{% embed https://www.loom.com/share/a4b8a0cf99db497d81a3efa11d840094 %}


Preview environments are an integral part of the [Coherence SDLC](https://docs.withcoherence.com/docs/reference/sdlc-workflow). After creating a new branch in Coherence, an isolated ephemeral environment is automatically created for it. Development is done via a [workspace](https://docs.withcoherence.com/docs/reference/workspace), and the new code is then pushed, via git, to the branch. Coherence automatically triggers a new build, updating the environment with the latest changes. Developers can then easily share the environment with whomever they wish via a unique URL. Once the branch has been approved and merged, Coherence will automatically destroy the environment and its underlying infrastructure.

## Conclusion

While staging environments may not be dead yet, they are on life support. We’re seeing an explosion in third-party ephemeral environment providers because the demand is there. At Coherence, not only are we bullish on preview environments, we believe they’re core to an integrated development experience. The long term bet we’re making is preview environments in conjunction with cloud development environments, which we refer to as [workspaces](https://docs.withcoherence.com/docs/explanations/remote-development-with-workspaces), is the real wave of the future

If you want to see what the future of software development looks like, we invite you to [try one of our free sandboxes](https://app.withcoherence.com/?signup=true).