<!-- Source: https://keybeat.dev/docs/quickstart -->

# Quickstart

This guide takes you from nothing to a deployed monitor in about ten minutes. You need Node.js 20 or later and a site with a public URL.

If you would rather have your coding agent do this for you, see [Quickstart for agents](https://keybeat.dev/docs/agents).

## 1. Create an account

Sign up at [app.keybeat.dev/signup](https://app.keybeat.dev/signup) with GitHub, Google or an email magic link. Signing up creates a personal organization on the free plan, with an email alert channel for your address.

## 2. Log in from the CLI

The CLI is published on npm as `keybeat` and runs with `npx`, so there is nothing to install globally.

```bash
npx keybeat login
```

The CLI prints a short code and opens `https://app.keybeat.dev/authorize/cli` in your browser. Check that the code matches, pick an organization and approve. The CLI receives an API key and stores it in `~/.config/keybeat/credentials.json`.

Check that it worked:

```bash
npx keybeat whoami
```

## 3. Create the keybeat folder

From the root of your project:

```bash
npx keybeat init
```

This creates a `keybeat/` folder with a `keybeat.json` file and an example spec. Monitors live in your repository next to your code, so they are reviewed and versioned like everything else. See [Monitors as code](https://keybeat.dev/docs/monitors-as-code).

## 4. Write a monitor

A monitor is a single Playwright Test spec. Replace the example with a check of something that matters, such as your login page:

```ts title="keybeat/login.spec.ts"
import { test, expect } from '@playwright/test';

test('login works', async ({ page }) => {
  await test.step('open login page', async () => {
    await page.goto('https://example.com/login');
    await expect(page.getByRole('heading', { name: 'Sign in' })).toBeVisible();
  });

  await test.step('sign in', async () => {
    await page.getByLabel('Email').fill(process.env.LOGIN_EMAIL!);
    await page.getByLabel('Password').fill(process.env.LOGIN_PASSWORD!);
    await page.getByRole('button', { name: 'Sign in' }).click();
  });

  await test.step('see the dashboard', async () => {
    await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
  });
});
```

And list it in `keybeat/keybeat.json`:

```json title="keybeat/keybeat.json"
{
  "monitors": [
    { "slug": "login", "name": "Login works", "file": "login.spec.ts", "interval": "60m", "enabled": true }
  ]
}
```

The free plan allows one monitor at a 60 minute interval. Paid plans allow `15m`, `5m` and `1m`. See [Writing monitors](https://keybeat.dev/docs/writing-monitors) for the full rules.

## 5. Test it locally

```bash
LOGIN_EMAIL=monitor@example.com LOGIN_PASSWORD='...' npx keybeat test login
```

`keybeat test` runs the spec on your machine with the same settings as the cloud runner: Chromium, one worker, no retries and a 60 second limit. It uses your local Playwright install, so if Chromium is missing run `npx playwright install chromium` once.

## 6. Deploy

`deploy` creates or updates every monitor listed in `keybeat.json`. A monitor that needs secrets would fail its first scheduled run without them, so deploy it disabled first. Set `"enabled": false` in `keybeat.json`, then:

```bash
npx keybeat deploy
npx keybeat env set login LOGIN_EMAIL=monitor@example.com
npx keybeat env set login LOGIN_PASSWORD     # prompts for the value without echoing it
```

Secrets are encrypted, write only, and masked as `***` in logs. In scripts, pipe the value instead (`printf '%s' "$LOGIN_PASSWORD" | npx keybeat env set login LOGIN_PASSWORD`) so it never appears on a command line. Now set `"enabled": true` and deploy again:

```bash
npx keybeat deploy
```

Monitors without secrets can be deployed enabled straight away.

## 7. Run it in the cloud

```bash
npx keybeat run login
```

This starts an on-demand run, waits for the result and prints each step with its timing. From now on Keybeat runs the monitor on its schedule from a random region and emails you if it fails twice in a row from two different regions.

## Next steps

- Add more alert channels, such as a webhook or SMS: [Alerts](https://keybeat.dev/docs/alerts).
- Publish a public status page: [Status pages](https://keybeat.dev/docs/status-pages).
- Deploy monitors from CI with an API key: [Monitors as code](https://keybeat.dev/docs/monitors-as-code).
- Let your agent investigate failures through the [MCP server](https://keybeat.dev/docs/mcp).
