Introduction | lighthouse-rust | Spatie      

 SPATIE  

lighthouse-rust
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Lighthouse-rust](https://spatie.be/docs/lighthouse-rust/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/lighthouse-rust/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/lighthouse-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/lighthouse-rust/v1/support-us)
- [ Requirements ](https://spatie.be/docs/lighthouse-rust/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/lighthouse-rust/v1/installation-setup)
- [ Testing ](https://spatie.be/docs/lighthouse-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/lighthouse-rust/v1/changelog)

Usage
-----

- [ Generating your first report ](https://spatie.be/docs/lighthouse-rust/v1/usage/generating-your-first-report)
- [ Configuring a run ](https://spatie.be/docs/lighthouse-rust/v1/usage/configuring-a-run)
- [ Working with results ](https://spatie.be/docs/lighthouse-rust/v1/usage/working-with-results)
- [ Saving an HTML report ](https://spatie.be/docs/lighthouse-rust/v1/usage/saving-an-html-report)
- [ Using performance budgets ](https://spatie.be/docs/lighthouse-rust/v1/usage/using-performance-budgets)

  Lighthouse-rust 
=================

 Run Google Lighthouse using Rust 

### Useful links

- [Repository](https://github.com/spatie/lighthouse-rust)
- [Discussions](https://github.com/spatie/lighthouse-rust/discussions)

Introduction
------------

[Google Lighthouse](https://developer.chrome.com/docs/lighthouse/overview/) is an open-source, automated tool for improving the quality of web pages. It has audits for performance, accessibility, SEO and more.

This package makes it easy to run Lighthouse using Rust. Here's an example on how to get the scores of the four categories of audits that Lighthouse offers.

```
use spatie_lighthouse::Lighthouse;

let result = Lighthouse::url("https://example.com")?.run()?;

let scores = result.scores();
// For example: {"accessibility": 83, "best-practices": 90, "performance": 98, "seo": 92}
```

It's easy to configure various options:

```
use spatie_lighthouse::{Category, Lighthouse};

let result = Lighthouse::url("https://example.com")?
    .user_agent("My user agent")
    .headers([("MyExtraHeader", "HeaderValue")])
    .categories([Category::Performance, Category::Accessibility])
    .throttle_cpu(None)
    .run()?;
```

Here's how you can get the results of an audit:

```
let audit = result.audit("first-contentful-paint")?;
```

You can also write a full HTML report to disk using `result.save_html("report.html")?`.

This is a wrapper around installed Node.js Lighthouse and Chrome, not a native reimplementation. Continue with [requirements](/docs/lighthouse-rust/v1/requirements) and [installation &amp; setup](/docs/lighthouse-rust/v1/installation-setup).

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
