Skip to main content
Checkly does not create a separate Environment resource. Instead, you combine CLI projects, environment variables, and your CI/CD pipeline to target each application environment. Use a separate Checkly CLI project for every long-lived environment that you want to monitor continuously. Use checkly test without deploying a project when you only need to validate an ephemeral environment, such as a pull request preview.

Choose an approach

A Checkly CLI project is a deployment boundary, not the same thing as a Git branch or application environment. Your pipeline decides which branch deploys which project.

Test an ephemeral environment

Pass runtime values to checkly test with --env (-e) or --env-file. The values apply only to that test session and do not update your scheduled monitors.
Terminal
This approach works well for pull request previews and other short-lived deployments. See CI/CD for the recommended test-before-deploy workflow.

Continuously monitor multiple environments

The following example deploys one shared API check to development, staging, and production. Each deployment has:
  • A unique project identity and separate deployment history
  • The same project-scoped check and group logical IDs
  • Its own URL and secret API token
  • Its own schedule, locations, and tags
  • A Checkly account and a Checkly CLI project
  • CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID configured in your CI provider
  • A persistent deployment URL and credentials for each environment
  • A CI branch or deployment event that identifies the target environment
1

Define a stable project identity for each environment

Read the target environment from your CI pipeline and map it to a unique project logicalId.
checkly.config.ts
Keep each project logicalId stable. Changing it creates a different project instead of updating the existing environment’s monitors.
2

Store environment-specific runtime values with the checks

Define values on a check or group when scheduled runs need them. In this example, the CLI reads the values from CI while deploying and stores them on the environment’s check group.
__checks__/api.check.ts
The application and api-health logical IDs can stay the same because resource logical IDs are scoped to their CLI project. Setting secret: true prevents Checkly from exposing the token after it is saved.
3

Deploy the project that matches the application environment

Map each persistent application environment to one Checkly project in your pipeline. Run the matching command after that environment’s application deployment succeeds.For example, the staging deployment job would run:
Terminal
The production job uses the same source files but supplies production values:
Terminal
Review the deployment changes before confirming them. After you have verified the mapping, a non-interactive CI job can use --force to skip the confirmation prompt.
A deploy reconciles only the project selected by its logicalId, but resources removed from that project are deleted by default. Run checkly deploy --preview when changing branch mappings or environment-specific check selection.

Run different checks in each environment

When an environment needs additional or different checks, keep shared checks in one directory and select the environment-specific directory from your configuration:
checkly.config.ts
For example, __checks__/shared/ can contain health and login checks, while __checks__/production/ contains production-only purchase checks. Each environment remains authoritative for its own deployed project.

Understand environment variable behavior

Prefer check- or group-level variables when the same key needs a different value in each environment. A global ENVIRONMENT_URL, for example, can hold only one account-wide value and is therefore not a good fit for separate development, staging, and production targets. Use secrets for credentials, tokens, and other sensitive values. For more detail about build-time and runtime values, see CLI environment variables and environment variables and secrets.

Playwright Check Suites

For Playwright Check Suites, keep URLs and credentials in runtime environment variables and read them from process.env in your Playwright configuration or fixtures. The project-per-environment model remains the same. See environment-aware Playwright tests for configuring baseURL, fixtures, and local-versus-Checkly execution.