DEVOPS

Vercel Bundle-Size Budget Gate on Pull Requests

Compares the bundle size of a Vercel preview deploy against the production baseline on every PR and posts a pass/fail GitHub status check that blocks merges exceeding…

CategoryDevOps
Enginesim
Difficultyintermediate
Triggerwebhook
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerVercel preview deploy ready webhookVercelVercel
  • ActionFetch per-route bundle sizes from build outputVercelVercel
  • ActionLoad production baseline sizesPostgreSQLPostgres
  • LogicCompare route deltas against byte budget
  • OutputPost pass/fail GitHub commit status on the PRGitHubGitHub

What it does

Enforces a hard bundle-size budget on every pull request. When a preview deploy finishes, it pulls the build's route-level JavaScript sizes, diffs them against the current production baseline, and writes a GitHub commit status that blocks the merge if any route grows past its allowed delta.

When to use it

Use it when you want bundle bloat to fail CI the same way a broken test does, rather than being noticed weeks later. Ideal for teams shipping a Next.js or similar app on Vercel where first-load JS directly affects user experience.

How it works

  1. 1A Vercel deployment-ready webhook fires when a preview build for a PR completes.
  2. 2The flow fetches the build output and per-route bundle sizes from the Vercel API.
  3. 3It reads the stored production baseline sizes from Postgres.
  4. 4A budget check compares each route delta against its configured byte threshold.
  5. 5If any route exceeds budget the flow posts a failing GitHub commit status with the offending routes; otherwise it posts success. The status appears directly on the PR as a required check.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect VercelDeploys, runtime logs, analytics.
  2. 2
    Connect GitHubRepos, issues, pull requests, actions.
  3. 3
    Connect PostgresAny Postgres URL — query, write, migrate.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.