Set the number before writing a line of code
{
"budgets": [
{ "path": "/*", "resourceSizes": [
{ "resourceType": "script", "budget": 170 },
{ "resourceType": "image", "budget": 300 }
]}
]
}
Agreeing a JavaScript and image size budget with a client at kickoff - not after launch - turns performance from a subjective argument into a specific, shared number everyone's already agreed to.
Enforce it in CI, not just at review time
# A build step fails automatically if the budget is exceeded
lighthouse-ci autorun --budgetPath=./budget.json
A budget that only gets checked manually, occasionally, drifts. A budget enforced automatically on every pull request catches the regression the same day it's introduced, while it's still cheap to fix.
Budgets need owners, not just numbers
When a budget is exceeded, someone specific needs to decide: trim the feature, optimise the asset, or consciously raise the budget. A budget nobody's actually accountable for just becomes noise the team learns to ignore.
A number the team can't argue with in the moment
{
"budget": [{ "resourceSizes": [{ "resourceType": "script", "budget": 300 }] }]
}
"Let's keep it fast" is a sentiment everyone agrees with and nobody enforces under deadline pressure. "JavaScript stays under 300KB gzipped, checked automatically in CI" is a number a pull request either meets or doesn't - the budget turns a vague intention into an enforceable gate, which is the entire value of setting one in the first place.
Set the budget from a real device, not a fast laptop
A performance budget calibrated against a developer's high-end machine and fast office wifi routinely allows something that's genuinely unusable on the mid-range Android phone and patchy 4G connection a meaningful share of real visitors are using. Testing against a throttled, mid-tier device profile when setting the initial budget avoids shipping a "passing" budget that doesn't reflect anyone's actual experience.