Blog

October 2, 2025·Product

Preview Environments in Medusa

Stevche Radevski

Stevche avatar

Stevche Radevski

Preview environments represent an isolated approach to testing changes and offer a more streamlined development process in Medusa Cloud.

Image modal

Before going live, making changes is easy; breaking your application will not affect any customers. As soon as you are in production, your development process has to change to ensure that bugs never reach your customers.

A common approach to quality assurance is a staging environment where both automated and manual tests are performed before pushing to production. However, sharing a single environment can be a source of problems: changes are not isolated, test data can easily drift and get corrupted, and one person's bug can block the entire team, making it a less-than-ideal solution.

This is where preview environments come into play. They can complement or entirely replace staging environments while improving the reliability and development experience of your application. Discover how preview environments work in Medusa Cloud below.

What are Preview Environments

Think of a Preview Environment (Preview) as a temporary, isolated, running copy of your application that is automatically created from the code in a pull request (PR). When you open a PR, a new Preview is built and deployed. When the PR is merged or closed, the Preview is automatically destroyed.

The main benefits are:

  • Total Isolation: You can test only the changes from your branch without any interference from other developers' work.
  • Early Bug Detection: Both automated and manual tests can be run on your own personal version of the app, catching bugs much earlier.
  • Cost-Effective: Unlike a staging server that is always running (and costing you money), Previews only exist while you are using them.

Preview Environments in Medusa Cloud

Medusa Cloud treats Previews as a first-class feature, making them incredibly easy to use. A Preview in Medusa Cloud is a fully isolated and fully-featured Medusa application with its own database, file storage, and everything else you get out-of-the-box with Medusa Cloud.

As soon as you open a new pull request, a preview environment is created, built, and deployed. You can find the URL to your Preview either in the Cloud dashboard and as a comment on your pull request.

Image modal

Preview environments are provisioned with a copy of your production data. Any changes to that data are completely isolated to the Preview and will not affect your production database.

Alternatively, in your project settings, you can upload a preview-only dataset to be used when preview environments are created. As with the production data, each preview environment gets a copy of this data, and changes will not affect the seed dataset.

Image modal

Once you exceed the default limit for your plan, new Previews are created in a pending status and will not be provisioned until you manually increase the limit and provision them. This can be done by either accessing your Billing settings or by clicking "Provision" within the preview environment itself. You will be prompted to increase your limit, after which, the Preview will be built and deployed.

Image modal

Finally, when you either merge or close your pull request, the preview environment is destroyed, making way for new Previews to be provisioned.

Keep in mind that after a period of inactivity, preview environments will scale to zero and become inactive. This ensures you are only charged for the duration the PE is being used. Accessing the URL of a preview environment will bring it back up, and you can continue using it as usual.

Get Started with Previews

Previews are an excellent way to streamline your development process and ship high-quality code to your customers. With Medusa Cloud, this powerful workflow is built in and ready to use from day one.

Head over to medusajs.com/signup to get started building now.

Share this post

Ready to build your custom commerce setup?