npx checkly init installs the Checkly CLI and agent skills, and from there your agent can generate, test, and deploy your monitoring as Monitoring as Code that lives alongside your application code.
The steps below explain each phase so you understand what the agent does, and you can run them yourself if you prefer.
The recommended flow, end to end. Each phase is explained below.
Get started with Monitoring as Code
Prerequisites
Prerequisites
- Node.js
20.19+or22.12+, and npm - A terminal
- (Optional) the URL of an app or API you want to monitor
Let your AI agent set it up (recommended)
Runnpx checkly init and answer a few prompts to let your agent take over:
Terminal
checkly init installs the Checkly CLI and agent skills, creates a checkly.config.ts, installs dependencies, and copies a starter prompt tailored to your project to your clipboard. Paste it into your AI agent and follow the instructions.
From here, what the agent does depends on your project. It might:
- Scan your project and discover monitoring targets
- Create Checkly monitors in code
- Test them with
npx checkly test - Set up alert channels
- Reuse your existing Playwright tests
- Deploy your monitoring with
npx checkly deployafter your confirmation
Set it up yourself
The steps below use the Checkly CLI directly so you can build and deploy your monitoring by hand.Bootstrap a Checkly project
Run the init command in your project directory and decline the agent setup. It scaffolds a working example you can edit.This scaffolds a The
Terminal
checkly.config.ts file and a __checks__ folder containing a few starter checks:Project structure
checkly.config.ts file holds your project-wide settings, such as the default run frequency, locations, and which files contain your checks.Log in to Checkly
Log in to your Checkly account, or create a free one, right from the terminal.This opens your browser to authenticate. Once you’re logged in, you can run and deploy checks from your machine. Run
Terminal
npx checkly whoami at any time to confirm which account you’re connected to.Write your first check
Checks are code. The scaffolded Checkly turns every
__checks__/homepage.spec.ts is a Browser Check: a standard @playwright/test file that Checkly runs as a monitor. Edit it to load a page and assert on what matters:homepage.spec.ts
*.spec.ts file into a Browser Check through the browserChecks.testMatch pattern in your checkly.config.ts. To monitor an endpoint instead, edit __checks__/api.check.ts, which defines an API Check. For every construct and option, see the Constructs reference.Run your checks locally
Dry-run all your checks against Checkly’s global infrastructure before you deploy anything:You’ll see the results in your terminal:Runs are recorded as test sessions by default, with full logs, traces, and videos you can review in the Checkly web app.
Terminal
Deploy to production
Deploy your checks and related resources to Checkly. From now on, they run around the clock from Checkly’s global locations:Open your Checkly dashboard and you’ll see your checks, ready to start monitoring.
Terminal
Set up alerts
Add an alert channel so you’re notified when a check fails. Define the channels you want in a new Import the channels you defined and set them as defaults in your You can also attach
__checks__/alert-channels.ts file, then attach them to your checks through the alertChannels defaults in your config.- Email
- Phone
alert-channels.ts
checkly.config.ts so every check, including your Browser Check, uses them. This example assumes you defined both, so import only the channels you created:checkly.config.ts
alertChannels to an individual check or a check group for finer control. Run npx checkly deploy again to apply your alerting, and see the alert channels overview for every supported channel.When you’re done experimenting, tear down everything this project created with
npx checkly destroy.Go deeper
Constructs reference
Every check, monitor, and alert channel you can define as code.
CLI reference
All
npx checkly commands and options.Browser Checks
Monitor realistic user flows with Playwright.
API Checks
Monitor your backend services and endpoints.
Alerts
Configure who gets notified, and how.
CI/CD integration
Run and deploy your checks from your pipeline.