checkly/constructs,
for instance an ApiCheck or EmailAlertChannel. A construct is the “as-code” representation of the eventual resource
created / deleted / updated on the Checkly cloud once you run npx checkly deploy.
api.check.ts
The Checkly CLI supports JavaScript and TypeScript. The documentation focuses on TypeScript, because we recommend using TypeScript for a better developer experience.
npx checkly test and transform it to production monitoring with npx checkly deploy.
Project Structure
checkly.config.ts- Mandatory global project and CLI configuration. We recommend using TypeScript.src/__checks__/*- TS/JS files defining your checks and other resources.package.json- Standard NPM project manifest.
checkly.config.ts at the root of your project defines a range of defaults for all your checks.
Project Configuration
As your project grows, you will want to override these defaults for specific checks or check groups. The recommended way to tackle this is using a mix of global and local configuration.Global Configuration
As mentioned, your globalcheckly.config.ts holds a set of defaults for your project, checks, and some CLI commands. Use defineConfig to configure your Checkly project.
checkly.config.ts
Project construct section.
Local Configuration
Override any of thechecks global configuration settings at the individual check level.
__checks__/api.check.ts
ApiCheck construct or BrowserCheck construct section.
Logical IDs
Assigning alogicalId is crucial when creating a construct. Remember the following rules when creating and updating constructs:
- Every construct needs to have a
logicalId. This is the first argument when instantiating a class, i.e.
- Every
logicalIdneeds to be unique within the scope of aProject. - A
Projectalso has alogicalId. This needs to be unique within the scope of the Checkly account. - A
logicalIdcan be any string up to 255 characters in length. - There is no hard limit on the amount of
Projects you can have in your Checkly account.
logicalId to create a graph of your resources so we know what to persist, update and remove
from our database. Changing the logicalId on an existing resource in your code base will tell the Checkly backend that
a resource was removed and a new resource was created.
When using the Checkly CLI to manage multiple projects and repositories, each project’s logicalId should be unique within the Checkly account.
The project’s logicalId is used during the Checkly CLI commands to detect exactly which project is being used.
If multiple projects are using the same project logicalId, deploying one project will delete the checks that were deployed by another project.
The project logicalId can be configured in the project’s global configuration.
When changing the logical ID of a project you will keep all resources on your Checkly account, unless you run
npx checkly destroy to remove the old project.