StackPractices
intermediate By Mathias Paulenko

Performance Budget Template

Template for defining, approving, and governing a web performance budget: baselining, thresholds, exception handling, CI/CD enforcement, alerting, review cadence, and links to the frontend and API budget specializations.

Overview

This template defines the governance layer of a web performance budget: what a budget is, who owns it, how thresholds are set and justified, how exceptions are granted, how it’s enforced in CI/CD, and how often it is reviewed. Use it when a team needs a written, agreed document that turns “the site should be fast” into enforceable numbers.

Two specializations hold the metric tables:

This document stays deliberately stack-agnostic. Concrete numbers below are starting points, not universal standards: the right budget is derived from your own baseline, your users’ devices, and what your business can afford to lose when a page is slow.


1. What a Performance Budget Is (and Is Not)

A performance budget is a documented upper limit on a measurable aspect of the user experience — a metric, a byte size, or a request count — that a page or application must stay under. It comes with three properties that separate it from a loose goal:

  1. It’s measurable. “Fast” isn’t a budget. “P75 LCP under 2.5 s on the product page, measured in field data” is.
  2. It’s agreed. Engineering, product, and design sign it. A budget nobody approved becomes a suggestion nobody follows.
  3. It’s got consequences. There’s a defined answer to “what happens when we exceed it” — the build fails, an alert fires, or an exception is granted.

A budget is not a ranking of Google thresholds. The “Good / Needs improvement / Poor” bands for Core Web Vitals are field-data cutoffs Google uses for assessment; your budget may be stricter (early warning before you hit “Poor”) or looser (a legacy admin tool that will never be re-planned). Write down which you chose and why.

It also isn’t a one-time audit. Audits produce a snapshot and a fix list; budgets produce a durable constraint that outlives whoever wrote it. Teams that audit yearly but budget never tend to rediscover the same regressions — the difference is whether the guardrail exists on the Tuesday nobody was thinking about performance.


2. When to Use This Template

  • Starting a project and you want performance constraints before they’re needed, not after a regression reaches users.
  • An existing site where regressions keep slipping in — each release adds “just 40 KB” of JavaScript.
  • After a redesign or platform migration, when old assumptions no longer hold.
  • When several teams ship to the same site and nobody can answer “who is allowed to make the checkout slower.”

If you only need per-page asset numbers for a client-side app, the frontend specialization is enough. If your problem is API latency, use the API specialization. Use this governance template when the missing piece is the process, not the numbers.

Two situations where this template is the wrong tool. A solo project or a two-person team doesn’t need signed approval and exception records — a short list of numbers in the README and a CI check is the honest version. And a site in active firefighting mode should fix the burning regression first; budgets prevent recurrence, they do not extinguish the current incident.


3. Template Body

Fill in each section. Delete what doesn’t apply; add what your organization needs. Placeholders in [brackets] are mandatory fields.

3.1 Budget Summary

FieldValue
Document owner[Team or role accountable for this budget]
Approved by[Engineering lead, product lead]
Approval date[YYYY-MM-DD]
Review cadence[Monthly / quarterly]
Next review[YYYY-MM-DD]
Applies to[URLs, page types, or apps in scope]
Explicitly out of scope[Tools, admin pages, legacy sections]
Data source of record[CrUX / RUM tool / synthetic]

3.2 Baseline and Target Derivation

Budgets set from intuition fail in two directions: too loose to matter, or so tight the team routes around them. Derive targets from measurement:

  1. Collect field data for at least 28 days. Use your RUM pipeline, the Chrome UX Report, or lab data from Lighthouse if no field data exists yet.
  2. Record the P75 (or P90 for strict budgets) per page type and metric.
  3. Set the budget at the current P75 minus a 10–20 % improvement margin, capped by what is technically reachable.
  4. For a new project with no baseline, borrow industry reference points — the Core Web Vitals thresholds and the web.dev performance budgets guide — and schedule a re-derivation after the first month of real traffic.
