A web-based tool for comparing Chrome UX Report (CrUX) performance data across multiple origins or URLs. Built with Astro and Svelte.
Live tool: crux.gotomi.info
CrUX Compare helps you analyze and compare real-world user experience metrics from the Chrome UX Report. Compare performance data across different URLs or origins to identify performance differences, track improvements, and understand how your site performs on different device types (phone, tablet, desktop).
- Multi-URL Comparison - Analyze and compare CrUX data for multiple URLs simultaneously
- Device Type Selection - View metrics for all form factors, phones, tablets, or desktops
- Flexible Analysis - Compare full URLs or entire origins
- Visual Metrics Display - Clear visualization of Core Web Vitals and other performance metrics
- Real-time Data - Fetch latest CrUX data directly from Google's API
- Frontend Framework: Astro with Svelte components
- CrUX API Client: kruk
- Language: TypeScript/JavaScript
- Package Manager: npm
Before you begin, you'll need:
- Node.js - Current LTS version or later
- Chrome UX Report API Key - Required to access CrUX data
- Get your API Key
- Requires a Google Cloud project with CrUX API enabled
git clone https://github.com/gotomi/crux-compare.git
cd crux-comparenpm installCreate a .env.local file in the project root with your CrUX API key:
PSIKUS=your_api_key_hereAlternatively, set the environment variable in your system or in your deployment platform's environment settings.
npm run devThis will start the Astro development server at http://localhost:3000.
- Open the tool in your browser (localhost:3000 or deployed URL)
- Enter one or more URLs to analyze in the URL input fields
- Choose your device type preference (All Form Factors, Phone, Tablet, or Desktop)
- Optionally check the "origin" box to compare origins instead of full URLs
- Click "Get CrUX Data" to fetch and display the metrics
- URL:
https://example.com/blog - Origin Mode: Unchecked (analyze specific URL)
- Device Type: Phone
- Result: See phone performance metrics for that specific URL
src/
├── pages/
│ ├── index.astro # Main page
│ └── api/
│ └── getCrux.js # API endpoint for CrUX API calls
├── components/
│ ├── CruxApp.svelte # Main app component with form
│ ├── Header.svelte # Results header
│ ├── MetricsByUrl.svelte # Metrics organized by URL
│ ├── UrlsByMetric.svelte # Metrics organized by device type
│ ├── Metric.svelte # Individual metric display
│ ├── Legend.svelte # Metric legend
│ ├── UiInput.svelte # URL input component
│ ├── UrlWithIcon.svelte # URL display with favicon
│ └── Header.svelte # Page header
└── env.d.ts # TypeScript environment types
npm run dev- Start the development servernpm run build- Build for productionnpm run preview- Preview production build locallynpm run astro- Run Astro CLI commands
Build the project for production:
npm run buildThe build output is in the dist/ directory. Deploy it to any hosting platform that supports Node.js or Deno (the project uses the Deno adapter). Set the PSIKUS environment variable on your platform to your CrUX API key.
- Frontend: Users enter URLs and select filters through the Svelte interface
- Form Submission: Form data is sent to the Astro API endpoint
- Backend Processing: The
getCruxendpoint uses thekruklibrary to query Google's CrUX API - Data Transformation: Results are processed and organized for display
- Visualization: Metrics are displayed side-by-side for easy comparison
The tool displays the following metrics (when available):
- Core Web Vitals:
- LCP (Largest Contentful Paint)
- FID (First Input Delay)
- CLS (Cumulative Layout Shift)
- Additional Metrics:
- FCP (First Contentful Paint)
- TTFB (Time to First Byte)
- INP (Interaction to Next Paint)
ALL_FORM_FACTORS- All device types combinedPHONE- Mobile phone dataTABLET- Tablet dataDESKTOP- Desktop data