Lighthouse Monitoring Dashboard & Custom SEO Plugin

Technology: lighthouse · Category: monitoring · Last reviewed: 2026-10-20

Source: https://tech-stack.codeamanilabs.org/guide/lighthouse

Insight:

Lighthouse 13.5 audits four 0-100 categories (Performance, Accessibility, Best Practices, SEO) plus a new, unscored Agentic Browsing pass-ratio category (13.3+); PWA was removed in v12. Lighthouse 13 replaced the legacy performance audits with "insights" (cache-insight, third-parties-insight, ...), so old audit IDs in scripts and assertions silently return nothing. Lab scores gate PRs through Lighthouse CI (@lhci/cli 0.15.1, which still bundles Lighthouse 12.6.1); field truth (INP, real LCP/CLS) comes from CrUX via the PSI or CrUX API with a server-side key. Default to Lighthouse's mobile Slow 4G profile (US-first); add a Regular 3G job only for Kenya-targeted projects. Custom plugins ship domain audits (KSO index, county geo, School JSON-LD).

██╗     ██╗ ██████╗ ██╗  ██╗████████╗██╗  ██╗ ██████╗ ██╗   ██╗███████╗███████╗
██║     ██║██╔════╝ ██║  ██║╚══██╔══╝██║  ██║██╔═══██╗██║   ██║██╔════╝██╔════╝
██║     ██║██║  ███╗███████║   ██║   ███████║██║   ██║██║   ██║███████╗█████╗  
██║     ██║██║   ██║██╔══██║   ██║   ██╔══██║██║   ██║██║   ██║╚════██║██╔══╝  
███████╗██║╚██████╔╝██║  ██║   ██║   ██║  ██║╚██████╔╝╚██████╔╝███████║███████╗
╚══════╝╚═╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝  ╚═════╝ ╚══════╝╚══════╝

Lighthouse Monitoring Dashboard & Custom SEO Plugin

Focus: Run Google Lighthouse on demand or in CI, pick from your sites, and see scores, Core Web Vitals (lab and field) and custom domain audits. Also covers a custom Lighthouse plugin you can publish to npm, a Lighthouse CI gate with budgets, and PSI + CrUX API recipes.

Why Lighthouse in 2026

Lighthouse is the Chrome team's automated auditor. The same engine powers:

Lighthouse measures lab data: one synthetic load on an emulated device. Google Search uses field data instead: Core Web Vitals from real Chrome users, collected by CrUX. You need both. Lab data catches regressions before merge, and field data shows what users actually get.

Versions & tooling (verified 2026-10-20)

Package / API Current Notes
lighthouse 13.5.0 (2026-09-17) engines.node is >= 22.19 (since 13.0.0). ESM-only ("type": "module").
chrome-launcher 1.2.2 launches headless Chrome for Node runs
@lhci/cli 0.15.1 (2025-06-25) still the latest. Bundles lighthouse 12.6.1 for its own collection runs, not 13.x.
treosh/lighthouse-ci-action 12.6.2 wraps @lhci/cli ^0.15.1, runs on node24
PageSpeed Insights API v5 GET https://www.googleapis.com/pagespeedonline/v5/runPagespeed
CrUX API v1 POST https://chromeuxreport.googleapis.com/v1/records:queryRecord, 150 queries/min per Cloud project, free

Node version gotcha: lighthouse@13 requires Node >= 22.19, but this monorepo's root package.json declares engines.node >= 20. That mismatch is a known latent EBADENGINE for packages/dashboard, which depends on lighthouse ^13.4.1. Run anything that imports lighthouse on Node 22.19 or later. On Vercel, set the project's Node version to 22.x or 24.x. The PSI path only needs Node 18+ (global fetch).

What changed in Lighthouse 12 → 13.5

Release Change that matters
12.0.0 (2024-04-22) PWA category removed. Installability checks now live in DevTools > Application. Budgets (budget.json) removed from Lighthouse itself. SEO category reorganised: viewport and font-size moved to Best Practices, and tap-targets was replaced by target-size in Accessibility.
13.0.0 (2025-10-10) Legacy performance audits replaced by performance insights: uses-long-cache-ttl → cache-insight, third-party-summary → third-parties-insight, render-blocking-resources → render-blocking-insight, font-display → font-display-insight, uses-optimized-images → image-delivery-insight, and others. Removed offscreen-images, no-document-write, uses-passive-event-listeners, third-party-facades, uses-rel-preload, preload-fonts and font-size. Accessibility weights re-tuned. onlyCategories now errors on unknown ids. Minimum Node is 22.19.
13.1.0 (2026-04-03) Baseline compatibility audit.
13.2.0 (2026-04-30) WebMCP audits (webmcp-registered-tools, webmcp-schema-validity, webmcp-form-coverage) and an llms-txt check.
13.3.0 (2026-05-07) Agentic Browsing category added to the default config.
13.4.0 / 13.4.1 Public types entrypoint, docs for the agentic audits, and the viewer enables Agentic Browsing via the PSI API.
13.5.0 (2026-09-17) ard-schema (Agent Resource Discovery) audit, stricter validation of plugin categories, and the plugin version now appears in report credits.

