Installing the Checkly CLI
To kickstart a new project with the CLI, we recommend running npm create checkly
. But you can also add the CLI
from scratch with the following steps.
Prerequisites
- Node.js
v16.x
or higher. - A text editor like Visual Studio Code.
Installation
First, install the CLI.
To use TypeScript, also install ts-node
and typescript
:
Create a minimal checkly.config.ts
(or checkly.config.js
) at the root of your project. We recommend using TypeScript.
Use the CLI to authenticate and pick a Checkly account. Make sure you have signed up for a free account on checklyhq.com before hand or just sign up for a new account straight from the terminal.
Direct download
If you cannot access the npm registry directly, you can also download the Checkly CLI via our CDN.
The download is a zipped folder containing a full installation of the boilerplate example project. You will find the following files and folders:
- a
checkly.config.ts
file. - a
package.json
file including the necessary Typescript dependencies. - a
node_modules
directory with all dependencies pre-installed. - a
__checks__
folder with some example checks.
If you want to move the CLI and its constructs to a different, already existing Node.js project, just copy the full contents
of the node_modules
folder to your project and manually add a checkly.config.ts
file.
Authentication
There are different ways to authenticate when using the CLI depending on the environment where you are running the CLI from.
Interactive
When running the CLI interactively from your dev environment, just use the built-in login
command. If you have multiple
Checkly accounts, it will prompt which account you want to target
Once authenticated, you can switch between accounts using
or quickly find out which account you are currently targeting with
From CI
When running the CLI from your CI pipeline you will need to export two variables in the shell:
CHECKLY_API_KEY
CHECKLY_ACCOUNT_ID
Go to your Settings page in Checkly and grab a fresh API key from the API keys tab and your Account ID from the Account settings tab.
Using a Proxy Server
The CLI respects the common HTTP_PROXY
environment variable for any outbound traffic, like running npx checkly test
or npx checkly deploy
.
The CLI communicates with the following domains if you need to allow-list them in your proxy:
api.checklyhq.com
events.checklyhq.com
Last updated on December 13, 2024. You can contribute to this documentation by editing this page on Github