MetricField P75 todayProposed budgetSource
LCP[e.g. 3.1 s][e.g. 2.5 s][CrUX / RUM]
INP[e.g. 280 ms][e.g. 200 ms][RUM]
CLS[e.g. 0.12][e.g. 0.1][RUM]
Total page weight[e.g. 2.4 MB][e.g. 2.0 MB][Lab]
JS (compressed)[e.g. 310 KB][e.g. 250 KB][Lab]

3.3 Thresholds and Severity Levels

Define two limits per metric so a warning precedes a failure:

  • Budget (warn): the expected operating point. Crossing it creates a ticket or an annotation, not a failed build.
  • Hard limit (fail): the point where the user experience is measurably harmed. Crossing it blocks the release or pages the on-call rotation.
Rule of thumb: hard limit ≈ budget × 1.25. Adjust per metric —
CLS scales linearly, but LCP tolerance depends on your page type.
MetricBudget (warn)Hard limit (fail)Consequence
LCP P75[2.5 s][3.0 s]Warn: ticket. Fail: block deploy
INP P75[200 ms][300 ms]Same
CLS P75[0.1][0.15]Same
JS per route[200 KB][250 KB]Fail: block PR
Third-party count[8][12]Warn: review inventory

3.4 Roles and Exception Handling

The document must name who can say yes when a budget has to bend:

  • Budget owner — maintains this document, chairs reviews, arbitrates disputes.
  • Approvers — engineering lead plus product lead; both required for a permanent budget increase.
  • Exception — a time-boxed waiver for a specific route and metric, with an expiry date and a removal plan. Exceptions older than their expiry date fail the next review.
Exception record (keep one per granted waiver):
  Metric:        [INP on /dashboard]
  Budget:        [200 ms]  →  Temporary limit: [320 ms]
  Granted by:    [names, date]
  Expires:       [YYYY-MM-DD]
  Removal plan:  [link to the ticket that removes the heavy chart lib]

If exceptions expire silently, the budget is fictional. If exceptions are impossible, teams hide regressions instead of declaring them.

3.5 Enforcement Layers

Enforce at every layer you can; each catches a different failure mode:

LayerToolCatches
Pull requestLighthouse CI, size-limit, bundlesizeBundle growth before merge
Deploy gateSynthetic check on stagingRegressions merged across PRs
ProductionRUM + alertingReal-world regressions, third-party drift
Quarterly reviewThis documentSlow budget creep, expired exceptions

3.6 Monitoring and Alerting

Alert on field data, not lab data — lab is reproducible but blind to real networks. Route alerts to the team that owns the page, not a shared channel nobody reads.

Alert                    | Condition                          | Severity
─────────────────────────┼────────────────────────────────────┼──────────
LCP regression           | P75 > hard limit for 6 hours       | Critical
INP regression           | P75 > hard limit for 24 hours      | High
CLS regression           | P75 > hard limit for 24 hours      | High
New third-party script   | Script not in the inventory        | Medium
Budget utilization       | Any metric > 90% of budget, 7 days | Low

3.7 Third-Party Governance

Every third-party script needs an entry in an inventory before it ships. The inventory answers: what it does, who asked for it, its compressed size, when it loads, and whether it is still needed.

Script            | Owner      | Size (gzip) | Loads       | Last justified
──────────────────┼────────────┼─────────────┼─────────────┼───────────────
[Analytics]       | [Growth]   | [45 KB]     | [Async]     | [2026-09-01]
[Tag manager]     | [Growth]   | [35 KB]     | [Async]     | [2026-09-01]
[Support widget]  | [Support]  | [120 KB]    | [Lazy]      | [2026-06-15]

Entries not re-justified at the quarterly review are candidates for removal. Third-party weight is the most common way budgets die — not from one big addition, but by ten small ones nobody re-examined.

3.8 Reporting Format

