The environments you want, with none of the work

Encore makes it simple to create the environments you need to build your application with confidence: local, preview, testing, and production. Each environment is an isolated fully working instance of your backend, automatically provisioned by Encore.

Environments always stay in sync, as they are created based on the needs of your application, using the Encore Application Model. Environments are provisioned using contextually appropriate infrastructure depending on the type of environment.

Creating environments

To create an environment for your app, open your app in the Cloud Dashboard and go to the Environments page, then click on Create env in the top right.

There you can pick a name, and decide if you want a production or development environment (see Environment Types below).

Choose how you would like to deploy to the environment (either by pushing to a Git branch or manually triggered), and whether or not you want to manually approve infrastructure provisioning or simply let Encore handle it.

Finally, select which cloud provider you want to deploy to (see the Cloud Providers documentation to learn more), and click Create. That's it!

Creating an environment

Environment Types

Encore has two primary types of environments: Production and Development.

Development environments include local, preview, and all environments created with the Development type.

They differ in the type of infrastructure that is provisioned:

  • Production environments are provisioned for maximum reliability, availability, and scalability.
  • Development environments are optimized to be cost-efficient and fast to provision.

Learn more about how different environments are provisioned in the infrastructure documentation.

Aside from determining infrastructure, environment type is also used for Secrets management.

Local environment

When you've installed the Encore CLI, you start your local environment by simply running encore run. This builds and tests your application, and provisions all the necessary infrastructure to run your application locally (see the infra docs to learn exactly how local infrastructure is provisioned).

By default, the local environment runs on http://localhost:4000.

Preview environments

When you connect your application to GitHub, Encore will automatically provision ephemeral Preview Environments for each Pull Request. Preview Environments work just like regular development environments, and make it simple to test your changes before merging. This can make collaborating on PRs much faster.

Preview Environments are named after the pull request, for example PR #72 creates a preview environment named pr:72 with the API base url https://pr72-$APP_ID.encr.app.

You can also view the environment in the Cloud Dashboard, where the url will be https://app.encore.dev/$APP_ID/envs/pr:72.

See the infra docs if you're curious about exactly how Preview Environments are provisioned.

Preview environment linked in GitHub

Frontend Collaboration

Preview Environments make it really easy to collaborate and test changes with your frontend. Just update your frontend API client to point to the pr:# environment. This is a one-line change since your API client always specifies the environment name, e.g. https://<env>-<my-app>.encr.app/.

If your pull request makes changes to the API, you can generate a new API client for the new backend API using encore gen client --env=pr:72 --lang=typescript my-app

Cloud environments

Encore makes it simple to create multiple cloud environments using different cloud providers, by connecting your cloud account. Cloud environments can be created as Development, or Production, depending on your use case (see the infra docs to learn exactly what infrastructure is provisioned in each cloud).