Skip to content
Projects

emazzotta/lighthouse-badges

View on GitHub

emazzotta/lighthouse-badges has 227 GitHub stars and 32 forks. Star changes are not measured yet. Last checked 2026-11-15 23:53 UTC. Last push 2026-11-13.

How these counts are measured

Measured star growth

in 24h
Update delayed
in 7 days
Update delayed
in 15 days
Update delayed
in 1 month
Update delayed

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

🚦 Generate badges (shields.io) based on Lighthouse performance.

Developer Tools

README.md

Original

Build Status NPM downloads NPM version License

Lighthouse Badges

Lighthouse

This package allows you to easily create Lighthouse badges for all Lighthouse categories.
Ever wanted to brag about your site's awesome Lighthouse performance? Then this is the package for you!

https://github.com/user-attachments/assets/c94f48eb-3ac5-4013-8b4e-9327ec108a8c

Examples

All Badges

Lighthouse Accessibility Badge Lighthouse Agentic Browsing Badge Lighthouse Best Practices Badge Lighthouse Performance Badge Lighthouse SEO Badge

Single Badge

Lighthouse

Usage

Help

usage: lighthouse-badges [-h] [-v] [-s]
                         [-b {flat,flat-square,plastic,for-the-badge,social}]
                         [-o OUTPUT_PATH] [-r] -u URL

Generate gh-badges (shields.io) based on lighthouse performance.

options:
  -h, --help            show this help message and exit
  -v, --version         Show the version of the tool
  -s, --single-badge    Output only one single badge averaging all lighthouse
                        categories' scores
  -b, --badge-style {flat,flat-square,plastic,for-the-badge,social}
                        Define look and feel for the badge
  -o, --output-path OUTPUT_PATH
                        Define output path for artifacts
  -r, --save-report     Save the lighthouse report as html next to the badges

Required arguments:
  -u, --url URL         The url whose lighthouse scores the badge(s) will show

Additionally, you can pass parameters configurations to the lighthouse process directly via environment variable path to the config file:

# The variable name matters, but the path can be anything
export LIGHTHOUSE_BADGES_CONFIGURATION_PATH="~/.lhb-config.json" 

# "extends": "lighthouse:default" is needed, the rest is optional
cat << EOF >! $LIGHTHOUSE_BADGES_CONFIGURATION_PATH
{
  "extends": "lighthouse:default",
  "settings": {
    "extraHeaders": {
      "Authorization": "Bearer ..."
    },
    "onlyCategories": [
      "performance",
      "pwa"
    ],
    "formFactor": "mobile"
  }
}
EOF

lighthouse-badges --url https://www.youtube.com/

See here for more configuration examples in the official lighthouse docs.

Run

Bun >= 1.0.0 is required.

Option 1: bun

bun install -g lighthouse-badges
lighthouse-badges --url https://www.youtube.com/ -o test_results

Option 2: bunx

bunx lighthouse-badges --url https://www.youtube.com/ -o test_results

Option 3: Docker

# May alter lighthouse results due to performance differences compared to running directly on host
docker run --rm \
    -v $PWD/test_results:/home/chrome/reports \
    emazzotta/lighthouse-badges \
    /bin/sh -c "lighthouse-badges --url https://www.youtube.com/"

Develop

bun run start # To run the lighthouse-badges code on google.com

Contributing

See contribution guideline

Sponsors

Sponsored by JetBrains

Jetbrains Logo

Author

Emanuele Mazzotta