Decide where the numbers live before anyone needs them. A budget nobody can check in thirty seconds gets checked never. The minimal reporting surface:

  • A per-page-type dashboard with P75 trend lines for each budgeted metric, owned by the budget owner.
  • A monthly one-page summary: utilization per metric, open exceptions with expiry dates, third-party inventory delta, and the single worst regression with its follow-up ticket.
  • The CI check output linked from every failing run — the PR author should reach the failing metric in one click, not by asking around.
Monthly summary (one screen, not a slide deck):
  Utilization:   LCP 78% | INP 64% | CLS 55% | JS 92% ⚠
  Exceptions:    [2 open, 1 expiring 2026-12-15]
  Third-party:   [+1 script this month — heatmap tool, excepted]
  Worst item:    [INP on /dashboard — ticket #4821]

4. CI/CD Enforcement Examples

These snippets are starting points. Adapt paths, URLs, and credentials. Keep the config files in the repo next to the budget document itself — when the thresholds live in lighthouserc.json and the numbers in section 3.3 drift apart, the version that loses is always the one in the document nobody opens.

4.1 Lighthouse CI Configuration

{
  "ci": {
    "collect": {
      "url": [
        "http://localhost:4321/",
        "http://localhost:4321/products",
        "http://localhost:4321/blog/sample-article"
      ],
      "numberOfRuns": 3,
      "settings": {
        "preset": "desktop"
      }
    },
    "assert": {
      "assertions": {
        "largest-contentful-paint": ["error", { "maxNumericValue": 2500 }],
        "interaction-to-next-paint": ["error", { "maxNumericValue": 200 }],
        "cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
        "resource-summary:script:size": ["error", { "maxNumericValue": 200000 }],
        "resource-summary:stylesheet:size": ["warn", { "maxNumericValue": 50000 }],
        "resource-summary:third-party:count": ["warn", { "maxNumericValue": 10 }]
      }
    },
    "upload": {
      "target": "temporary-public-storage"
    }
  }
}

Two things to know before copying this: temporary-public-storage uploads reports to a shared public server — use the Lighthouse CI server or artifact storage if reports contain internal URLs. And numberOfRuns: 3 is a floor, not a ceiling; medians from five runs are noticeably more stable.

4.2 GitHub Actions Workflow

name: Performance Budget Check
on: [pull_request]

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Build site
        run: npm run build

      - name: Start preview server
        run: npm run preview &

      - name: Wait for preview
        run: npx wait-on http://localhost:4321 --timeout 30000

      - name: Run Lighthouse CI
        run: npx @lhci/cli@latest autorun
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_TOKEN }}

wait-on polls until the server answers; a fixed sleep fails on slow runners and wastes time on fast ones. LHCI_TOKEN is optional — without it, Lighthouse CI still asserts and fails the job, it just skips the GitHub App status check.

4.3 Bundle Size Check (multi-file safe)

// scripts/check-bundle-size.mjs — fails when JS over budget, summed across files
import { readFileSync, readdirSync, statSync } from 'node:fs';
import { join } from 'node:path';
import { gzipSync } from 'node:zlib';

const DIR = 'dist';
const LIMIT = 250 * 1024; // hard limit, bytes after gzip

function* walk(dir) {
  for (const name of readdirSync(dir)) {
    const p = join(dir, name);
    if (statSync(p).isDirectory()) yield* walk(p);
    else yield p;
  }
}

let total = 0;
for (const file of walk(DIR)) {
  if (file.endsWith('.js')) total += gzipSync(readFileSync(file)).length;
}

const kb = (total / 1024).toFixed(1);
if (total > LIMIT) {
  console.error(`FAIL: JS total is ${kb} KB (limit ${LIMIT / 1024} KB)`);
  process.exit(1);
}
console.log(`OK: JS total is ${kb} KB`);

