A TypeScript-based tool that runs Google PageSpeed Insights analysis on multiple pages in parallel and generates comparative performance reports.
This project enables bulk performance analysis by running PageSpeed Insights tests on multiple URLs simultaneously. It aggregates and compares performance metrics, accessibility scores, and optimization data across all analyzed pages, making it easy to identify performance trends and issues across your entire site.
- π Parallel processing of multiple URLs for faster analysis
- π Fetches performance data from Google PageSpeed Insights API
- π± Supports both mobile and desktop analysis
- π Generates comparative reports in HTML or XLSX format
- π Compare performance across multiple pages side-by-side
- π Excel export for easy data analysis and sharing
- π¨ Clean, formatted output using Handlebars templates
- π§ TypeScript for type safety and better developer experience
- Node.js (v14 or higher recommended)
- Google PageSpeed Insights API key (get one here)
- Clone the repository
- Install dependencies:
npm install- Copy the example environment file:
cp .env.example .env- Add your PageSpeed Insights API key to the
.envfile:
PSI_API_KEY=your_api_key_here
Edit the src/config/index.ts file to add the pages you want to analyze.
const pageSlugs = [
'about'
];Run the tool with HTML output (default):
npm start
# or
npm run start:htmlRun the tool with XLSX (Excel) output:
npm run start:xlsxOr use the format flag directly:
npm start -- --format=html
npm start -- --format=xlsxThe generated report will be saved in the output directory as either report.html or report.xlsx.
βββ src/
β βββ index.ts # Main entry point
β βββ reportTemplate.hbs # Handlebars template for HTML reports
β βββ helpers/ # Helper functions
β βββ types/ # TypeScript type definitions
βββ output/ # Generated reports directory
βββ .env.example # Environment variables template
βββ tsconfig.json # TypeScript configuration
This project is licensed under the MIT License - see the LICENSE file for details.
This project uses the Google PageSpeed Insights API.
