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:
- Chrome DevTools (Lighthouse panel). 13.5.0 is expected to ship in Chrome 156.
- PageSpeed Insights (PSI). The changelog says each Lighthouse release reaches PSI "within 2 weeks".
- Lighthouse CI (
@lhci/cli, GitHub Actions, Vercel previews). - Your own Node scripts (
import lighthouse from 'lighthouse').
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 |
- Each metric is judged at the 75th percentile of page loads, split by mobile and desktop. A page passes only when all three metrics are "good".
- INP replaced FID as the responsiveness Core Web Vital on 12 March 2024, and FID is retired. Some PSI docs samples still show
FIRST_INPUT_DELAY_MS. ReadINTERACTION_TO_NEXT_PAINTinstead. - INP is field-only. A cold navigation run has no user interaction, so lab INP is empty. TBT is the lab proxy. Lighthouse timespan mode (user flows) can measure INP for a scripted interaction.
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();
}
- For desktop, pass the built-in
desktopConfigexport. If you only setformFactor: 'desktop', mobile throttling and screen emulation stay in place. - Read the 13.x insight audits (
cache-insight,third-parties-insight,lcp-breakdown-insight, and so on). An "opportunity" is now any failing audit with non-zerometricSavings. The olddetails.type === 'opportunity'check returns nothing.
PageSpeed Insights API (+ key)
GET https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=…&strategy=mobile|desktop&category=performance&category=seo&key=…
- Parameters:
url(required),category(repeatable:accessibility,best-practices,performance,seo),strategy,locale,utm_campaign,utm_sourceandcaptchaToken. - Response:
lighthouseResultholds the lab result (a Lighthouse LHR). Field data comes in two CrUX blocks:loadingExperience(URL level) andoriginLoadingExperience(origin level). Each field p75 is atloadingExperience.metrics.<METRIC>.percentile, e.g.INTERACTION_TO_NEXT_PAINTorFIRST_CONTENTFUL_PAINT_MS. - Get a key: in the Google Cloud console, open APIs & Services, enable the PageSpeed Insights API, then go to Credentials and choose Create API key. Restrict the key to the PSI API, and to server IPs where you can. Send it as the
key=parameter. - Always use a key. Keyless calls share a global per-day quota. A keyless call on 2026-10-20 returned
429 Quota exceeded … 'Queries per day'. Third-party sources cite a default of 25,000 queries/day, but Google's PSI docs don't state one, so check the Quotas page for your project. - A PSI run takes 10–30 s. Cache the results (the dashboard route sets
max-age=300), and never call PSI from the browser with your 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.
- Request:
POST https://chromeuxreport.googleapis.com/v1/records:queryRecord?key=…with a JSON body of{ "origin" | "url", "formFactor": "PHONE" | "DESKTOP" | "TABLET", "metrics": [...] }. - Metrics include
largest_contentful_paint,interaction_to_next_paint,cumulative_layout_shift(its p75 is encoded as a string),first_contentful_paintandexperimental_time_to_first_byte. - Limits and errors: 150 queries/min per project, free. A
404means the page has too little Chrome traffic. Fall back to lab data plus your own RUM. - A separate CrUX History API serves trend data. See the CrUX docs before relying on its shape.
- Key: use a separate key provisioned for the Chrome UX Report API.
examples/psi-crux.mtsuses it to grade all three CWV against the thresholds. - Sites with no data: low-traffic and new sites, which describes most new codeAmani products, often have no CrUX data. Add RUM with the
web-vitalslibrary or Vercel Speed Insights, and use Lighthouse CI as the regression gate.
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 }}
- Pinning: pin every action to a full commit SHA with the tag in a comment, and pin
@lhci/clito an exact version. To re-resolve a SHA, rungh api repos/<owner>/<repo>/commits/<tag> --jq .sha. - Preview URLs: to audit a deployed Vercel preview instead of localhost, use
treosh/lighthouse-ci-action@3e7e23fb74242897f95c0ba9cabad3d0227b9b18 # 12.6.2withurls:. Give it an rc file that has nocollect.urland nostartServerCommand. - LHCI audits with Lighthouse 12.6.1, not 13.x. Assertions on 13-only audit IDs (
*-insight,agentic-browsing) won't match in LHCI 0.15.1. Assert on categories and core metrics, which exist in both versions. - Upload targets:
upload.target: 'temporary-public-storage'is public, and reports are deleted after a few days. To keep history, uselhci(a self-hosted LHCI server) orfilesystem.
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 }],
},
},
- Levels:
off,warnorerror. - Options:
minScore,maxNumericValue,maxLengthandaggregationMethod. The aggregation methods areoptimistic(the default),pessimistic,medianandmedian-run. - Presets:
lighthouse:all,lighthouse:recommendedandlighthouse:no-pwa.no-pwanow behaves likerecommended, because PWA audits no longer exist. - Runs:
numberOfRunsdefaults to 3. Lab results vary from run to run, so gate onmedian-runrather than on a single run.
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:
- Category scores (0–100) for the four scored categories, plus radial gauges.
- Core Web Vitals. LCP and CLS come from the lab run. INP comes from CrUX field data when PSI returns it; otherwise it's empty, because INP is field-only.
- Custom plugin audits ("Has KSO index", "County geo present", "School JSON-LD").
- Cache data, opportunities, a network summary, third-party usage and a history trend.
Live: https://tech-stack.codeamanilabs.org/guide/lighthouse
- Production data path: PSI, called server-side by
/api/lighthouse. SetPSI_API_KEYin the Vercel env. ?full=true: runs local headless Chrome. It's for local and CI use only. Vercel has no Chrome binary, so there it falls back to PSI.
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:
school-index-present: checks for a KSO-XXXX code.county-geo-data: checks for a county name plus lat/long.structured-school-data: checks for"@type": "School"JSON-LD.
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
- Server-side keys only.
PSI_API_KEYandCRUX_API_KEYlive in the secrets vault or Vercel env, and only route handlers read them. The dashboard calls/api/lighthousesame-origin, so the browser never sees a Google key. Restrict both keys to their own APIs. - SSRF: any endpoint that audits a user-supplied URL fetches that URL server-side. Keep
assertPublicUrl(), which rejects loopback, RFC1918, link-local and metadata IPs. Require auth, and prefer a hostname allowlist of sites we own. - US-first defaults: gate on mobile Slow 4G (the Lighthouse and PSI default) plus a desktop run. Add the
kenya-3g(Regular 3G) profile as an extra CI job only for Kenya-targeted projects: thecodeAmani-labs-projects/WhatsApp + M-Pesa apps andkenyanschools.org. Those projects should also keep tight JS budgets; seeAFRICAN_MARKET_GUIDE.md. - Payments pages: Stripe is the default rail. Stripe Checkout is hosted on Stripe's domain, so audit your own pricing and checkout-start pages, not
checkout.stripe.com. For Kenya-targeted M-Pesa flows, audit the STK-push status page on 3G. - Supply chain: pin all Actions to SHAs and pin
@lhci/cliexactly. A Lighthouse audit is a CI check, not a shipped artifact, so it doesn't need SLSA provenance. Lighthouse itself has published to npm through Trusted Publishing (OIDC) since 13.4.1. - AI routing: to summarise a Lighthouse report or turn insights into a fix plan, send the extracted JSON to Claude rather than the 1–3 MB raw LHR.
- Node version: keep
packages/dashboardbuilds on Node 22.19+. The rootenginesfield still says>=20. - Agentic Browsing: an early signal for our MCP-exposed and agent-facing products (
llms.txt, WebMCP). Track it as informational, and don't gate PRs on it while Google marks it "under development".
Official links
- Overview: https://developer.chrome.com/docs/lighthouse/overview
- Performance scoring: https://developer.chrome.com/docs/lighthouse/performance/performance-scoring
- Agentic Browsing scoring: https://developer.chrome.com/docs/lighthouse/agentic-browsing/scoring
- Changelog: https://github.com/GoogleChrome/lighthouse/blob/main/changelog.md
- Plugins: https://github.com/GoogleChrome/lighthouse/blob/main/docs/plugins.md
- Lighthouse CI config: https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md
- PSI API v5: https://developers.google.com/speed/docs/insights/v5/get-started
- CrUX API: https://developer.chrome.com/docs/crux/api
- Core Web Vitals: https://web.dev/articles/vitals
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:
- https://developer.chrome.com/docs/lighthouse/overview
- https://developer.chrome.com/docs/lighthouse/performance/performance-scoring
- https://developer.chrome.com/docs/lighthouse/agentic-browsing/scoring
- https://github.com/GoogleChrome/lighthouse/blob/main/changelog.md
- https://github.com/GoogleChrome/lighthouse/blob/main/docs/plugins.md
- https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md
- https://developers.google.com/speed/docs/insights/v5/get-started
- https://developer.chrome.com/docs/crux/api
- https://web.dev/articles/vitals