Installation

Install Frontguard CLI and Playwright plugin in your project.

Installation

Frontguard has two packages — install what you need:

PackageUse Case
frontguardCLI for standalone visual regression testing
@frontguard/playwrightPlugin for visual assertions inside Playwright tests

CLI

npm install -D frontguard
pnpm add -D frontguard
yarn add -D frontguard
bun add -D frontguard

Or run directly with npx:

npx frontguard run --url http://localhost:3000

Playwright Plugin

npm install -D @frontguard/playwright
pnpm add -D @frontguard/playwright
yarn add -D @frontguard/playwright
bun add -D @frontguard/playwright

The Playwright plugin requires @playwright/test as a peer dependency. If you don't have it installed yet:

npm install -D @playwright/test
npx playwright install

Prerequisites

  • Node.js 18 or later
  • Playwright browsers — installed via npx playwright install
  • A running dev server — Frontguard needs a URL to render against

Playwright Browsers

Frontguard uses Playwright under the hood. Install the browsers you want to test with:

# Install all browsers
npx playwright install

# Install specific browsers
npx playwright install chromium
npx playwright install chromium firefox webkit

For CI environments, include system dependencies:

npx playwright install --with-deps chromium

Environment Variables

Set these optional environment variables for AI analysis and GitHub integration:

.env
# AI Analysis (BYOK — pick one)
FRONTGUARD_OPENAI_KEY=sk-...
FRONTGUARD_ANTHROPIC_KEY=...

# GitHub PR comments
GITHUB_TOKEN=ghp_...

Never commit API keys to source control. Use environment variables or a secrets manager.

Verify Installation

npx frontguard --version

You should see output like:

frontguard v0.1.0

Next Steps

On this page