Summing per extension avoids the classic bug where cat assets/*.js | wc -c only works while there’s exactly one chunk — and it measures gzip size, which is what users actually download.

4.4 Real User Monitoring

// Report Core Web Vitals to your own endpoint with the web-vitals library.
import { onLCP, onINP, onCLS } from 'web-vitals';

function send(metric) {
  const body = JSON.stringify({
    name: metric.name,
    value: metric.value,
    rating: metric.rating,
    page: window.location.pathname,
  });
  navigator.sendBeacon('/api/web-vitals', body);
}

onLCP(send);
onINP(send);
onCLS(send);

If you can’t run your own RUM endpoint, CrUX and your analytics platform’s Web Vitals reporting cover the same role for field data — what matters is that the alert in section 3.6 reads real-user percentiles, not lab runs.


5. Adapting the Budget to Your Stack

The same template bends to different architectures:

  • Static / SSG (Astro, Hugo, Eleventy). Weight budgets dominate; JS is small by default. Watch image weight and third-party scripts — they’re the usual escape route around a clean build.
  • SSR / hybrid (Next.js, Nuxt). Budget server-side output (TTFB) alongside client JS. Hydration cost grows with component count even when bundle size looks flat.
  • SPA dashboards. Route-level budgets instead of a global one; the settings page doesn’t need the dashboard’s charting library. Expect looser JS budgets and compensate with stricter INP checks.
  • E-commerce. Checkout and product pages get the tightest budgets and the fewest third-parties — every added pixel competes with conversion.
  • Content sites. Images and web fonts dominate. Budget bytes per template (article, listing, home) rather than per site.

6. Review Cadence and Budget Lifecycle

A budget that’s never revised either fossilizes or gets ignored.

  • Monthly (first quarter): check utilization. A metric permanently under 70 % of budget can be tightened; one permanently at the hard limit needs root-cause work, not a bigger number.
  • Quarterly (steady state): re-derive targets from fresh field data, expire or renew exceptions, re-justify the third-party inventory, and compare against the public CrUX data for your segment.
  • On change: new major feature, architecture migration, or a shift in user devices (e.g., traffic moving to low-end mobile) all trigger an out-of-cycle review.

Record every change in the version history — a budget without history cannot answer “when did we allow this?“


7. Adoption Playbook

Rolling a budget into a team that has never had one goes better in stages than in a single “enforcement day.”

Week 1 — measure only. Turn on collection and record baselines per page type. Change nothing; you’re buying the numbers that make the budget defensible later.

Week 2 — draft and negotiate. Fill in sections 3.1–3.4 with real baselines and get the named approvers to sign. This is where the hard conversations belong — before a build has ever failed.

Week 3 — warnings on. Enable CI assertions in warn mode and start the RUM pipeline. Nobody’s PR fails yet, but the numbers are visible in every check run, which already changes behavior.

Week 4 — hard limits on. Flip the thresholds that matter to error. Expect one or two failing PRs in the first days; treat them as calibration, not as incidents.

Ongoing. Alerts live, exceptions logged, quarterly review on the calendar. The template is a living document — if a section keeps being skipped, the section is wrong, not the readers.

8. Worked Example

A mid-size content site inherits a redesign. Baseline: LCP 3.4 s (P75), INP 260 ms, CLS 0.14, 290 KB of JS per route, eleven third-party scripts, none re-justified in a year.

The team derives budgets with a 15–20 % improvement margin: LCP 2.8 s → hard limit 3.4 s; INP 220 ms → 300 ms; CLS 0.12 → 0.15; JS 240 KB → 300 KB. The number that matters politically isn’t the target but the trajectory — each quarter the budget tightens only if utilization stays low.

Three months in, two findings confirm the design. A tag-manager update adds a heatmap tool on a Friday; the “new third-party script” alert catches it on Monday, and it gets a scoped exception for the landing pages only. A checkout PR grows JS by 60 KB; the PR check fails, and the fix (dynamic-importing the analytics bundle) ships the same sprint instead of the next quarter. The budget didn’t prevent work — it made the trade-offs happen in a ticket instead of in production. By the second quarterly review the site sits at LCP 2.6 s with two exceptions expired and removed, which is what a working budget looks like: not zero regressions, but zero unexplained ones. The template did its job in the boring way: the same document that justified the heatmap exception also scheduled its removal, and nobody had to re-argue the principle in a meeting.

9. Common Mistakes

  • Setting budgets from Lighthouse defaults. Lab scores are a debugging tool; the budget belongs to field data. Start from your own P75.
  • One global number. A dashboard and a marketing page need different limits. Budget per page type or route class.
  • Warning-only enforcement. If nothing can fail, nothing is enforced. Keep at least one hard limit that blocks a release.
  • Ignoring third-party drift. A tag-manager change can add 100 KB without a code review. The inventory and the “new script” alert exist for exactly this.
  • Letting exceptions expire silently. Expired exceptions either get renewed explicitly or the metric goes back to budget — there is no third option.
  • Optimizing to the audit, not the user. Passing Lighthouse while RUM shows regressions means the lab setup is unrealistic, not that users are fine.

See Also

Frequently Asked Questions

How do I choose the right percentile for a performance budget?

P75 is the standard choice because it matches how Google evaluates Core Web Vitals: the page passes when 75 % of visits are within "Good." Use P90 for pages where tail performance directly costs money (checkout, signup) or where your audience skews to slow devices. Avoid means and medians — averages hide exactly the slow experiences a budget exists to prevent.

What is the difference between a budget and a hard limit?

The budget is the operating target: crossing it warns, opens a ticket, or requires justification in review. The hard limit is the failure boundary: crossing it blocks the release. Keeping them separate matters — a single number forces a choice between "so tight it always complains" and "so loose it never bites." Two thresholds give you both an early warning and a real consequence.

Should performance budgets use lab data or field data?

Field data is the authority for alerting and review because it captures real devices and networks; CrUX is the reference implementation. Lab data (Lighthouse CI) is the right enforcement layer at the pull request because it's deterministic and runs before merge. Use lab to prevent, field to confirm — and expect the numbers to differ, since lab throttling only approximates real conditions.

How do I get a budget approved when stakeholders want more features?

Frame it as a trade, not a veto. Show the field data: what P75 INP looks like now, what users on mid-range phones actually wait, and which third-party script the new feature depends on. A documented exception with an expiry date is often the honest answer — it ships the feature and schedules its diet. Budgets that only say no get routed around; budgets that record trade-offs get used.

How often should a performance budget be updated?

Monthly while it's new, quarterly once it stabilizes, and immediately when the architecture, a major feature, or the audience's device mix changes. A budget untouched for a year is usually measuring a site that no longer exists. Whatever the cadence, log every change with a reason so future reviewers can see intent instead of guessing.

Can I have different budgets for different pages?

You should. Page-type budgets are the norm: a content article can hold 120 KB of JavaScript while a data-heavy dashboard legitimately needs more — but pays for it with stricter INP and hydration checks. Define route classes in section 3.1 ("applies to") and give each its own row in the threshold table. One site-wide number almost always means "loose for everything that matters."

What happens when a third-party script blows the budget?

Two paths, both documented. If the script is essential (payment, consent), record a scoped exception: which pages load it, its real compressed size, and when it gets re-justified. If it isn't essential, the removal is the answer — and the inventory review is what makes that visible. Silent accumulation is the failure mode; either documented outcome is acceptable.

Who should own the performance budget?

One named owner — a role, not a committee. In small teams that's the engineering lead; in larger ones, a platform or web-performance engineer who chairs the review and arbitrates exceptions. The owner doesn't have to fix every regression; they have to make sure every regression has a name, a decision, and a date. Budgets owned by "the team" are owned by no one, and the first quarter-end crunch proves it.

Do I need Lighthouse CI, or are other tools acceptable?

Lighthouse CI is the common choice because it's free, scriptable, and asserts on both lab metrics and resource sizes. Alternatives cover the same role: size-limit or bundlesize for byte budgets, sitespeed.io for synthetic monitoring, and commercial RUM platforms for field alerting. What isn't optional is having something fail a pull request when a hard limit is crossed — a budget that lives only in a document is enforced only in theory.