Categories

Category id Scored What it checks
performance 0-100 FCP, Speed Index, LCP, TBT, CLS (lab) + insights
accessibility 0-100 ARIA, contrast, labels, focus, target size
best-practices 0-100 HTTPS, console errors, deprecated APIs, viewport
seo 0-100 crawlability, titles, meta, hreflang, canonical, structured data
agentic-browsing pass ratio, not 0-100 agent accessibility tree, CLS, llms.txt, WebMCP tool registration/schema, ARD schema. Google labels it "still under development and subject to change".

When a dashboard needs four numbers, run --only-categories=performance,accessibility,best-practices,seo. Request agentic-browsing separately and show it as "N of M checks passed".

The PSI v5 REST reference still lists only the four classic category enums. The 13.4.1 changelog, though, says the Lighthouse viewer enables agentic browsing through the PSI API. Treat agentic data from PSI as unverified until you see it in a response.

Performance score weights (Lighthouse 10–13.5)

Weights as read from default-config.js in 13.5.0:

Metric Weight
Total Blocking Time (TBT) 30%
Largest Contentful Paint (LCP) 25%
Cumulative Layout Shift (CLS) 25%
First Contentful Paint (FCP) 10%
Speed Index (SI) 10%

Score bands: 90–100 good, 50–89 needs improvement, 0–49 poor.

Core Web Vitals: INP replaced FID

Metric Good Needs improvement Poor
LCP (loading) ≤ 2.5 s ≤ 4.0 s > 4.0 s
INP (responsiveness) ≤ 200 ms ≤ 500 ms > 500 ms
CLS (visual stability) ≤ 0.1 ≤ 0.25 > 0.25

Throttling presets: US-first, Kenya 3G opt-in

These values come from lighthouse/core/config/constants.js in 13.5.0. By default Lighthouse uses simulated throttling (Lantern).

Profile RTT Throughput CPU When
Mobile, Slow 4G (mobileSlow4G, the default) 150 ms 1,638.4 Kbps 4x codeAmani default (US-first). PSI mobile uses the same profile: Moto G Power UA, 412×823 screen.
Desktop (--preset=desktop, desktopDense4G) 40 ms 10,240 Kbps 1x desktop audits, 1350×940
Regular 3G (mobileRegular3G) 300 ms 700 Kbps 4x Kenya-targeted projects only. Their design target is 2G/3G Android.
# US-first default (mobile, Slow 4G)
npx lighthouse@13.5.0 https://example.com --output=json --output-path=./report.json

# Desktop
npx lighthouse@13.5.0 https://example.com --preset=desktop

# Kenya-targeted projects only: Regular 3G
npx lighthouse@13.5.0 https://example.com \
  --throttling.rttMs=300 --throttling.throughputKbps=700 --throttling.cpuSlowdownMultiplier=4

Keep one fixed profile per project so runs stay comparable. Never compare a 3G run against a Slow 4G baseline. examples/node-api-throttling.mts does the same from the Node API, with the profiles us-mobile, us-desktop and kenya-3g.

Node API (Lighthouse 13)

import * as chromeLauncher from 'chrome-launcher';
import lighthouse, { desktopConfig, type Flags } from 'lighthouse';

