web-vitals

web-vitals: Measure Core Web Vitals in the Browser

Library
npm
v6.1.1
8,586stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
75/100Good
Development Activity88
Maintenance44
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture84
Code Quality88
Innovation82
Learning Curve80

web-vitals is a tiny (~2KB brotli’d), modular library from the Chrome team for measuring the Core Web Vitals — Cumulative Layout Shift (CLS), Interaction to Next Paint (INP), and Largest Contentful Paint (LCP) — plus supporting metrics like First Contentful Paint (FCP) and Time to First Byte (TTFB), on real users in production. Crucially, it calculates each metric the exact same way Chrome does internally, so the numbers match what shows up in the Chrome User Experience Report, PageSpeed Insights, and Search Console’s Speed Report.

Each metric is exposed as a single function (onCLS, onINP, onLCP, onFCP, onTTFB) that takes a callback fired once the value is ready to report, with support for reporting on every change, reporting only deltas, and batching multiple metric reports together before sending them to an analytics endpoint. An optional “attribution” build adds diagnostic detail (e.g. which DOM element caused the layout shift) to help pinpoint the root cause of a poor score.

What You Get

  • onCLS, onINP, onLCP, onFCP, onTTFB - one function per metric, each accepting a callback fired when the value is ready to report
  • A “standard” build (~2KB) and an “attribution” build (+1.5KB) that adds root-cause diagnostic data to each metric
  • reportAllChanges option to observe a metric’s value as it changes in real time, useful for debugging
  • Delta-based reporting via each metric’s id/delta fields, for analytics providers that can’t overwrite previously-sent values
  • Built-in handling of edge cases: back/forward cache restores, page visibility changes, and pages loaded in the background

Common Use Cases

  • Sending real-user Core Web Vitals data to Google Analytics or Google Tag Manager to track site performance over time
  • Piping metrics to a custom analytics/RUM backend via navigator.sendBeacon or fetch for internal performance dashboards
  • Debugging a specific poor Core Web Vitals score using the attribution build to identify the exact element or resource responsible
  • Correlating field (real-user) performance data against lab-based Lighthouse scores to validate synthetic testing results

Under The Hood

Architecture Each metric has a dedicated entry file (src/onCLS.ts, src/onINP.ts, src/onLCP.ts, src/onFCP.ts, src/onTTFB.ts) that wires a PerformanceObserver (via the shared src/lib/observe.ts helper) to metric-specific accumulation logic — e.g. LayoutShiftManager.ts sums layout-shift session windows for CLS, InteractionManager.ts and LCPEntryManager.ts track interaction/paint timing for INP and LCP — then reports through a shared bindReporter.ts callback wrapper that handles the report-once vs report-all-changes vs delta-reporting behavior uniformly across metrics. Tech Stack Modular TypeScript (36% of source) compiled to ESM/CJS/IIFE bundles via Rollup, published with an exports map allowing consumers to import individual metric functions (tree-shakeable) or the full web-vitals or web-vitals/attribution entry points; there are no runtime dependencies. Code Quality The test/ directory pairs unit tests with WebdriverIO-driven browser integration tests (wdio.conf.js) that exercise real Core Web Vitals behavior across actual browser sessions rather than mocked APIs, reflecting the project’s status as the reference implementation Chrome itself validates other tools against; ESLint (flat config) enforces consistent style. API Design The one-function-per-metric design (onCLS(callback), onLCP(callback), etc.) is deliberately minimal — a single import and callback gets a working integration, and the standard vs attribution build split lets consumers opt into diagnostic complexity only when they need root-cause data, keeping the default path lightweight.

Used by 26 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
JavaScript
53%
Other

Cosmos-Server

Security · Authentication

6,121

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
79
Repo Health
59
Technical
66
Dependency
Built with
JavaScript53%
Go43%
Updated yesterday
Ruby
67%
Other

GitLab

Devops · Developer Tools

24,533

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
70
Dependency
Built with
Ruby67%
JavaScript20%
Updated today
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

153,450

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
66
Dependency
Built with
Python68%
TypeScript22%
Updated today
TypeScript
94%
AGPL 3.0

Laudspeaker

Marketing · Automation

2,618

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
53
Repo Health
66
Technical
64
Dependency
Built with
TypeScript94%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search