Skip to content
lighthouse
Menu

Self-hosted Lighthouse CI

Lighthouse scores for every repo, on one server you run

Register a repo, add one CI step, and every pull request uploads its Lighthouse report to your LHCI server. The score history lives in your own Postgres database.

Sample buildmy-app · 3f9c2e1 · feature/hero-image
  • 91Performance
  • 100Accessibility
  • 96Best Practices
  • 92SEO
Sample builds with their performance score
CommitBranchPerf
3f9c2e1feature/hero-image91
b71d0a4main87
0e5a9c3main84

Sample data. Compared against base branch main.

From a new repo to scores on every pull request

  1. Step 1

    Deploy the server

    Run apps/server as a container with a Postgres database and set LHCI_DATABASE_URL and the server basicAuth pair, LHCI_BASIC_AUTH_USERNAME and LHCI_BASIC_AUTH_PASSWORD.

  2. Step 2

    Register the repo

    lhci-toolkit register <name> creates a Project and prints its id, its Build token and its Admin token. Registration itself needs the server basicAuth pair.

  3. Step 3

    Wire lighthouserc.js

    Point upload at your server with target lhci, the Build token and upload.basicAuth. Without basicAuth the upload fails with 401, even with a valid token.

  4. Step 4

    Add the CI step

    Run npx @lhci/cli autorun with LHCI_BUILD_TOKEN, LHCI_BASIC_AUTH_USERNAME and LHCI_BASIC_AUTH_PASSWORD. Add GITHUB_TOKEN and Lighthouse CI posts its score on the pull request.

The full loop →

Keep your score history in one place you own

Deploy the server once, then onboard each repo in a few minutes.