A simple Node.js application that uses the Google PageSpeed Insights API to analyze a website's performance, save results in a JSON file, and display the results using a Bootstrap-styled interface.
- 📩 Submit any URL to analyze
- ⚙️ Uses Google PageSpeed Insights API (mobile strategy)
- 💾 Saves result in
results/
folder as a timestamped JSON file - 📊 Displays score and key performance metrics with Bootstrap styling
- Node.js
- Express.js
- EJS templating engine
- Bootstrap 5
- node-fetch
- dotenv
- Node.js v14+
- Google PageSpeed Insights API key
-
Clone the repository:
git clone https://github.com/indrajithc/pagespeed-app.git cd pagespeed-app
-
Install dependencies:
npm install
-
Create a
.env
file:touch .env
Add your API key:
PAGESPEED_API_KEY=your_pagespeed_api_key_here
You can get a free API key from Google PageSpeed API Docs.
-
Run the app:
npm start
-
Visit in browser:
pagespeed-app/
├── public/ # Static assets (CSS, etc.)
├── results/ # JSON results saved here
├── views/ # EJS templates for UI
│ ├── index.ejs
│ └── result.ejs
├── .env # Contains your API key
├── app.js # Main server logic
├── package.json
└── README.md
- Overall Performance Score
- First Contentful Paint (FCP)
- Speed Index
- Largest Contentful Paint (LCP)
- Time to Interactive (TTI)
- Total Blocking Time (TBT)
- Cumulative Layout Shift (CLS)
Color-coded using Bootstrap:
- 🟢 Green: Good
- 🟡 Yellow: Needs Improvement
- 🔴 Red: Poor
MIT License