const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless=new'] });
try {
  const flags: Flags = { port: chrome.port, output: 'json', logLevel: 'error',
    onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'] };
  const result = await lighthouse('https://example.com', flags /* , desktopConfig */);
  if (!result) throw new Error('no result');
  const perf = result.lhr.categories['performance']?.score; // 0..1 or null
} finally {
  chrome.kill();
}

PageSpeed Insights API (+ key)

GET https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=…&strategy=mobile|desktop&category=performance&category=seo&key=…

CrUX: field data

The Chrome UX Report gives real-user p75 values over a 28-day rolling window. It updates daily at around 04:00 UTC.

Lighthouse CI in GitHub Actions (SHA-pinned)

The full workflow is in examples/github/lighthouse.yml and the full config in examples/lighthouserc.cjs.

jobs:
  lhci:
    runs-on: ubuntu-latest
    permissions: { contents: read }
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with: { ref: "${{ github.event.pull_request.head.sha }}", fetch-depth: 20 }
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with: { node-version: 22, cache: npm }
      - run: npm ci && npm run build
      - run: npx --yes @lhci/cli@0.15.1 autorun
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

Budgets & assertions

Lighthouse 12 removed budget.json support from Lighthouse itself, so budgets now go in LHCI assertions:

assert: {
  preset: 'lighthouse:recommended',
  assertions: {
    'categories:performance': ['error', { minScore: 0.9, aggregationMethod: 'median-run' }],
    'categories:seo': ['error', { minScore: 0.95 }],
    'largest-contentful-paint': ['error', { maxNumericValue: 2500 }],
    'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }],
    'total-blocking-time': ['warn', { maxNumericValue: 200 }],
    'resource-summary:script:size': ['warn', { maxNumericValue: 300000 }],
    'resource-summary:third-party:count': ['warn', { maxNumericValue: 10 }],
  },
},

Environment variables

These are secrets. Keep them server-side and never put them in NEXT_PUBLIC_*:

PSI_API_KEY=your-pagespeed-insights-api-key
CRUX_API_KEY=your-crux-api-key
LHCI_GITHUB_APP_TOKEN=your-lhci-github-app-token

Non-secret settings:

Setting Value Where
PSI endpoint https://www.googleapis.com/pagespeedonline/v5/runPagespeed code constant
CrUX endpoint https://chromeuxreport.googleapis.com/v1/records:queryRecord code constant
Default strategy mobile route / CLI flag
Throttling profile us-mobile (Kenya-targeted: kenya-3g) per-project config
Node version 22.19+ for anything importing lighthouse Vercel project settings / CI setup-node

The Interactive Dashboard

Use the Site Selector to pick a portfolio site (primary: kenyanschools.org) or type a custom URL, then click Run Audit (PSI). You'll see:

Live: https://tech-stack.codeamanilabs.org/guide/lighthouse

To run the same logic from the CLI: node lighthouse/examples/run-audit.js https://kenyanschools.org [--full].

Lighthouse Plugin System

A plugin is an npm package named lighthouse-plugin-* that adds audits and one category. Since 13.5.0, Lighthouse validates plugin categories strictly. Only title, description, manualDescription, auditRefs and supportedModes are allowed, and any other key throws. The official guide is at https://github.com/GoogleChrome/lighthouse/blob/main/docs/plugins.md.

// lighthouse-plugin-kenyan-schools/plugin.js
export default {
  audits: [
    { path: 'lighthouse-plugin-kenyan-schools/audits/school-index-present.js' },
  ],
  category: {
    title: 'Kenyan Schools SEO',
    auditRefs: [{ id: 'school-index-present', weight: 1 }],
  },
};
// audits/school-index-present.js
import { Audit } from 'lighthouse';

class SchoolIndexPresent extends Audit {
  static get meta() {
    return {
      id: 'school-index-present',
      title: 'Page contains unique KSO school index',
      failureTitle: 'No unique KSO index identifier found',
      description: 'The directory uses internal KSO-XXXX codes.',
      requiredArtifacts: ['MainDocumentContent'],
    };
  }
  static audit({ MainDocumentContent }) {
    const has = /KSO-\d{4}/i.test(MainDocumentContent);
    return { score: has ? 1 : 0, numericValue: has ? 1 : 0 };
  }
}
export default SchoolIndexPresent;
npx lighthouse@13.5.0 https://kenyanschools.org \
  --plugins=lighthouse-plugin-kenyan-schools \
  --only-categories=lighthouse-plugin-kenyan-schools,seo

The audits bundled in examples/audits/ are:

Copy-paste templates (examples/)

File What
run-audit.js CLI that runs PSI (default) or local Chrome with --full, and prints insights JSON
extract-insights.js shared PSI/Chrome → insights transform (Lighthouse 13 audit IDs, field INP) plus an SSRF guard
dashboard-server.js Express GET /audit that mirrors the Next.js route
node-api-throttling.mts Node API with us-mobile / us-desktop / kenya-3g profiles
psi-crux.mts PSI lab + CrUX field data, graded against the CWV thresholds
lighthouserc.cjs LHCI collect/assert/upload config with budgets
github/lighthouse.yml SHA-pinned GitHub Actions workflow
plugin.js, audits/*.js custom plugin
../reference/cheatsheet.md versions, presets, audit renames, assertion syntax

codeAmani notes


Status: Reviewed 2026-10-20 against lighthouse 13.5.0, chrome-launcher 1.2.2, @lhci/cli 0.15.1, PSI API v5 and CrUX API v1.

Official docs: